firebase::firestore::SnapshotMetadata

#include <snapshot_metadata.h>

Metadata about a snapshot, describing the state of the snapshot.

Summary

Constructors and Destructors

SnapshotMetadata()
Constructs a SnapshotMetadata that has all of its boolean members set to false.
SnapshotMetadata(bool has_pending_writes, bool is_from_cache)
Constructs a SnapshotMetadata by providing boolean parameters that describe the state of the snapshot.
SnapshotMetadata(const SnapshotMetadata & other)
Copy constructor.
SnapshotMetadata(SnapshotMetadata && other)
Move constructor, equivalent to copying.

Public functions

ToString() const
std::string
Returns a string representation of this SnapshotMetadata for logging/debugging purposes.
has_pending_writes() const
bool
Returns whether the snapshot contains the result of local writes.
is_from_cache() const
bool
Returns whether the snapshot was created from cached data.
operator=(const SnapshotMetadata & other)=default
Copy assignment operator.
operator=(SnapshotMetadata && other)=default
Move assignment operator, equivalent to copying.

Friend classes

operator<<
friend std::ostream &
Outputs the string representation of this SnapshotMetadata to the given stream.

Public functions

SnapshotMetadata

 SnapshotMetadata()=default

Constructs a SnapshotMetadata that has all of its boolean members set to false.

SnapshotMetadata

 SnapshotMetadata(
  bool has_pending_writes,
  bool is_from_cache
)

Constructs a SnapshotMetadata by providing boolean parameters that describe the state of the snapshot.

Details
Parameters
has_pending_writes
Whether there is any pending write on the snapshot.
is_from_cache
Whether the snapshot is from cache instead of backend.

SnapshotMetadata

 SnapshotMetadata(
  const SnapshotMetadata & other
)=default

Copy constructor.

This performs a deep copy, creating an independent instance.

Details
Parameters
other
SnapshotMetadata to copy from.

SnapshotMetadata

 SnapshotMetadata(
  SnapshotMetadata && other
)=default

Move constructor, equivalent to copying.

After being moved from, SnapshotMetadata is in a valid but unspecified state.

Details
Parameters
other
SnapshotMetadata to move data from.

ToString

std::string ToString() const 

Returns a string representation of this SnapshotMetadata for logging/debugging purposes.

has_pending_writes

bool has_pending_writes() const 

Returns whether the snapshot contains the result of local writes.

Details
Returns
true if the snapshot contains the result of local writes (for example, Set() or Update() calls) that have not yet been committed to the backend. If your listener has opted into metadata updates (via MetadataChanges::kInclude) you will receive another snapshot with has_pending_writes() equal to false once the writes have been committed to the backend.

is_from_cache

bool is_from_cache() const 

Returns whether the snapshot was created from cached data.

Details
Returns
true if the snapshot was created from cached data rather than guaranteed up-to-date server data. If your listener has opted into metadata updates (via MetadataChanges::kInclude) you will receive another snapshot with is_from_cache() equal to false once the client has received up-to-date data from the backend.

operator=

SnapshotMetadata & operator=(
  const SnapshotMetadata & other
)=default

Copy assignment operator.

This performs a deep copy, creating an independent instance.

Details
Parameters
other
SnapshotMetadata to copy from.
Returns
Reference to the destination SnapshotMetadata.

operator=

SnapshotMetadata & operator=(
  SnapshotMetadata && other
)=default

Move assignment operator, equivalent to copying.

After being moved from, SnapshotMetadata is in a valid but unspecified state.

Details
Parameters
other
SnapshotMetadata to move data from.
Returns
Reference to the destination SnapshotMetadata.

Friend classes

operator<<

friend std::ostream & operator<<(std::ostream &out, const SnapshotMetadata &metadata)

Outputs the string representation of this SnapshotMetadata to the given stream.

See also:ToString() for comments on the representation format.