firebase::database::ChildListener

This is an abstract class.

#include <listener.h>

Child listener interface.

Summary

Subclasses of this listener class can be used to receive events about changes in the child locations of a firebase::database::Query or firebase::database::DatabaseReference. Attach the listener to a location with Query::AddChildListener() or DatabaseReference::AddChildListener() and the appropriate method will be triggered when changes occur.

Constructors and Destructors

~ChildListener()

Public functions

OnCancelled(const Error & error, const char *error_message)=0
virtual void
This method will be triggered in the event that this listener either failed at the server, or is removed as a result of the security and Firebase rules.
OnChildAdded(const DataSnapshot & snapshot, const char *previous_sibling_key)=0
virtual void
This method is triggered when a new child is added to the location to which this listener was added.
OnChildChanged(const DataSnapshot & snapshot, const char *previous_sibling_key)=0
virtual void
This method is triggered when the data at a child location has changed.
OnChildMoved(const DataSnapshot & snapshot, const char *previous_sibling_key)=0
virtual void
This method is triggered when a child location's priority changes.
OnChildRemoved(const DataSnapshot & snapshot)=0
virtual void
This method is triggered when a child is removed from the location to which this listener was added.

Public functions

OnCancelled

virtual void OnCancelled(
  const Error & error,
  const char *error_message
)=0

This method will be triggered in the event that this listener either failed at the server, or is removed as a result of the security and Firebase rules.

Details
Parameters
error
A code corresponding to the error that occurred.
error_message
A description of the error that occurred.

OnChildAdded

virtual void OnChildAdded(
  const DataSnapshot & snapshot,
  const char *previous_sibling_key
)=0

This method is triggered when a new child is added to the location to which this listener was added.

Details
Parameters
snapshot
An immutable snapshot of the data at the new data at the child location.
previous_sibling_key
The key name of sibling location ordered before the child. This will be nullptr for the first child node of a location.

OnChildChanged

virtual void OnChildChanged(
  const DataSnapshot & snapshot,
  const char *previous_sibling_key
)=0

This method is triggered when the data at a child location has changed.

Details
Parameters
snapshot
An immutable snapshot of the data at the new data at the child location.
previous_sibling_key
The key name of sibling location ordered before the child. This will be nullptr for the first child node of a location.

OnChildMoved

virtual void OnChildMoved(
  const DataSnapshot & snapshot,
  const char *previous_sibling_key
)=0

This method is triggered when a child location's priority changes.

See DatabaseReference::SetPriority() for more information on priorities and ordering data.

Details
Parameters
snapshot
An immutable snapshot of the data at the new data at the child location.
previous_sibling_key
The key name of sibling location ordered before the child. This will be nullptr for the first child node of a location.

OnChildRemoved

virtual void OnChildRemoved(
  const DataSnapshot & snapshot
)=0

This method is triggered when a child is removed from the location to which this listener was added.

Details
Parameters
snapshot
An immutable snapshot of the data at the new data at the child location.

~ChildListener

virtual  ~ChildListener()