1#ifndef DITTO_MUTABLE_DOCUMENT_PATH_H
2#define DITTO_MUTABLE_DOCUMENT_PATH_H
4#include "AbstractDocumentPath.hpp"
5#include "AttachmentToken.hpp"
8#include "UpdateResult.hpp"
12using CDocument_t =
struct CDocument;
34class DITTO_DEPRECATED_BECAUSE(
35 "Use DQL (Ditto Query Language) instead. For more information see: "
36 "https://ditto.com/link/legacy-to-dql-guide") MutableDocumentPath
38 DITTO_DISABLE_DEPRECATED_WARNINGS(
"The legacy query API is deprecated")
40 friend class MutableDocument;
41 friend class MutableCounter;
42 friend class MutableRegister;
46 std::vector<std::unique_ptr<UpdateResult>> &results;
65 MutableDocumentPath(CDocument_t
const *document,
DocumentId id,
66 std::string initial_path,
67 std::vector<std::unique_ptr<UpdateResult>> &results);
81 MutableDocumentPath(
const MutableDocumentPath *document_path,
96 MutableDocumentPath(
const MutableDocumentPath *document_path,
99 explicit MutableDocumentPath(
const MutableDocumentPath *doc_path);
101 template <
typename T>
103 get_mut_object_or_default(json_callback json_cb,
104 PathAccessorType path_type)
const;
107 MutableDocumentPath operator[](std::string key);
108 MutableDocumentPath operator[](std::size_t index);
155 void set(nlohmann::json value,
bool is_default =
false)
const;
177 void increment(
double amount)
const;
179 DITTO_REENABLE_WARNINGS
AbstractDocumentPath(CDocument_t const *document, DocumentId id, std::string initial_path)
Constructs a new initial AbstractDocumentPath for a document.
Definition MutableCounter.hpp:18
void set(nlohmann::json value, bool is_default=false) const
Set a value at the document's key defined by the preceding subscripting.
void remove() const
Remove a value at the document's key defined by the preceding subscripting.
std::shared_ptr< MutableCounter > get_counter() const
Returns the value at the previously specified key in the document as a std::shared_ptr<MutableCounter...
std::shared_ptr< MutableRegister > get_register() const
Returns the value at the previously specified key in the document as a std::shared_ptr<MutableRegiste...
std::shared_ptr< AttachmentToken > get_attachment_token() const
Returns the value at the previously specified key in the document as a std::shared_ptr<AttachmentToke...
Definition MutableRegister.hpp:18
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
An identifier for a Document.
Definition DocumentId.hpp:23