29 #ifndef INCLUDE_OLA_WEB_JSONPATCHPARSER_H_
30 #define INCLUDE_OLA_WEB_JSONPATCHPARSER_H_
36 #include <ola/web/OptionalItem.h>
56 m_patch_set(patch_set),
64 void String(
const std::string &value);
65 void Number(uint32_t value);
66 void Number(int32_t value);
67 void Number(uint64_t value);
68 void Number(int64_t value);
71 void Bool(
bool value);
79 void SetError(
const std::string &error);
97 static bool Parse(
const std::string &input,
114 unsigned int m_parser_depth;
121 std::auto_ptr<JsonValue> m_value;
123 template <
typename T>
124 void HandleNumber(
const T &value);
126 void HandlePatchString(
const std::string &value);
129 static const char kFromKey[];
130 static const char kMissingFrom[];
131 static const char kMissingPath[];
132 static const char kMissingValue[];
133 static const char kOpKey[];
134 static const char kPatchElementError[];
135 static const char kPatchListError[];
136 static const char kPathKey[];
137 static const char kValueKey[];
138 static const char kAddOp[];
139 static const char kRemoveOp[];
140 static const char kReplaceOp[];
141 static const char kMoveOp[];
142 static const char kCopyOp[];
143 static const char kTestOp[];
150 #endif // INCLUDE_OLA_WEB_JSONPATCHPARSER_H_
void Bool(bool value)
Called when a bool is encounted.
Definition: JsonPatchParser.cpp:113
Represents a JSON double value broken down as separate components.
Definition: Json.h:661
A JsonParserInterface implementation that builds a parse tree.
The interface used to handle tokens during JSON parsing.
Definition: JsonLexer.h:71
The class used to parse JSON data.
static bool Parse(const std::string &input, JsonPatchSet *patch_set, std::string *error)
Build a JsonPatchSet from a JSON document.
Definition: JsonPatchParser.cpp:343
void End()
Called when parsing completes.
Definition: JsonPatchParser.cpp:66
void CloseObject()
Called when an object completes.
Definition: JsonPatchParser.cpp:224
void Begin()
Called when parsing begins.
Definition: JsonPatchParser.cpp:58
void OpenArray()
Called when an array starts.
Definition: JsonPatchParser.cpp:151
Implementation of JSON Patch (RFC 6902).
void ObjectKey(const std::string &key)
Called when a new key is encounted.
Definition: JsonPatchParser.cpp:216
A JsonParserInterface implementation that builds a tree of JsonValues.
Definition: JsonParser.h:57
std::string GetError() const
Check if parsing was successful.
Definition: JsonPatchParser.cpp:253
void Number(uint32_t value)
Called when a uint32_t is encounted.
Definition: JsonPatchParser.cpp:89
void SetError(const std::string &error)
Can be called at any time to indicate an error with the input data.
Definition: JsonPatchParser.cpp:247
void CloseArray()
Called when an array completes.
Definition: JsonPatchParser.cpp:171
An ordered collection of JsonPatchOps.
Definition: JsonPatch.h:205
void String(const std::string &value)
Called when a string is encounted.
Definition: JsonPatchParser.cpp:72
void Null()
Called when a null token is encounted.
Definition: JsonPatchParser.cpp:132
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
bool IsValid() const
Check if this patch document was valid.
Definition: JsonPatchParser.cpp:257
Parse a JSON Patch document (RFC 6902).
Definition: JsonPatchParser.h:52
void OpenObject()
Called when an object starts.
Definition: JsonPatchParser.cpp:192