Ditto 1.1.7
DocumentIdPath.hpp
1#ifndef _DITTO_DOCUMENT_ID_PATH_
2#define _DITTO_DOCUMENT_ID_PATH_
3
4#include "document_path_component.hpp"
5
6#include "json.hpp"
7
8#include <string>
9#include <vector>
10
11namespace ditto {
12
23 friend struct DocumentId;
24
25private:
26 nlohmann::json value;
27 std::vector<DocumentPathComponent> path_components;
28
36 DocumentIdPath(nlohmann::json value, DocumentPathComponent initial_path);
37
47 DocumentIdPath(const DocumentIdPath *document_id_path, std::string key);
48
57 DocumentIdPath(const DocumentIdPath *document_id_path, std::size_t index);
58
59public:
60 DocumentIdPath operator[](std::string key);
61 DocumentIdPath operator[](std::size_t index);
62
72 std::string get_string_value() const;
73
82 int get_int_value() const;
83
93 double get_double_value() const;
94
103 float get_float_value() const;
104
114 bool get_bool_value() const;
115
125 nlohmann::json get_json() const;
126};
127} // namespace ditto
128
129#endif
Provides an interface to specify a path to a key in a document ID that you can then call a function o...
Definition: DocumentIdPath.hpp:22
double get_double_value() const
Returns the value at the previously specified key in the document ID as a double. If the key was inva...
Definition: DocumentIdPath.cpp:56
nlohmann::json get_json() const
Returns the value at the previously specified key in the document ID as a nlohmann::json object....
Definition: DocumentIdPath.cpp:80
float get_float_value() const
Returns the value at the previously specified key in the document ID as a float. If the key was inval...
Definition: DocumentIdPath.cpp:64
int get_int_value() const
Returns the value at the previously specified key in the document ID as an int. If the key was invali...
Definition: DocumentIdPath.cpp:48
bool get_bool_value() const
Returns the value at the previously specified key in the document ID as a bool. If the key was invali...
Definition: DocumentIdPath.cpp:72
std::string get_string_value() const
Returns the value at the previously specified key in the document ID as a std::string....
Definition: DocumentIdPath.cpp:40
basic_json<> json
default JSON class
Definition: json.hpp:2933
An identifier for a Document.
Definition: DocumentId.hpp:21