firebase::firestore::QuerySnapshot

#include <query_snapshot.h>

A QuerySnapshot contains zero or more DocumentSnapshot objects.

Summary

QuerySnapshot can be iterated using a range-based for loop, and its size can be inspected with empty() and size().

Constructors and Destructors

QuerySnapshot()
Creates an invalid QuerySnapshot that has to be reassigned before it can be used.
QuerySnapshot(const QuerySnapshot & other)
Copy constructor.
QuerySnapshot(QuerySnapshot && other)
Move constructor.
~QuerySnapshot()

Public functions

DocumentChanges(MetadataChanges metadata_changes) const
virtual std::vector< DocumentChange >
The list of documents that changed since the last snapshot.
documents() const
virtual std::vector< DocumentSnapshot >
The list of documents in this QuerySnapshot in order of the query.
empty() const
bool
Checks the emptiness of the QuerySnapshot.
is_valid() const
bool
Returns true if this QuerySnapshot is valid, false if it is not valid.
metadata() const
Metadata about this snapshot, concerning its source and if it has local modifications.
operator=(const QuerySnapshot & other)
Copy assignment operator.
operator=(QuerySnapshot && other)
Move assignment operator.
query() const
virtual Query
The query from which you got this QuerySnapshot.
size() const
virtual std::size_t
Checks the size of the QuerySnapshot.

Public functions

DocumentChanges

virtualstd::vector<DocumentChange>DocumentChanges(MetadataChangesmetadata_changes)const

The list of documents that changed since the last snapshot.

If it's the first snapshot, all documents will be in the list as added changes. Documents with changes only to their metadata will not be included.

Details
Parameters
metadata_changes
Indicates whether metadata-only changes (that is, only QuerySnapshot::metadata() changed) should be included.
Returns
The list of document changes since the last snapshot.

QuerySnapshot

QuerySnapshot()

Creates an invalid QuerySnapshot that has to be reassigned before it can be used.

Calling any member function on an invalid QuerySnapshot will be a no-op. If the function returns a value, it will return a zero, empty, or invalid value, depending on the type of the value.

QuerySnapshot

QuerySnapshot(constQuerySnapshot&other)

Copy constructor.

QuerySnapshot is immutable and can be efficiently copied (no deep copy is performed).

Details
Parameters
other
QuerySnapshot to copy from.

QuerySnapshot

QuerySnapshot(QuerySnapshot&&other)

Move constructor.

Moving is more efficient than copying for a QuerySnapshot. After being moved from, a QuerySnapshot is equivalent to its default-constructed state.

Details
Parameters
other
QuerySnapshot to move data from.

documents

virtualstd::vector<DocumentSnapshot>documents()const

The list of documents in this QuerySnapshot in order of the query.

Details
Returns
The list of documents.

empty

boolempty()const

Checks the emptiness of the QuerySnapshot.

Details
Returns
True if there are no documents in the QuerySnapshot.

is_valid

boolis_valid()const

Returns true if this QuerySnapshot is valid, false if it is not valid.

An invalid QuerySnapshot could be the result of:

Details
Returns
true if this QuerySnapshot is valid, false if this QuerySnapshot is invalid.

metadata

virtualSnapshotMetadatametadata()const

Metadata about this snapshot, concerning its source and if it has local modifications.

Details
Returns
The metadata for this document snapshot.

operator=

QuerySnapshot&operator=(constQuerySnapshot&other)

Copy assignment operator.

QuerySnapshot is immutable and can be efficiently copied (no deep copy is performed).

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

operator=

QuerySnapshot&operator=(QuerySnapshot&&other)

Move assignment operator.

Moving is more efficient than copying for a QuerySnapshot. After being moved from, a QuerySnapshot is equivalent to its default-constructed state.

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

query

virtualQueryquery()const

The query from which you got this QuerySnapshot.

size

virtualstd::size_tsize()const

Checks the size of the QuerySnapshot.

Details
Returns
The number of documents in the QuerySnapshot.

~QuerySnapshot

virtual~QuerySnapshot()