cesium-native 0.43.0
Loading...
Searching...
No Matches
JsonHandler.h
1#pragma once
2
3#include "IJsonHandler.h"
4#include "IgnoreValueJsonHandler.h"
5#include "Library.h"
6
7#include <cstdint>
8#include <string>
9
10namespace CesiumJsonReader {
19class CESIUMJSONREADER_API JsonHandler : public IJsonHandler {
20public:
21 JsonHandler() noexcept;
23 virtual IJsonHandler* readNull() override;
25 virtual IJsonHandler* readBool(bool b) override;
27 virtual IJsonHandler* readInt32(int32_t i) override;
29 virtual IJsonHandler* readUint32(uint32_t i) override;
31 virtual IJsonHandler* readInt64(int64_t i) override;
33 virtual IJsonHandler* readUint64(uint64_t i) override;
35 virtual IJsonHandler* readDouble(double d) override;
37 virtual IJsonHandler* readString(const std::string_view& str) override;
39 virtual IJsonHandler* readObjectStart() override;
41 virtual IJsonHandler* readObjectKey(const std::string_view& str) override;
43 virtual IJsonHandler* readObjectEnd() override;
45 virtual IJsonHandler* readArrayStart() override;
47 virtual IJsonHandler* readArrayEnd() override;
48
50 virtual void reportWarning(
51 const std::string& warning,
52 std::vector<std::string>&& context = std::vector<std::string>()) override;
53
54protected:
58 void reset(IJsonHandler* pParent);
59
64
69
75
76private:
77 IJsonHandler* _pParent = nullptr;
79};
80
81} // namespace CesiumJsonReader
Base interface for all JSON handlers. Types that need to be deserialized from JSON should implement I...
IJsonHandler that does nothing but ignore the next value.
A dummy implementation of IJsonHandler that will report a warning and return its parent when any of i...
Definition JsonHandler.h:19
virtual IJsonHandler * readNull() override
Called when the JSON parser encounters a null.
virtual IJsonHandler * readUint64(uint64_t i) override
Called when the JSON parser encounters a uint64 value.
virtual IJsonHandler * readInt32(int32_t i) override
Called when the JSON parser encounters an int32 value.
virtual IJsonHandler * readObjectStart() override
Called when the JSON parser encounters the beginning of an object.
virtual IJsonHandler * readArrayEnd() override
Called when the JSON parser encounters the end of an array.
IJsonHandler * ignoreAndReturnToParent()
Ignore a single value and then return to the parent handler.
virtual IJsonHandler * readInt64(int64_t i) override
Called when the JSON parser encounters an int64 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 * readString(const std::string_view &str) override
Called when the JSON parser encounters a string value.
IJsonHandler * ignoreAndContinue()
Ignore a single value and the continue processing more tokens with this handler.
virtual IJsonHandler * readObjectEnd() override
Called when the JSON parser encounters the end of an object.
IJsonHandler * parent()
Obtains the parent IJsonHandler of this handler.
virtual IJsonHandler * readArrayStart() override
Called when the JSON parser encounters the start of an array.
void reset(IJsonHandler *pParent)
Resets the parent IJsonHandler of this handler.
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 * readDouble(double d) override
Called when the JSON parser encounters a double value.
virtual IJsonHandler * readObjectKey(const std::string_view &str) override
Called when the JSON parser encounters a key while reading an object.
Classes for reading JSON.