CppSerialization 1.0.5.0
C++ Serialization Library
Loading...
Searching...
No Matches
deserializer.h
Go to the documentation of this file.
1
9#ifndef CPPSERIALIZATION_JSON_DESERIALIZER_H
10#define CPPSERIALIZATION_JSON_DESERIALIZER_H
11
12#include "json.h"
13
14#include <algorithm>
15#include <cassert>
16#include <functional>
17
18namespace CppSerialization {
19namespace JSON {
20
22
26{
27public:
28 Deserializer() = delete;
29 Deserializer(const Deserializer&) = delete;
31 ~Deserializer() = delete;
32
35
37 template<typename JSON>
38 static bool Find(const JSON& json, const char* key, bool& value);
40 template<typename JSON>
41 static bool Find(const JSON& json, const char* key, int& value);
43 template<typename JSON>
44 static bool Find(const JSON& json, const char* key, unsigned& value);
46 template<typename JSON>
47 static bool Find(const JSON& json, const char* key, int64_t& value);
49 template<typename JSON>
50 static bool Find(const JSON& json, const char* key, uint64_t& value);
52 template<typename JSON>
53 static bool Find(const JSON& json, const char* key, double& value);
55 template<typename JSON>
56 static bool Find(const JSON& json, const char* key, char* value, size_t size);
58 template<typename JSON>
59 static bool Find(const JSON& json, const char* key, std::string& value);
61 template <typename JSON, std::size_t N>
62 static bool Find(const JSON& json, const char* key, char (&value)[N]);
63
65 template<typename JSON>
66 static bool FindArray(const JSON& json, const char* key, const std::function<void(const Value&)>& handler);
68 template<typename JSON>
69 static bool FindArray(const JSON& json, const char* key, const std::function<void(size_t)>& initialize, const std::function<void(const Value&)>& handler);
70
72 template<typename JSON>
73 static bool FindObject(const JSON& json, const char* key, const std::function<void(const Value::ConstObject&)>& handler);
74};
75
76} // namespace JSON
77} // namespace CppSerialization
78
79#include "deserializer.inl"
80
81#endif // CPPSERIALIZATION_JSON_DESERIALIZER_H
Deserializer & operator=(Deserializer &&)=delete
Deserializer(Deserializer &&)=delete
Deserializer & operator=(const Deserializer &)=delete
Deserializer(const Deserializer &)=delete
static bool FindArray(const JSON &json, const char *key, const std::function< void(const Value &)> &handler)
Try to get the array key/value pair.
static bool FindObject(const JSON &json, const char *key, const std::function< void(const Value::ConstObject &)> &handler)
Try to get the object key/value pair.
static bool Find(const JSON &json, const char *key, bool &value)
Try to get the boolean key/value pair.
JSON deserializer inline implementation.
JSON C++ Library definition.
C++ Serialization project definitions.
Definition exceptions.h:14