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
|
virtual SnapshotMetadata
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
virtual std::vector< DocumentChange > DocumentChanges( MetadataChanges metadata_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 |
|
||
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( const QuerySnapshot & other )
Copy constructor.
QuerySnapshot
is immutable and can be efficiently copied (no deep copy is performed).
Details | |||
---|---|---|---|
Parameters |
|
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 |
|
documents
virtual std::vector< DocumentSnapshot > documents() const
The list of documents in this QuerySnapshot in order of the query.
Details | |
---|---|
Returns |
The list of documents.
|
empty
bool empty() const
Checks the emptiness of the QuerySnapshot.
Details | |
---|---|
Returns |
True if there are no documents in the QuerySnapshot.
|
is_valid
bool is_valid() const
Returns true if this QuerySnapshot
is valid, false if it is not valid.
An invalid QuerySnapshot
could be the result of:
- Creating a
QuerySnapshot
using the default constructor. - Moving from the
QuerySnapshot
. - Deleting your Firestore instance, which will invalidate all the
QuerySnapshot
instances associated with it.
Details | |
---|---|
Returns |
true if this
QuerySnapshot is valid, false if this QuerySnapshot is invalid. |
metadata
virtual SnapshotMetadata metadata() 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=( const QuerySnapshot & other )
Copy assignment operator.
QuerySnapshot
is immutable and can be efficiently copied (no deep copy is performed).
Details | |||
---|---|---|---|
Parameters |
|
||
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 |
|
||
Returns |
Reference to the destination
QuerySnapshot . |
size
virtual std::size_t size() const
Checks the size of the QuerySnapshot.
Details | |
---|---|
Returns |
The number of documents in the QuerySnapshot.
|
~QuerySnapshot
virtual ~QuerySnapshot()