firebase::database::MutableData

#include <mutable_data.h>

Instances of this class encapsulate the data and priority at a location.

Summary

It is used in transactions, and it is intended to be inspected and then updated to the desired data at that location.

Constructors and Destructors

~MutableData()
Destructor.

Public functions

Child(const char *path)
Used to obtain a MutableData instance that encapsulates the data and priority at the given relative path.
Child(const std::string & path)
Used to obtain a MutableData instance that encapsulates the data and priority at the given relative path.
GetChildren()
FIREBASE_DEPRECATED std::vector< MutableData >
Deprecated. Renamed to children().
Get all the immediate children of this location.
GetChildrenCount()
FIREBASE_DEPRECATED size_t
Deprecated. Renamed to children_count().
Get the number of children of this location.
GetKey() const
FIREBASE_DEPRECATED const char *
Deprecated. Renamed to key().
Get the key name of the source location of this data.
GetKeyString() const
FIREBASE_DEPRECATED std::string
Deprecated. Renamed to key_string().
Get the key name of the source location of this data.
GetPriority()
FIREBASE_DEPRECATED Variant
Deprecated. Renamed to priority().
Get the priority of the data contained at this snapshot.
GetValue() const
FIREBASE_DEPRECATED Variant
Deprecated. Renamed to value().
Get the value of the data contained at this location.
HasChild(const char *path) const
bool
Does this MutableData have data at a particular location?
HasChild(const std::string & path)
bool
Does this MutableData have data at a particular location?
SetPriority(Variant priority)
FIREBASE_DEPRECATED void
Deprecated. Renamed to set_priority().
Sets the priority of this field, which controls its sort order relative to its siblings.
SetValue(Variant value)
FIREBASE_DEPRECATED void
Deprecated. Renamed to set_value().
Sets the data at this location to the given value.
children()
std::vector< MutableData >
Get all the immediate children of this location.
children_count()
size_t
Get the number of children of this location.
key() const
const char *
Get the key name of the source location of this data.
key_string() const
std::string
Get the key name of the source location of this data.
priority()
Get the priority of the data contained at this snapshot.
set_priority(Variant priority)
void
Sets the priority of this field, which controls its sort order relative to its siblings.
set_value(Variant value)
void
Sets the data at this location to the given value.
value() const
Get the value of the data contained at this location.

Public functions

Child

MutableData Child(
  const char *path
)

Used to obtain a MutableData instance that encapsulates the data and priority at the given relative path.

Details
Parameters
path
Path relative to this snapshot's location. The pointer only needs to be valid during this call.
Returns
MutableData for the Child relative to this location. The memory will be freed when the Transaction is finished.

Child

MutableData Child(
  const std::string & path
)

Used to obtain a MutableData instance that encapsulates the data and priority at the given relative path.

Details
Parameters
path
Path relative to this snapshot's location.
Returns
MutableData for the Child relative to this location. The memory will be freed when the Transaction is finished.

GetChildren

FIREBASE_DEPRECATED std::vector< MutableData > GetChildren()

Get all the immediate children of this location.

Deprecated. Renamed to children().

Details
Returns
The immediate children of this location.

GetChildrenCount

FIREBASE_DEPRECATED size_t GetChildrenCount()

Get the number of children of this location.

Deprecated. Renamed to children_count().

Details
Returns
The number of immediate children of this location.

GetKey

FIREBASE_DEPRECATED const char * GetKey() const 

Get the key name of the source location of this data.

Note:The returned pointer is only guaranteed to be valid during the transaction. Deprecated. Renamed to key().

Details
Returns
Key name of the source location of this data.

GetKeyString

FIREBASE_DEPRECATED std::string GetKeyString() const 

Get the key name of the source location of this data.

Deprecated. Renamed to key_string().

Details
Returns
Key name of the source location of this data.

GetPriority

FIREBASE_DEPRECATED Variant GetPriority()

Get the priority of the data contained at this snapshot.

Deprecated. Renamed to priority().

Details
Returns
The value of this location's Priority relative to its siblings.

GetValue

FIREBASE_DEPRECATED Variant GetValue() const 

Get the value of the data contained at this location.

Deprecated. Renamed to value().

Details
Returns
The value of the data contained at this location.

HasChild

bool HasChild(
  const char *path
) const 

Does this MutableData have data at a particular location?

Details
Parameters
path
Path relative to this data's location. The pointer only needs to be valid during this call.
Returns
True if there is data at the specified location, false if not.

HasChild

bool HasChild(
  const std::string & path
)

Does this MutableData have data at a particular location?

Details
Parameters
path
Path relative to this data's location.
Returns
True if there is data at the specified location, false if not.

SetPriority

FIREBASE_DEPRECATED void SetPriority(
  Variant priority
)

Sets the priority of this field, which controls its sort order relative to its siblings.

See also:firebase::database::DatabaseReference::SetPriority() for information on how Priority affects the ordering of a node's children. Deprecated. Renamed to set_priority().

Details
Parameters
priority
Sort priority for this child relative to its siblings. The Variant types accepted are Null, Int64, Double, and String. Other types will return kErrorInvalidVariantType.

SetValue

FIREBASE_DEPRECATED void SetValue(
  Variant value
)

Sets the data at this location to the given value.

Deprecated. Renamed to set_value().

Details
Parameters
value
The value to set this location to. The Variant's type corresponds to the types accepted by the database JSON: Null: Deletes this location from the database. Int64: Inserts an integer value into this location. Double: Inserts a floating point value into this location. String: Inserts a string into this location. (Accepts both Mutable and Static strings) Vector: Inserts a JSON array into this location. The elements can be any Variant type, including Vector and Map. Map: Inserts a JSON associative array into this location. The keys must be of type String (or Int64/Double which are converted to String). The values can be any Variant type, including Vector and Map.

children

std::vector< MutableData > children()

Get all the immediate children of this location.

Details
Returns
The immediate children of this location.

children_count

size_t children_count()

Get the number of children of this location.

Details
Returns
The number of immediate children of this location.

key

const char * key() const 

Get the key name of the source location of this data.

Note:The returned pointer is only guaranteed to be valid during the transaction.

Details
Returns
Key name of the source location of this data.

key_string

std::string key_string() const 

Get the key name of the source location of this data.

Details
Returns
Key name of the source location of this data.

priority

Variant priority()

Get the priority of the data contained at this snapshot.

Details
Returns
The value of this location's Priority relative to its siblings.

set_priority

void set_priority(
  Variant priority
)

Sets the priority of this field, which controls its sort order relative to its siblings.

See also:firebase::database::DatabaseReference::SetPriority() for information on how Priority affects the ordering of a node's children.

Details
Parameters
priority
Sort priority for this child relative to its siblings. The Variant types accepted are Null, Int64, Double, and String. Other types will return kErrorInvalidVariantType.

set_value

void set_value(
  Variant value
)

Sets the data at this location to the given value.

Details
Parameters
value
The value to set this location to. The Variant's type corresponds to the types accepted by the database JSON: Null: Deletes this location from the database. Int64: Inserts an integer value into this location. Double: Inserts a floating point value into this location. String: Inserts a string into this location. (Accepts both Mutable and Static strings) Vector: Inserts a JSON array into this location. The elements can be any Variant type, including Vector and Map. Map: Inserts a JSON associative array into this location. The keys must be of type String (or Int64/Double which are converted to String). The values can be any Variant type, including Vector and Map.

value

Variant value() const 

Get the value of the data contained at this location.

Details
Returns
The value of the data contained at this location.

~MutableData

 ~MutableData()

Destructor.

Send feedback about...