tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
default_serializer.hpp
Go to the documentation of this file.
1
7#if !defined(TETENGO_TRIE_DEFAULTSERIALIZER_HPP)
8#define TETENGO_TRIE_DEFAULTSERIALIZER_HPP
9
10#include <string>
11#include <string_view>
12#include <type_traits>
13#include <vector>
14
15
16namespace tetengo::trie
17{
35 template <typename Object, typename = void>
37
38
39#if !defined(DOCUMENTATION)
40 template <>
41 class default_serializer<std::string_view>
42 {
43 public:
44 // constructors and destructor
45
46 explicit default_serializer(bool ignored);
47
48
49 // functions
50
51 const std::string_view& operator()(const std::string_view& object) const;
52 };
53
54 template <>
55 class default_serializer<std::string>
56 {
57 public:
58 // constructors and destructor
59
60 explicit default_serializer(bool ignored);
61
62
63 // functions
64
65 const std::string& operator()(const std::string& object) const;
66 };
67
68 template <typename Char>
69 class default_serializer<std::basic_string_view<Char>>
70 {
71 public:
72 // constructors and destructor
73
74 explicit default_serializer(bool fe_escape);
75
76
77 // functions
78
79 std::vector<char> operator()(const std::basic_string_view<Char>& object) const;
80
81
82 private:
83 // variables
84
85 bool m_fe_escape;
86 };
87
88 template <typename Char>
89 class default_serializer<std::basic_string<Char>>
90 {
91 public:
92 // constructors and destructor
93
94 explicit default_serializer(bool fe_escape);
95
96
97 // functions
98
99 std::vector<char> operator()(const std::basic_string<Char>& object) const;
100
101
102 private:
103 // variables
104
105 bool m_fe_escape;
106 };
107
108 template <typename Integer>
109 class default_serializer<Integer, std::enable_if_t<std::is_integral_v<Integer>>>
110 {
111 public:
112 // constructors and destructor
113
114 explicit default_serializer(bool fe_escape);
115
116
117 // functions
118
119 std::vector<char> operator()(Integer object) const;
120
121
122 private:
123 // variables
124
125 bool m_fe_escape;
126 };
127
128#endif
129
130
148 template <typename Object, typename = void>
150
151
152#if !defined(DOCUMENTATION)
153 template <>
154 class default_deserializer<std::string>
155 {
156 public:
157 // constructors and destructor
158
159 explicit default_deserializer(bool ignored);
160
161
162 // functions
163
164 const std::string& operator()(const std::string& bytes) const;
165 };
166
167 template <typename Char>
168 class default_deserializer<std::basic_string<Char>>
169 {
170 public:
171 // constructors and destructor
172
173 explicit default_deserializer(bool fe_escape);
174
175
176 // functions
177
178 std::basic_string<Char> operator()(const std::vector<char>& bytes) const;
179
180
181 private:
182 // variables
183
184 bool m_fe_escape;
185 };
186
187 template <typename Integer>
188 class default_deserializer<Integer, std::enable_if_t<std::is_integral_v<Integer>>>
189 {
190 public:
191 // constructors and destructor
192
193 explicit default_deserializer(bool fe_escape);
194
195
196 // functions
197
198 Integer operator()(const std::vector<char>& bytes) const;
199
200
201 private:
202 // variables
203
204 bool m_fe_escape;
205 };
206
207#endif
208}
209
210
211#endif
A default deserializer.
Definition default_serializer.hpp:149
A default serializer.
Definition default_serializer.hpp:36
A trie library.