#include <document_change.h>
A DocumentChange represents a change to the documents matching a query.
DocumentChange contains the document affected and the type of change that occurred (added, modified, or removed).
Constructors and Destructors |
|
|---|---|
DocumentChange()
Creates an invalid DocumentChange that has to be reassigned before it can be used.
|
|
DocumentChange(const DocumentChange & other)
Copy constructor.
|
|
DocumentChange(DocumentChange && other)
Move constructor.
|
|
~DocumentChange()
|
Public types |
|
|---|---|
Type{
|
enum An enumeration of snapshot diff types. |
constexpr std::size_t
Public functions |
|
|---|---|
document() const
|
virtual DocumentSnapshot
The document affected by this change.
|
is_valid() const
|
bool
Returns true if this
DocumentChange is valid, false if it is not valid. |
new_index() const
|
virtual std::size_t
The index of the changed document in the result set immediately after this DocumentChange (that is, supposing that all prior DocumentChange objects and the current DocumentChange object have been applied).
|
old_index() const
|
virtual std::size_t
The index of the changed document in the result set immediately prior to this DocumentChange (that is, supposing that all prior DocumentChange objects have been applied).
|
operator=(const DocumentChange & other)
|
Copy assignment operator.
|
operator=(DocumentChange && other)
|
Move assignment operator.
|
type() const
|
virtual Type
Returns the type of change that occurred (added, modified, or removed).
|
Type
An enumeration of snapshot diff types.
constexpr std::size_t npos = static_cast<std::size_t>(-1)
The sentinel index used as a return value to indicate no matches.
DocumentChange()
Creates an invalid DocumentChange that has to be reassigned before it can be used.
Calling any member function on an invalid DocumentChange 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.
DocumentChange( const DocumentChange & other )
Copy constructor.
DocumentChange is immutable and can be efficiently copied (no deep copy is performed).
| Details | |||
|---|---|---|---|
| Parameters |
|
DocumentChange( DocumentChange && other )
Move constructor.
Moving is more efficient than copying for a DocumentChange. After being moved from, a DocumentChange is equivalent to its default-constructed state.
| Details | |||
|---|---|---|---|
| Parameters |
|
virtual DocumentSnapshot document() const
The document affected by this change.
Returns the newly added or modified document if this DocumentChange is for an updated document. Returns the deleted document if this document change represents a removal.
bool is_valid() const
Returns true if this DocumentChange is valid, false if it is not valid.
An invalid DocumentChange could be the result of:
DocumentChange using the default constructor.DocumentChange.DocumentChange instances associated with it.| Details | |
|---|---|
| Returns |
true if this
DocumentChange is valid, false if this DocumentChange is invalid. |
virtual std::size_t new_index() const
The index of the changed document in the result set immediately after this DocumentChange (that is, supposing that all prior DocumentChange objects and the current DocumentChange object have been applied).
Returns DocumentChange::npos for 'removed' events.
virtual std::size_t old_index() const
The index of the changed document in the result set immediately prior to this DocumentChange (that is, supposing that all prior DocumentChange objects have been applied).
Returns DocumentChange::npos for 'added' events.
DocumentChange & operator=( const DocumentChange & other )
Copy assignment operator.
DocumentChange is immutable and can be efficiently copied (no deep copy is performed).
| Details | |||
|---|---|---|---|
| Parameters |
|
||
| Returns |
Reference to the destination
DocumentChange. |
DocumentChange & operator=( DocumentChange && other )
Move assignment operator.
Moving is more efficient than copying for a DocumentChange. After being moved from, a DocumentChange is equivalent to its default-constructed state.
| Details | |||
|---|---|---|---|
| Parameters |
|
||
| Returns |
Reference to the destination
DocumentChange. |
virtual Type type() const
Returns the type of change that occurred (added, modified, or removed).
virtual ~DocumentChange()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.