cesium-native 0.43.0
Loading...
Searching...
No Matches
ArrayJsonHandler.h
1#pragma once
2
3#include "CesiumUtility/Assert.h"
4#include "DoubleJsonHandler.h"
5#include "IntegerJsonHandler.h"
6#include "JsonHandler.h"
7#include "Library.h"
8#include "StringJsonHandler.h"
9
10#include <functional>
11#include <memory>
12#include <vector>
13
21template <typename T, typename THandler>
22class CESIUMJSONREADER_API ArrayJsonHandler : public JsonHandler {
23public:
25 using ValueType = std::vector<T>;
26
33 template <typename... Ts>
34 ArrayJsonHandler(Ts&&... args) noexcept
35 : JsonHandler(),
36 _handlerFactory(
37 std::bind(handlerFactory<Ts...>, std::forward<Ts>(args)...)),
38 _objectHandler() {}
39
44 void reset(IJsonHandler* pParent, std::vector<T>* pArray) {
45 JsonHandler::reset(pParent);
46 this->_pArray = pArray;
47 this->_arrayIsOpen = false;
48 this->_objectHandler.reset(this->_handlerFactory());
49 }
50
51 virtual IJsonHandler* readNull() override {
52 return this->invalid("A null")->readNull();
53 }
54
55 virtual IJsonHandler* readBool(bool b) override {
56 return this->invalid("A boolean")->readBool(b);
57 }
58
59 virtual IJsonHandler* readInt32(int32_t i) override {
60 return this->invalid("An integer")->readInt32(i);
61 }
62
63 virtual IJsonHandler* readUint32(uint32_t i) override {
64 return this->invalid("An integer")->readUint32(i);
65 }
66
67 virtual IJsonHandler* readInt64(int64_t i) override {
68 return this->invalid("An integer")->readInt64(i);
69 }
70
71 virtual IJsonHandler* readUint64(uint64_t i) override {
72 return this->invalid("An integer")->readUint64(i);
73 }
74
75 virtual IJsonHandler* readDouble(double d) override {
76 return this->invalid("A double (floating-point)")->readDouble(d);
77 }
78
79 virtual IJsonHandler* readString(const std::string_view& str) override {
80 return this->invalid("A string")->readString(str);
81 }
82
83 virtual IJsonHandler* readObjectStart() override {
84 if (!this->_arrayIsOpen) {
85 return this->invalid("An object")->readObjectStart();
86 }
87
88 CESIUM_ASSERT(this->_pArray);
89 T& o = this->_pArray->emplace_back();
90 this->_objectHandler->reset(this, &o);
91 return this->_objectHandler->readObjectStart();
92 }
93
94 virtual IJsonHandler*
95 readObjectKey(const std::string_view& /*str*/) noexcept override {
96 return nullptr;
97 }
98
99 virtual IJsonHandler* readObjectEnd() noexcept override { return nullptr; }
100
101 virtual IJsonHandler* readArrayStart() override {
102 if (this->_arrayIsOpen) {
103 return this->invalid("An array")->readArrayStart();
104 }
105
106 this->_arrayIsOpen = true;
107 this->_pArray->clear();
108 return this;
109 }
110
111 virtual IJsonHandler* readArrayEnd() override { return this->parent(); }
112
113 virtual void reportWarning(
114 const std::string& warning,
115 std::vector<std::string>&& context =
116 std::vector<std::string>()) override {
117 context.push_back(
118 std::string("[") + std::to_string(this->_pArray->size()) + "]");
119 this->parent()->reportWarning(warning, std::move(context));
120 }
121
122private:
123 IJsonHandler* invalid(const std::string& type) {
124 if (this->_arrayIsOpen) {
125 this->reportWarning(
126 type + " value is not allowed in the object array and has been "
127 "replaced with a default value.");
128 this->_pArray->emplace_back();
129 return this->ignoreAndContinue();
130 } else {
131 this->reportWarning(type + " is not allowed and has been ignored.");
132 return this->ignoreAndReturnToParent();
133 }
134 }
135
136 template <typename... Ts> static THandler* handlerFactory(Ts&&... args) {
137 return new THandler(std::forward<Ts>(args)...);
138 }
139
140 std::vector<T>* _pArray = nullptr;
141 bool _arrayIsOpen = false;
142
143 std::function<THandler*()> _handlerFactory;
144 std::unique_ptr<THandler> _objectHandler;
145};
146
153template <>
154class CESIUMJSONREADER_API ArrayJsonHandler<double, DoubleJsonHandler>
155 : public JsonHandler {
156public:
158 using ValueType = std::vector<double>;
159
160 ArrayJsonHandler() noexcept : JsonHandler() {}
161
166 void reset(IJsonHandler* pParent, std::vector<double>* pArray) {
167 JsonHandler::reset(pParent);
168 this->_pArray = pArray;
169 this->_arrayIsOpen = false;
170 }
171
172 virtual IJsonHandler* readNull() override {
173 return this->invalid("A null")->readNull();
174 }
175
176 virtual IJsonHandler* readBool(bool b) override {
177 return this->invalid("A bool")->readBool(b);
178 }
179
180 virtual IJsonHandler* readInt32(int32_t i) override {
181 if (!this->_arrayIsOpen) {
182 return this->invalid("An integer")->readInt32(i);
183 }
184
185 CESIUM_ASSERT(this->_pArray);
186 this->_pArray->emplace_back(static_cast<double>(i));
187 return this;
188 }
189
190 virtual IJsonHandler* readUint32(uint32_t i) override {
191 if (!this->_arrayIsOpen) {
192 return this->invalid("An integer")->readUint32(i);
193 }
194
195 CESIUM_ASSERT(this->_pArray);
196 this->_pArray->emplace_back(static_cast<double>(i));
197 return this;
198 }
199
200 virtual IJsonHandler* readInt64(int64_t i) override {
201 if (!this->_arrayIsOpen) {
202 return this->invalid("An integer")->readInt64(i);
203 }
204
205 CESIUM_ASSERT(this->_pArray);
206 this->_pArray->emplace_back(static_cast<double>(i));
207 return this;
208 }
209
210 virtual IJsonHandler* readUint64(uint64_t i) override {
211 if (!this->_arrayIsOpen) {
212 return this->invalid("An integer")->readUint64(i);
213 }
214
215 CESIUM_ASSERT(this->_pArray);
216 this->_pArray->emplace_back(static_cast<double>(i));
217 return this;
218 }
219
220 virtual IJsonHandler* readDouble(double d) override {
221 if (!this->_arrayIsOpen) {
222 return this->invalid("An integer")->readDouble(d);
223 }
224
225 CESIUM_ASSERT(this->_pArray);
226 this->_pArray->emplace_back(d);
227 return this;
228 }
229
230 virtual IJsonHandler* readString(const std::string_view& str) override {
231 return this->invalid("A string")->readString(str);
232 }
233
234 virtual IJsonHandler* readObjectStart() override {
235 return this->invalid("An object")->readObjectStart();
236 }
237
238 virtual IJsonHandler* readArrayStart() override {
239 if (this->_arrayIsOpen) {
240 return this->invalid("An array")->readArrayStart();
241 }
242
243 this->_arrayIsOpen = true;
244 this->_pArray->clear();
245 return this;
246 }
247
248 virtual IJsonHandler* readArrayEnd() override { return this->parent(); }
249
250 virtual void reportWarning(
251 const std::string& warning,
252 std::vector<std::string>&& context =
253 std::vector<std::string>()) override {
254 context.push_back(
255 std::string("[") + std::to_string(this->_pArray->size()) + "]");
256 this->parent()->reportWarning(warning, std::move(context));
257 }
258
259private:
260 IJsonHandler* invalid(const std::string& type) {
261 if (this->_arrayIsOpen) {
262 this->reportWarning(
263 type + " value is not allowed in the double array and has been "
264 "replaced with a default value.");
265 this->_pArray->emplace_back();
266 return this->ignoreAndContinue();
267 } else {
268 this->reportWarning(type + " is not allowed and has been ignored.");
269 return this->ignoreAndReturnToParent();
270 }
271 }
272
273 std::vector<double>* _pArray = nullptr;
274 bool _arrayIsOpen = false;
275};
276
281template <typename T>
282class CESIUMJSONREADER_API ArrayJsonHandler<T, IntegerJsonHandler<T>>
283 : public JsonHandler {
284public:
286 using ValueType = std::vector<T>;
287
288 ArrayJsonHandler() noexcept : JsonHandler() {}
289
294 void reset(IJsonHandler* pParent, std::vector<T>* pArray) {
295 JsonHandler::reset(pParent);
296 this->_pArray = pArray;
297 this->_arrayIsOpen = false;
298 }
299
300 virtual IJsonHandler* readNull() override {
301 return this->invalid("A null")->readNull();
302 }
303
304 virtual IJsonHandler* readBool(bool b) override {
305 return this->invalid("A bool")->readBool(b);
306 }
307
308 virtual IJsonHandler* readInt32(int32_t i) override {
309 if (!this->_arrayIsOpen) {
310 return this->invalid("An integer")->readInt32(i);
311 }
312
313 CESIUM_ASSERT(this->_pArray);
314 this->_pArray->emplace_back(static_cast<T>(i));
315 return this;
316 }
317
318 virtual IJsonHandler* readUint32(uint32_t i) override {
319 if (!this->_arrayIsOpen) {
320 return this->invalid("An integer")->readUint32(i);
321 }
322
323 CESIUM_ASSERT(this->_pArray);
324 this->_pArray->emplace_back(static_cast<T>(i));
325 return this;
326 }
327
328 virtual IJsonHandler* readInt64(int64_t i) override {
329 if (!this->_arrayIsOpen) {
330 return this->invalid("An integer")->readInt64(i);
331 }
332
333 CESIUM_ASSERT(this->_pArray);
334 this->_pArray->emplace_back(static_cast<T>(i));
335 return this;
336 }
337
338 virtual IJsonHandler* readUint64(uint64_t i) override {
339 if (!this->_arrayIsOpen) {
340 return this->invalid("An integer")->readUint64(i);
341 }
342
343 CESIUM_ASSERT(this->_pArray);
344 this->_pArray->emplace_back(static_cast<T>(i));
345 return this;
346 }
347
348 virtual IJsonHandler* readDouble(double d) override {
349 return this->invalid("A double (floating-point)")->readDouble(d);
350 }
351
352 virtual IJsonHandler* readString(const std::string_view& str) override {
353 return this->invalid("A string")->readString(str);
354 }
355
356 virtual IJsonHandler* readObjectStart() override {
357 return this->invalid("An object")->readObjectStart();
358 }
359
360 virtual IJsonHandler* readArrayStart() override {
361 if (this->_arrayIsOpen) {
362 return this->invalid("An array")->readArrayStart();
363 }
364
365 this->_arrayIsOpen = true;
366 this->_pArray->clear();
367 return this;
368 }
369
370 virtual IJsonHandler* readArrayEnd() override { return this->parent(); }
371
372 virtual void reportWarning(
373 const std::string& warning,
374 std::vector<std::string>&& context =
375 std::vector<std::string>()) override {
376 context.push_back(
377 std::string("[") + std::to_string(this->_pArray->size()) + "]");
378 this->parent()->reportWarning(warning, std::move(context));
379 }
380
381private:
382 IJsonHandler* invalid(const std::string& type) {
383 if (this->_arrayIsOpen) {
384 this->reportWarning(
385 type + " value is not allowed in the integer array and has been "
386 "replaced with a default value.");
387 this->_pArray->emplace_back();
388 return this->ignoreAndContinue();
389 } else {
390 this->reportWarning(type + " is not allowed and has been ignored.");
391 return this->ignoreAndReturnToParent();
392 }
393 }
394
395 std::vector<T>* _pArray = nullptr;
396 bool _arrayIsOpen = false;
397};
398
403template <>
404class CESIUMJSONREADER_API ArrayJsonHandler<std::string, StringJsonHandler>
405 : public JsonHandler {
406public:
408 using ValueType = std::vector<std::string>;
409
410 ArrayJsonHandler() noexcept : JsonHandler() {}
411
416 void reset(IJsonHandler* pParent, std::vector<std::string>* pArray) {
417 JsonHandler::reset(pParent);
418 this->_pArray = pArray;
419 this->_arrayIsOpen = false;
420 }
421
422 virtual IJsonHandler* readNull() override {
423 return this->invalid("A null")->readNull();
424 }
425
426 virtual IJsonHandler* readBool(bool b) override {
427 return this->invalid("A bool")->readBool(b);
428 }
429
430 virtual IJsonHandler* readInt32(int32_t i) override {
431 return this->invalid("An integer")->readInt32(i);
432 }
433
434 virtual IJsonHandler* readUint32(uint32_t i) override {
435 return this->invalid("An integer")->readUint32(i);
436 }
437
438 virtual IJsonHandler* readInt64(int64_t i) override {
439 return this->invalid("An integer")->readInt64(i);
440 }
441
442 virtual IJsonHandler* readUint64(uint64_t i) override {
443 return this->invalid("An integer")->readUint64(i);
444 }
445
446 virtual IJsonHandler* readDouble(double d) override {
447 return this->invalid("A double (floating-point)")->readDouble(d);
448 }
449
450 virtual IJsonHandler* readObjectStart() override {
451 return this->invalid("An object")->readObjectStart();
452 }
453
454 virtual IJsonHandler* readArrayStart() override {
455 if (this->_arrayIsOpen) {
456 return this->invalid("An array")->readArrayStart();
457 }
458
459 this->_arrayIsOpen = true;
460 this->_pArray->clear();
461 return this;
462 }
463
464 virtual IJsonHandler* readArrayEnd() override { return this->parent(); }
465
466 virtual IJsonHandler* readString(const std::string_view& str) override {
467 if (!this->_arrayIsOpen) {
468 return this->invalid("A string")->readString(str);
469 }
470
471 CESIUM_ASSERT(this->_pArray);
472 this->_pArray->emplace_back(str);
473 return this;
474 }
475
476 virtual void reportWarning(
477 const std::string& warning,
478 std::vector<std::string>&& context =
479 std::vector<std::string>()) override {
480 context.push_back(
481 std::string("[") + std::to_string(this->_pArray->size()) + "]");
482 this->parent()->reportWarning(warning, std::move(context));
483 }
484
485private:
486 IJsonHandler* invalid(const std::string& type) {
487 if (this->_arrayIsOpen) {
488 this->reportWarning(
489 type + " value is not allowed in the string array and has been "
490 "replaced with a default value.");
491 this->_pArray->emplace_back();
492 return this->ignoreAndContinue();
493 } else {
494 this->reportWarning(type + " is not allowed and has been ignored.");
495 return this->ignoreAndReturnToParent();
496 }
497 }
498
499 std::vector<std::string>* _pArray = nullptr;
500 bool _arrayIsOpen = false;
501};
502
510template <typename T, typename THandler>
511class CESIUMJSONREADER_API
512 ArrayJsonHandler<std::vector<T>, ArrayJsonHandler<T, THandler>>
513 : public JsonHandler {
514public:
516 using ValueType = std::vector<T>;
517
524 template <typename... Ts>
525 ArrayJsonHandler(Ts&&... args) noexcept
526 : JsonHandler(),
527 _handlerFactory(
528 std::bind(handlerFactory<Ts...>, std::forward<Ts>(args)...)),
529 _elementHandler() {}
530
535 void reset(IJsonHandler* pParent, std::vector<std::vector<T>>* pArray) {
536 JsonHandler::reset(pParent);
537 this->_pArray = pArray;
538 this->_arrayIsOpen = false;
539 this->_elementHandler.reset(this->_handlerFactory());
540 }
541
542 virtual IJsonHandler* readNull() override {
543 return this->invalid("A null")->readNull();
544 }
545
546 virtual IJsonHandler* readBool(bool b) override {
547 return this->invalid("A bool")->readBool(b);
548 }
549
550 virtual IJsonHandler* readInt32(int32_t i) override {
551 return this->invalid("An integer")->readInt32(i);
552 }
553
554 virtual IJsonHandler* readUint32(uint32_t i) override {
555 return this->invalid("An integer")->readUint32(i);
556 }
557
558 virtual IJsonHandler* readInt64(int64_t i) override {
559 return this->invalid("An integer")->readInt64(i);
560 }
561
562 virtual IJsonHandler* readUint64(uint64_t i) override {
563 return this->invalid("An integer")->readUint64(i);
564 }
565
566 virtual IJsonHandler* readDouble(double d) override {
567 return this->invalid("A double (floating-point)")->readDouble(d);
568 }
569
570 virtual IJsonHandler* readString(const std::string_view& str) override {
571 return this->invalid("A string")->readString(str);
572 }
573
574 virtual IJsonHandler* readObjectStart() override {
575 return this->invalid("An object")->readObjectStart();
576 }
577
578 virtual IJsonHandler* readArrayStart() override {
579 if (this->_arrayIsOpen) {
580 CESIUM_ASSERT(this->_pArray);
581 std::vector<T>& o = this->_pArray->emplace_back();
582 this->_elementHandler->reset(this, &o);
583 return this->_elementHandler->readArrayStart();
584 } else {
585 this->_arrayIsOpen = true;
586 this->_pArray->clear();
587 return this;
588 }
589 }
590
591 virtual IJsonHandler* readArrayEnd() override { return this->parent(); }
592
593 virtual void reportWarning(
594 const std::string& warning,
595 std::vector<std::string>&& context =
596 std::vector<std::string>()) override {
597 context.push_back(
598 std::string("[") + std::to_string(this->_pArray->size()) + "]");
599 this->parent()->reportWarning(warning, std::move(context));
600 }
601
602private:
603 IJsonHandler* invalid(const std::string& type) {
604 if (this->_arrayIsOpen) {
605 this->reportWarning(
606 type + " value is not allowed in the array of arrays and has been "
607 "replaced with a default value.");
608 this->_pArray->emplace_back();
609 return this->ignoreAndContinue();
610 } else {
611 this->reportWarning(type + " is not allowed and has been ignored.");
612 return this->ignoreAndReturnToParent();
613 }
614 }
615
616 template <typename... Ts>
617 static ArrayJsonHandler<T, THandler>* handlerFactory(Ts&&... args) {
618 return new ArrayJsonHandler<T, THandler>(std::forward<Ts>(args)...);
619 }
620
621 std::vector<std::vector<T>>* _pArray = nullptr;
622 bool _arrayIsOpen = false;
623
624 std::function<ArrayJsonHandler<T, THandler>*()> _handlerFactory;
625 std::unique_ptr<ArrayJsonHandler<T, THandler>> _elementHandler;
626};
627
628} // namespace CesiumJsonReader
virtual IJsonHandler * readUint32(uint32_t i) override
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readString(const std::string_view &str) override
Called when the JSON parser encounters a string value.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readArrayStart() override
Called when the JSON parser encounters the start of an array.
virtual void reportWarning(const std::string &warning, std::vector< std::string > &&context=std::vector< std::string >()) override
Report a warning while reading JSON.
virtual IJsonHandler * readArrayEnd() override
Called when the JSON parser encounters the end of an array.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
virtual IJsonHandler * readDouble(double d) override
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readNull() override
Called when the JSON parser encounters a null.
void reset(IJsonHandler *pParent, std::vector< T > *pArray)
Resets the parent and destination array of this ArrayJsonHandler.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 value.
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
virtual IJsonHandler * readBool(bool b) override
Called when the JSON parser encounters a boolean value.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 value.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
virtual IJsonHandler * readNull() override
Called when the JSON parser encounters a null.
virtual IJsonHandler * readDouble(double d) override
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readString(const std::string_view &str) override
Called when the JSON parser encounters a string value.
virtual IJsonHandler * readUint32(uint32_t i) override
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readBool(bool b) override
Called when the JSON parser encounters a boolean value.
virtual IJsonHandler * readArrayStart() override
Called when the JSON parser encounters the start of an array.
virtual IJsonHandler * readArrayEnd() override
Called when the JSON parser encounters the end of an array.
void reset(IJsonHandler *pParent, std::vector< double > *pArray)
Resets the parent and destination array of this ArrayJsonHandler.
virtual void reportWarning(const std::string &warning, std::vector< std::string > &&context=std::vector< std::string >()) override
Report a warning while reading JSON.
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
virtual IJsonHandler * readArrayEnd() override
Called when the JSON parser encounters the end of an array.
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
virtual IJsonHandler * readArrayStart() override
Called when the JSON parser encounters the start of an array.
virtual IJsonHandler * readUint32(uint32_t i) override
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readDouble(double d) override
Called when the JSON parser encounters a double value.
void reset(IJsonHandler *pParent, std::vector< std::string > *pArray)
Resets the parent and destination array of this ArrayJsonHandler.
virtual IJsonHandler * readNull() override
Called when the JSON parser encounters a null.
virtual IJsonHandler * readBool(bool b) override
Called when the JSON parser encounters a boolean value.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 value.
virtual IJsonHandler * readString(const std::string_view &str) override
Called when the JSON parser encounters a string value.
std::vector< std::string > ValueType
The destination type.
virtual void reportWarning(const std::string &warning, std::vector< std::string > &&context=std::vector< std::string >()) override
Report a warning while reading JSON.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
virtual IJsonHandler * readNull() override
Called when the JSON parser encounters a null.
virtual void reportWarning(const std::string &warning, std::vector< std::string > &&context=std::vector< std::string >()) override
Report a warning while reading JSON.
virtual IJsonHandler * readUint32(uint32_t i) override
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readArrayStart() override
Called when the JSON parser encounters the start of an array.
virtual IJsonHandler * readArrayEnd() override
Called when the JSON parser encounters the end of an array.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
void reset(IJsonHandler *pParent, std::vector< std::vector< T > > *pArray)
Resets the parent and destination array of this ArrayJsonHandler.
virtual IJsonHandler * readDouble(double d) override
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readString(const std::string_view &str) override
Called when the JSON parser encounters a string value.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readBool(bool b) override
Called when the JSON parser encounters a boolean value.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 value.
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
IJsonHandler for reading a JSON array into an std::vector.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readArrayStart() override
Called when the JSON parser encounters the start of an array.
std::vector< T > ValueType
The destination type.
void reset(IJsonHandler *pParent, std::vector< T > *pArray)
Resets the parent and destination array of this ArrayJsonHandler.
virtual IJsonHandler * readObjectKey(const std::string_view &) noexcept override
Called when the JSON parser encounters a key while reading an object.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 value.
virtual IJsonHandler * readUint32(uint32_t i) override
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readString(const std::string_view &str) override
Called when the JSON parser encounters a string value.
virtual IJsonHandler * readArrayEnd() override
Called when the JSON parser encounters the end of an array.
ArrayJsonHandler(Ts &&... args) noexcept
Creates a new ArrayJsonHandler.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
virtual IJsonHandler * readDouble(double d) override
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readBool(bool b) override
Called when the JSON parser encounters a boolean value.
virtual IJsonHandler * readNull() override
Called when the JSON parser encounters a null.
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
virtual void reportWarning(const std::string &warning, std::vector< std::string > &&context=std::vector< std::string >()) override
Report a warning while reading JSON.
virtual IJsonHandler * readObjectEnd() noexcept override
Called when the JSON parser encounters the end of an object.
IJsonHandler for reading double values.
Base interface for all JSON handlers. Types that need to be deserialized from JSON should implement I...
virtual IJsonHandler * readUint32(uint32_t i)=0
Called when the JSON parser encounters a uint32 value.
virtual IJsonHandler * readUint64(uint64_t i)=0
Called when the JSON parser encounters a uint64 value.
virtual IJsonHandler * readNull()=0
Called when the JSON parser encounters a null.
virtual IJsonHandler * readDouble(double d)=0
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readBool(bool b)=0
Called when the JSON parser encounters a boolean value.
virtual IJsonHandler * readObjectStart()=0
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readString(const std::string_view &str)=0
Called when the JSON parser encounters a string value.
virtual IJsonHandler * readInt64(int64_t i)=0
Called when the JSON parser encounters an int64 value.
virtual IJsonHandler * readInt32(int32_t i)=0
Called when the JSON parser encounters an int32 value.
IJsonHandler for reading integer values.
A dummy implementation of IJsonHandler that will report a warning and return its parent when any of i...
Definition JsonHandler.h:19
IJsonHandler for reading string values.
Classes for reading JSON.
STL namespace.