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 afirebase::database::Query orfirebase::database::DatabaseReference. Attach the listener to a location withQuery::AddChildListener() orDatabaseReference::AddChildListener() and the appropriate method will be triggered when changes occur.

Constructors and Destructors

~ChildListener()

Public functions

OnCancelled(constError & 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(constDataSnapshot & 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(constDataSnapshot & snapshot, const char *previous_sibling_key)=0
virtual void
This method is triggered when the data at a child location has changed.
OnChildMoved(constDataSnapshot & snapshot, const char *previous_sibling_key)=0
virtual void
This method is triggered when a child location's priority changes.
OnChildRemoved(constDataSnapshot & 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

virtualvoidOnCancelled(constError&error,constchar*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

virtualvoidOnChildAdded(constDataSnapshot&snapshot,constchar*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

virtualvoidOnChildChanged(constDataSnapshot&snapshot,constchar*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

virtualvoidOnChildMoved(constDataSnapshot&snapshot,constchar*previous_sibling_key)=0

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

SeeDatabaseReference::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

virtualvoidOnChildRemoved(constDataSnapshot&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()

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-23 UTC.