/src/poco/Foundation/include/Poco/Dynamic/VarHolder.h
Line | Count | Source (jump to first uncovered line) |
1 | | // |
2 | | // VarHolder.h |
3 | | // |
4 | | // Library: Foundation |
5 | | // Package: Dynamic |
6 | | // Module: VarHolder |
7 | | // |
8 | | // Definition of the VarHolder class. |
9 | | // |
10 | | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. |
11 | | // and Contributors. |
12 | | // |
13 | | // SPDX-License-Identifier: BSL-1.0 |
14 | | // |
15 | | |
16 | | |
17 | | #ifndef Foundation_VarHolder_INCLUDED |
18 | | #define Foundation_VarHolder_INCLUDED |
19 | | |
20 | | |
21 | | #include "Poco/Foundation.h" |
22 | | #include "Poco/NumberFormatter.h" |
23 | | #include "Poco/NumberParser.h" |
24 | | #include "Poco/DateTime.h" |
25 | | #include "Poco/Timestamp.h" |
26 | | #include "Poco/LocalDateTime.h" |
27 | | #include "Poco/DateTimeFormat.h" |
28 | | #include "Poco/DateTimeFormatter.h" |
29 | | #include "Poco/DateTimeParser.h" |
30 | | #include "Poco/String.h" |
31 | | #include "Poco/UnicodeConverter.h" |
32 | | #include "Poco/UTFString.h" |
33 | | #include "Poco/UTF8String.h" |
34 | | #include "Poco/UUID.h" |
35 | | #include "Poco/Any.h" |
36 | | #include "Poco/Format.h" |
37 | | #include "Poco/Debugger.h" |
38 | | #include "Poco/Exception.h" |
39 | | #include <vector> |
40 | | #include <list> |
41 | | #include <deque> |
42 | | #include <typeinfo> |
43 | | #include <type_traits> |
44 | | #include <string_view> |
45 | | #undef min |
46 | | #undef max |
47 | | #include <limits> |
48 | | |
49 | | |
50 | | #define POCO_VAR_RANGE_EXCEPTION(str, from) \ |
51 | 0 | throw RangeException(Poco::format("%v ((%s/%d) %s > (%s/%d) %s) @ %s.", \ |
52 | 0 | std::string_view(#str), Poco::demangle<F>(), numValDigits(from), std::to_string(from), \ |
53 | 0 | Poco::demangle<T>(), numTypeDigits<T>(), std::to_string(static_cast<T>(from)), \ |
54 | 0 | poco_src_loc)) |
55 | | |
56 | | |
57 | | namespace Poco { |
58 | | namespace Dynamic { |
59 | | |
60 | | |
61 | | class Var; |
62 | | |
63 | | |
64 | | namespace Impl { |
65 | | |
66 | | |
67 | | bool Foundation_API isJSONString(const Var& any); |
68 | | /// Returns true for values that should be JSON-formatted as string. |
69 | | |
70 | | |
71 | | void Foundation_API appendJSONKey(std::string& val, const Var& any); |
72 | | /// Converts the any to a JSON key (i.e. wraps it into double quotes |
73 | | /// regardless of the underlying type) and appends it to val. |
74 | | |
75 | | |
76 | | void Foundation_API appendJSONString(std::string& val, const Var& any); |
77 | | /// Converts the any to a JSON string (i.e. wraps it into double quotes) |
78 | | /// regardless of the underlying type) and appends it to val. |
79 | | |
80 | | |
81 | | void Foundation_API appendJSONValue(std::string& val, const Var& any, bool wrap = true); |
82 | | /// Converts the any to a JSON value (if underlying type qualifies |
83 | | /// as string - see isJSONString() - it is wrapped into double quotes) |
84 | | /// and appends it to val. |
85 | | /// Wrapping can be prevented (useful for appending JSON fragments) by setting |
86 | | /// the wrap argument to false. |
87 | | |
88 | | |
89 | | template <typename C> |
90 | | void containerToJSON(C& cont, std::string& val) |
91 | 0 | { |
92 | | // Serialize in JSON format. Note: although this is a vector<T>, the code only |
93 | | // supports vector<Var>. Total specialization is not possible |
94 | | // because of the cyclic dependency between Var and VarHolder |
95 | | |
96 | | // JSON format definition: [ n times: elem ',' ], no ',' for last elem |
97 | 0 | val.append("[ "); |
98 | 0 | typename C::const_iterator it = cont.begin(); |
99 | 0 | typename C::const_iterator itEnd = cont.end(); |
100 | 0 | if (!cont.empty()) |
101 | 0 | { |
102 | 0 | appendJSONValue(val, *it); |
103 | 0 | ++it; |
104 | 0 | } |
105 | 0 | for (; it != itEnd; ++it) |
106 | 0 | { |
107 | 0 | val.append(", "); |
108 | 0 | appendJSONValue(val, *it); |
109 | 0 | } |
110 | 0 | val.append(" ]"); |
111 | 0 | } |
112 | | |
113 | | |
114 | | } // namespace Impl |
115 | | |
116 | | |
117 | | class Foundation_API VarHolder |
118 | | /// Interface for a data holder used by the Var class. |
119 | | /// Provides methods to convert between data types. |
120 | | /// Only data types for which VarHolder specialization exists are supported. |
121 | | /// |
122 | | /// Provided are specializations for all C++ built-in types with addition of |
123 | | /// std::string, Poco::UTF16String, DateTime, LocalDateTime, Timestamp, std::vector<Var> and DynamicStruct. |
124 | | /// |
125 | | /// Additional types can be supported by adding specializations. When implementing specializations, |
126 | | /// the only condition is that they reside in Poco namespace and implement the pure virtual functions |
127 | | /// clone() and type(). |
128 | | /// |
129 | | /// Those conversions that are not implemented shall fail back to this base |
130 | | /// class implementation. All the convert() function overloads in this class |
131 | | /// throw BadCastException. |
132 | | { |
133 | | public: |
134 | | using ArrayValueType = Var; |
135 | | |
136 | | virtual ~VarHolder(); |
137 | | /// Destroys the VarHolder. |
138 | | |
139 | | virtual VarHolder* clone(Placeholder<VarHolder>* pHolder = nullptr) const = 0; |
140 | | /// Implementation must implement this function to |
141 | | /// deep-copy the VarHolder. |
142 | | /// If small object optimization is enabled (i.e. if |
143 | | /// POCO_NO_SOO is not defined), VarHolder will be |
144 | | /// instantiated in-place if it's size is smaller |
145 | | /// than POCO_SMALL_OBJECT_SIZE. |
146 | | |
147 | | virtual const std::type_info& type() const = 0; |
148 | | /// Implementation must return the type information |
149 | | /// (typeid) for the stored content. |
150 | | |
151 | | virtual void convert(Int8& val) const; |
152 | | /// Throws BadCastException. Must be overridden in a type |
153 | | /// specialization in order to support the conversion. |
154 | | |
155 | | virtual void convert(Int16& val) const; |
156 | | /// Throws BadCastException. Must be overridden in a type |
157 | | /// specialization in order to support the conversion. |
158 | | |
159 | | virtual void convert(Int32& val) const; |
160 | | /// Throws BadCastException. Must be overridden in a type |
161 | | /// specialization in order to support the conversion. |
162 | | |
163 | | virtual void convert(Int64& val) const; |
164 | | /// Throws BadCastException. Must be overridden in a type |
165 | | /// specialization in order to support the conversion. |
166 | | |
167 | | virtual void convert(UInt8& val) const; |
168 | | /// Throws BadCastException. Must be overridden in a type |
169 | | /// specialization in order to support the conversion. |
170 | | |
171 | | virtual void convert(UInt16& val) const; |
172 | | /// Throws BadCastException. Must be overridden in a type |
173 | | /// specialization in order to support the conversion. |
174 | | |
175 | | virtual void convert(UInt32& val) const; |
176 | | /// Throws BadCastException. Must be overridden in a type |
177 | | /// specialization in order to support the conversion. |
178 | | |
179 | | virtual void convert(UInt64& val) const; |
180 | | /// Throws BadCastException. Must be overridden in a type |
181 | | /// specialization in order to support the conversion. |
182 | | |
183 | | virtual void convert(DateTime& val) const; |
184 | | /// Throws BadCastException. Must be overridden in a type |
185 | | /// specialization in order to support the conversion. |
186 | | |
187 | | virtual void convert(LocalDateTime& val) const; |
188 | | /// Throws BadCastException. Must be overridden in a type |
189 | | /// specialization in order to support the conversion. |
190 | | |
191 | | virtual void convert(Timestamp& val) const; |
192 | | /// Throws BadCastException. Must be overridden in a type |
193 | | /// specialization in order to support the conversion. |
194 | | |
195 | | virtual void convert(UUID& val) const; |
196 | | /// Throws BadCastException. Must be overridden in a type |
197 | | /// specialization in order to support the conversion. |
198 | | |
199 | | #ifndef POCO_INT64_IS_LONG |
200 | | |
201 | | void convert(long& val) const; |
202 | | /// Calls convert(Int32). |
203 | | |
204 | | void convert(unsigned long& val) const; |
205 | | /// Calls convert(UInt32). |
206 | | |
207 | | #else |
208 | | |
209 | | virtual void convert(long long& val) const; |
210 | | /// Throws BadCastException. Must be overridden in a type |
211 | | /// specialization in order to suport the conversion. |
212 | | |
213 | | virtual void convert(unsigned long long & val) const; |
214 | | /// Throws BadCastException. Must be overridden in a type |
215 | | /// specialization in order to suport the conversion. |
216 | | |
217 | | #endif |
218 | | |
219 | | virtual void convert(bool& val) const; |
220 | | /// Throws BadCastException. Must be overridden in a type |
221 | | /// specialization in order to support the conversion. |
222 | | |
223 | | virtual void convert(float& val) const; |
224 | | /// Throws BadCastException. Must be overridden in a type |
225 | | /// specialization in order to support the conversion. |
226 | | |
227 | | virtual void convert(double& val) const; |
228 | | /// Throws BadCastException. Must be overridden in a type |
229 | | /// specialization in order to support the conversion. |
230 | | |
231 | | virtual void convert(char& val) const; |
232 | | /// Throws BadCastException. Must be overridden in a type |
233 | | /// specialization in order to support the conversion. |
234 | | |
235 | | virtual void convert(std::string& val) const; |
236 | | /// Throws BadCastException. Must be overridden in a type |
237 | | /// specialization in order to support the conversion. |
238 | | |
239 | | virtual void convert(Poco::UTF16String& val) const; |
240 | | /// Throws BadCastException. Must be overridden in a type |
241 | | /// specialization in order to support the conversion. |
242 | | |
243 | | virtual bool isArray() const; |
244 | | /// Returns true. |
245 | | |
246 | | virtual bool isVector() const; |
247 | | /// Returns false. Must be properly overridden in a type |
248 | | /// specialization in order to support the diagnostic. |
249 | | |
250 | | virtual bool isList() const; |
251 | | /// Returns false. Must be properly overridden in a type |
252 | | /// specialization in order to support the diagnostic. |
253 | | |
254 | | virtual bool isDeque() const; |
255 | | /// Returns false. Must be properly overridden in a type |
256 | | /// specialization in order to support the diagnostic. |
257 | | |
258 | | virtual bool isStruct() const; |
259 | | /// Returns false. Must be properly overridden in a type |
260 | | /// specialization in order to support the diagnostic. |
261 | | |
262 | | virtual bool isOrdered() const; |
263 | | /// Returns false. Must be properly overridden in a type |
264 | | /// specialization in order to support the diagnostic. |
265 | | |
266 | | virtual bool isInteger() const; |
267 | | /// Returns false. Must be properly overridden in a type |
268 | | /// specialization in order to support the diagnostic. |
269 | | |
270 | | virtual bool isSigned() const; |
271 | | /// Returns false. Must be properly overridden in a type |
272 | | /// specialization in order to support the diagnostic. |
273 | | |
274 | | virtual bool isNumeric() const; |
275 | | /// Returns false. Must be properly overridden in a type |
276 | | /// specialization in order to support the diagnostic. |
277 | | |
278 | | virtual bool isBoolean() const; |
279 | | /// Returns false. Must be properly overridden in a type |
280 | | /// specialization in order to support the diagnostic. |
281 | | |
282 | | virtual bool isString() const; |
283 | | /// Returns false. Must be properly overridden in a type |
284 | | /// specialization in order to support the diagnostic. |
285 | | |
286 | | virtual bool isDate() const; |
287 | | /// Returns false. Must be properly overridden in a type |
288 | | /// specialization in order to support the diagnostic. |
289 | | |
290 | | virtual bool isTime() const; |
291 | | /// Returns false. Must be properly overridden in a type |
292 | | /// specialization in order to support the diagnostic. |
293 | | |
294 | | virtual bool isDateTime() const; |
295 | | /// Returns false. Must be properly overridden in a type |
296 | | /// specialization in order to support the diagnostic. |
297 | | |
298 | | virtual bool isUUID() const; |
299 | | /// Returns false. Must be properly overridden in a type |
300 | | /// specialization in order to support the diagnostic. |
301 | | |
302 | | virtual std::size_t size() const; |
303 | | /// Returns 1 iff Var is not empty or this function overridden. |
304 | | |
305 | | protected: |
306 | | VarHolder(); |
307 | | /// Creates the VarHolder. |
308 | | |
309 | | template <typename T> |
310 | | VarHolder* cloneHolder(Placeholder<VarHolder>* pVarHolder, const T& val) const |
311 | | /// Instantiates value holder wrapper. |
312 | | /// |
313 | | /// Called from clone() member function of the implementation. |
314 | | /// |
315 | | /// When the smal object optimization is enabled (POCO_NO_SOO not |
316 | | /// defined), if size of the wrapper is larger than |
317 | | /// POCO_SMALL_OBJECT_SIZE, holder is instantiated on |
318 | | /// the heap, otherwise it is instantiated in-place (in the |
319 | | /// pre-allocated buffer inside the holder). |
320 | 0 | { |
321 | 0 | poco_check_ptr (pVarHolder); |
322 | 0 | return pVarHolder->assign<VarHolderImpl<T>, T>(val); |
323 | 0 | } Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<signed char>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, signed char const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<short>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, short const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<int>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, int const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<long>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, long const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<unsigned char>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, unsigned char const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<unsigned short>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, unsigned short const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<unsigned int>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, unsigned int const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<unsigned long>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, unsigned long const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<bool>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, bool const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<float>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, float const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<double>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, double const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<char>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, char const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<std::__1::basic_string<unsigned short, Poco::UTF16CharTraits, std::__1::allocator<unsigned short> > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, std::__1::basic_string<unsigned short, Poco::UTF16CharTraits, std::__1::allocator<unsigned short> > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<long long>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, long long const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<unsigned long long>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, unsigned long long const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::DateTime>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::DateTime const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::LocalDateTime>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::LocalDateTime const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::Timestamp>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::Timestamp const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::UUID>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::UUID const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::Dynamic::Struct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, Poco::Dynamic::Var> > >, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::Dynamic::Struct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, Poco::Dynamic::Var> > >, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::Dynamic::Struct<int, std::__1::map<int, Poco::Dynamic::Var, std::__1::less<int>, std::__1::allocator<std::__1::pair<int const, Poco::Dynamic::Var> > >, std::__1::set<int, std::__1::less<int>, std::__1::allocator<int> > > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::Dynamic::Struct<int, std::__1::map<int, Poco::Dynamic::Var, std::__1::less<int>, std::__1::allocator<std::__1::pair<int const, Poco::Dynamic::Var> > >, std::__1::set<int, std::__1::less<int>, std::__1::allocator<int> > > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::Dynamic::Struct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, tsl::ordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var> >, std::__1::deque<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var> > > >, tsl::ordered_set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::deque<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::Dynamic::Struct<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, tsl::ordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var> >, std::__1::deque<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Poco::Dynamic::Var> > > >, tsl::ordered_set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::deque<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::Dynamic::Struct<int, tsl::ordered_map<int, Poco::Dynamic::Var, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int, Poco::Dynamic::Var> >, std::__1::deque<std::__1::pair<int, Poco::Dynamic::Var>, std::__1::allocator<std::__1::pair<int, Poco::Dynamic::Var> > > >, tsl::ordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int>, std::__1::deque<int, std::__1::allocator<int> > > > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::Dynamic::Struct<int, tsl::ordered_map<int, Poco::Dynamic::Var, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int, Poco::Dynamic::Var> >, std::__1::deque<std::__1::pair<int, Poco::Dynamic::Var>, std::__1::allocator<std::__1::pair<int, Poco::Dynamic::Var> > > >, tsl::ordered_set<int, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<int>, std::__1::deque<int, std::__1::allocator<int> > > > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::SharedPtr<Poco::JSON::Object, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Object> > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::SharedPtr<Poco::JSON::Object, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Object> > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::SharedPtr<Poco::JSON::Array, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Array> > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::SharedPtr<Poco::JSON::Array, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Array> > const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::JSON::Array>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::JSON::Array const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<Poco::JSON::Object>(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, Poco::JSON::Object const&) const Unexecuted instantiation: Poco::Dynamic::VarHolder* Poco::Dynamic::VarHolder::cloneHolder<std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > >(Poco::Placeholder<Poco::Dynamic::VarHolder, 64u>*, std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > const&) const |
324 | | |
325 | | template <typename F, typename T, |
326 | | std::enable_if_t<(std::is_integral_v<F> && std::is_signed_v<F>) || |
327 | | std::is_floating_point_v<F>, F>* = nullptr, |
328 | | std::enable_if_t<(std::is_integral_v<T> && std::is_signed_v<T>) || |
329 | | std::is_floating_point_v<F>, T>* = nullptr> |
330 | | static void convertToSmaller(const F& from, T& to) |
331 | | /// Converts signed integral, as well as floating-point, values from |
332 | | /// larger to smaller type. It checks the upper and lower bound and |
333 | | /// if from value is within limits of type T (i.e. check calls do not throw), |
334 | | /// it is converted. |
335 | 0 | { |
336 | | if constexpr((std::is_integral_v<F>) && (std::is_floating_point_v<T>)) |
337 | | { |
338 | | if (isPrecisionLost<F, T>(from)) |
339 | | POCO_VAR_RANGE_EXCEPTION ("Lost precision", from); |
340 | | } |
341 | 0 | checkUpperLimit<F,T>(from); |
342 | 0 | checkLowerLimit<F,T>(from); |
343 | 0 | to = static_cast<T>(from); |
344 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIsaTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPs0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIiaTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPi0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIisTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPi0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIlaTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPl0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIlsTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPl0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIliTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPl0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIfaTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPf0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIfsTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPf0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIfiTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPf0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIflTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPf0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPl0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIfxTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPf0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPx0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIdaTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPd0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIdsTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPd0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIdiTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPd0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIdlTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPd0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPl0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIdxTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPd0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPx0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIdfTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPd0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPf0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIxaTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPx0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIxsTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPx0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder16convertToSmallerIxiTnPNSt3__19enable_ifIXooaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_Esr3stdE19is_floating_point_vIS5_EES5_E4typeELPx0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vIS5_EESA_E4typeELPi0EEEvRKS5_RSA_ |
345 | | |
346 | | template <typename F, typename T, |
347 | | std::enable_if_t<std::is_integral_v<F> && std::is_signed_v<T>, F>* = nullptr, |
348 | | std::enable_if_t<std::is_floating_point_v<T>, T>* = nullptr> |
349 | | static void convertToSmaller(const F& from, T& to) |
350 | | /// Converts signed integral values from integral to floating-point type. Checks for |
351 | | /// the loss of precision and if from value is within limits of type T (i.e. check calls do not throw), |
352 | | /// it is converted. |
353 | | { |
354 | | if (isPrecisionLost<F, T>(from)) |
355 | | POCO_VAR_RANGE_EXCEPTION ("Lost precision", from); |
356 | | to = static_cast<T>(from); |
357 | | } |
358 | | |
359 | | template <typename F, typename T, |
360 | | std::enable_if_t<std::is_same_v<F, bool>>* = nullptr, |
361 | | std::enable_if_t<std::is_floating_point_v<T>, T>* = nullptr> |
362 | | static void convertToSmaller(const F& from, T& to) |
363 | | /// Converts boolean values to floating-point type. |
364 | | { |
365 | | to = static_cast<T>(from); |
366 | | } |
367 | | |
368 | | template <typename F, typename T, |
369 | | std::enable_if_t<std::is_integral_v<F> && !std::is_signed_v<F>, F>* = nullptr, |
370 | | std::enable_if_t<(std::is_integral_v<T> && !std::is_signed_v<T>) || std::is_floating_point_v<T>, T>* = nullptr> |
371 | | static void convertToSmallerUnsigned(const F& from, T& to) |
372 | | /// Converts unsigned integral data types from larger to smaller, as well as to floating-point, types. |
373 | | /// Since lower limit is always 0 for unsigned types, only the upper limit is checked, thus |
374 | | /// saving some cycles compared to the signed version of the function. If the |
375 | | /// value to be converted is smaller than the maximum value for the target type, |
376 | | /// the conversion is performed. |
377 | 0 | { |
378 | 0 | checkUpperLimit<F,T>(from); |
379 | 0 | to = static_cast<T>(from); |
380 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedIthTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPt0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedIjhTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedIjtTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedImhTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedImtTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedImjTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedIyhTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedIytTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder24convertToSmallerUnsignedIyjTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXooaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_Esr3stdE19is_floating_point_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ |
381 | | |
382 | | template <typename F, typename T, |
383 | | std::enable_if_t<std::is_integral_v<F> && std::is_signed_v<F>, F>* = nullptr, |
384 | | std::enable_if_t<std::is_integral_v<T> && !std::is_signed_v<T>, T>* = nullptr> |
385 | | static void convertSignedToUnsigned(const F& from, T& to) |
386 | | /// Converts signed integral data types to unsigned data types. |
387 | | /// Negative values can not be converted and if one is encountered, RangeException is thrown. |
388 | | /// If upper limit is within the target data type limits, the conversion is performed. |
389 | 0 | { |
390 | 0 | if (from < 0) |
391 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too small", from); |
392 | 0 | checkUpperLimit<std::make_unsigned_t<F>,T>(from); |
393 | 0 | to = static_cast<T>(from); |
394 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIahTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPa0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIatTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPa0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIajTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPa0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIamTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPa0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPm0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIayTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPa0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPy0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIshTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPs0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIstTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPs0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIsjTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPs0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIsmTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPs0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPm0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIsyTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPs0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPy0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIihTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPi0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIitTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPi0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIijTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPi0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIimTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPi0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPm0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIiyTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPi0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPy0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIlhTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPl0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIltTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPl0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIljTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPl0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIlmTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPl0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPm0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIlyTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPl0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPy0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIxhTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPx0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPh0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIxtTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPx0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPt0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIxjTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPx0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPj0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIxmTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPx0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPm0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertSignedToUnsignedIxyTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Esr3stdE11is_signed_vIS5_EES5_E4typeELPx0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vISA_EESA_E4typeELPy0EEEvRKS5_RSA_ |
395 | | |
396 | | template <typename F, typename T, std::enable_if_t<std::is_floating_point_v<F>, bool> = true, |
397 | | std::enable_if_t<std::is_integral_v<T> && !std::is_signed_v<T>, T>* = nullptr> |
398 | | static void convertSignedFloatToUnsigned(const F& from, T& to) |
399 | | /// Converts floating point data types to unsigned integral data types. Negative values |
400 | | /// can not be converted and if one is encountered, RangeException is thrown. |
401 | | /// If upper limit is within the target data type limits, the conversion is performed. |
402 | 0 | { |
403 | 0 | if (from < 0) |
404 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too small", from); |
405 | 0 | checkUpperLimit<F,T>(from); |
406 | 0 | to = static_cast<T>(from); |
407 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIfhTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPh0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIftTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPt0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIfjTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPj0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIfmTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPm0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIfyTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPy0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIdhTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPh0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIdtTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPt0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIdjTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPj0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIdmTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPm0EEEvRKS5_RS8_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder28convertSignedFloatToUnsignedIdyTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1ETnPNS4_IXaasr3stdE13is_integral_vIT0_Entsr3stdE11is_signed_vIS8_EES8_E4typeELPy0EEEvRKS5_RS8_ |
408 | | |
409 | | template <typename F, typename T, |
410 | | std::enable_if_t<std::is_integral_v<F> && !std::is_signed_v<F>, F>* = nullptr, |
411 | | std::enable_if_t<std::is_integral_v<T> && std::is_signed_v<T>, T>* = nullptr> |
412 | | static void convertUnsignedToSigned(const F& from, T& to) |
413 | | /// Converts unsigned integral data types to signed integral data types. |
414 | | /// If upper limit is within the target data type limits, the conversion is performed. |
415 | 0 | { |
416 | 0 | checkUpperLimit<F,T>(from); |
417 | 0 | to = static_cast<T>(from); |
418 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIhaTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPh0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIhsTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPh0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedItaTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPt0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedItsTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPt0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedItiTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPt0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIjaTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIjsTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIjiTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIjlTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPl0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIjxTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPj0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPx0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedImaTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedImsTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedImiTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedImlTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPl0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedImxTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPm0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPx0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIyaTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPa0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIysTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPs0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIyiTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPi0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIylTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPl0EEEvRKS5_RSA_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder23convertUnsignedToSignedIyxTnPNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE11is_signed_vIS5_EES5_E4typeELPy0ETnPNS4_IXaasr3stdE13is_integral_vIT0_Esr3stdE11is_signed_vISA_EESA_E4typeELPx0EEEvRKS5_RSA_ |
419 | | |
420 | | template <typename F, typename T, std::enable_if_t<std::is_signed_v<F> && std::is_signed_v<T> && (sizeof(F) <= sizeof(T))>* = nullptr> |
421 | | void convertToSigned(const F& from, T& to) const |
422 | | { |
423 | | to = static_cast<T>(from); |
424 | | } |
425 | | |
426 | | template <typename F, typename T, std::enable_if_t<std::is_signed_v<F> && std::is_signed_v<T> && (sizeof(F) > sizeof(T))>* = nullptr> |
427 | | void convertToSigned(const F& from, T& to) const |
428 | | { |
429 | | convertToSmaller(from, to); |
430 | | } |
431 | | |
432 | | template <typename F, typename T, std::enable_if_t<!std::is_signed_v<F> && std::is_signed_v<T>>* = nullptr> |
433 | | void convertToSigned(const F& from, T& to) const |
434 | | { |
435 | | convertUnsignedToSigned(from, to); |
436 | | } |
437 | | |
438 | | template <typename F, typename T, std::enable_if_t<!std::is_signed_v<F> && !std::is_signed_v<T> && (sizeof(F) <= sizeof(T))>* = nullptr> |
439 | | void convertToUnsigned(const F& from, T& to) const |
440 | | { |
441 | | to = static_cast<T>(from); |
442 | | } |
443 | | |
444 | | template <typename F, typename T, std::enable_if_t<!std::is_signed_v<F> && !std::is_signed_v<T> && (sizeof(F) > sizeof(T))>* = nullptr> |
445 | | void convertToUnsigned(const F& from, T& to) const |
446 | | { |
447 | | convertToSmallerUnsigned(from, to); |
448 | | } |
449 | | |
450 | | template <typename F, typename T, std::enable_if_t<std::is_signed_v<F> && !std::is_signed_v<T>>* = nullptr> |
451 | | void convertToUnsigned(const F& from, T& to) const |
452 | | { |
453 | | convertSignedToUnsigned(from, to); |
454 | | } |
455 | | |
456 | | template <typename F, typename T, |
457 | | std::enable_if_t<std::is_integral_v<F>, bool> = true, |
458 | | std::enable_if_t<std::is_floating_point_v<T>, bool> = true> |
459 | | static void convertToFP(F& from, T& to) |
460 | | /// Converts unsigned integral data types to floating-point data types. |
461 | | /// If the number of significant digits used for the integer vaue exceeds the number |
462 | | /// of available digits in the floatinng-point destination (ie. if precision would be lost |
463 | | /// by casting the value), RangeException is thrown. |
464 | 0 | { |
465 | 0 | if (isPrecisionLost<F, T>(from)) |
466 | 0 | POCO_VAR_RANGE_EXCEPTION ("Lost precision", from); |
467 | 0 | to = static_cast<T>(from); |
468 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKafTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKadTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKsfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKsdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKifTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKidTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKlfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKldTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKhfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKhdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKtfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKtdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKjfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKjdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKmfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder11convertToFPIKmdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEvRS6_RS9_ |
469 | | |
470 | | private: |
471 | | |
472 | | template <typename T> |
473 | | static constexpr T unpreserveSign(const T& value) |
474 | 0 | { |
475 | | if constexpr (std::is_signed_v<T>) |
476 | 0 | { |
477 | 0 | return (value < 0) ? -value : value; |
478 | | } |
479 | | else |
480 | 0 | { |
481 | 0 | return value; |
482 | 0 | } |
483 | 0 | } Unexecuted instantiation: long Poco::Dynamic::VarHolder::unpreserveSign<long>(long const&) Unexecuted instantiation: signed char Poco::Dynamic::VarHolder::unpreserveSign<signed char>(signed char const&) Unexecuted instantiation: unsigned char Poco::Dynamic::VarHolder::unpreserveSign<unsigned char>(unsigned char const&) Unexecuted instantiation: unsigned short Poco::Dynamic::VarHolder::unpreserveSign<unsigned short>(unsigned short const&) Unexecuted instantiation: unsigned int Poco::Dynamic::VarHolder::unpreserveSign<unsigned int>(unsigned int const&) Unexecuted instantiation: unsigned long Poco::Dynamic::VarHolder::unpreserveSign<unsigned long>(unsigned long const&) Unexecuted instantiation: unsigned long long Poco::Dynamic::VarHolder::unpreserveSign<unsigned long long>(unsigned long long const&) Unexecuted instantiation: short Poco::Dynamic::VarHolder::unpreserveSign<short>(short const&) Unexecuted instantiation: int Poco::Dynamic::VarHolder::unpreserveSign<int>(int const&) Unexecuted instantiation: long long Poco::Dynamic::VarHolder::unpreserveSign<long long>(long long const&) |
484 | | |
485 | | template <typename T, std::enable_if_t<std::is_same_v<T, bool>, bool> = true> |
486 | | static constexpr int numValDigits(const T& value) |
487 | | { |
488 | | return 1; |
489 | | } |
490 | | |
491 | | template <typename T, std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>, bool> = true> |
492 | | static constexpr int numValDigits(const T& value) |
493 | 0 | { |
494 | 0 | using U = std::make_unsigned_t<T>; |
495 | 0 | if (value == 0) return 0; |
496 | 0 | int digitCount = 0; |
497 | 0 | U locVal = static_cast<U>(unpreserveSign(value)); // to prevent sign preservation |
498 | 0 | while (locVal >>= 1) ++digitCount; |
499 | 0 | return digitCount; |
500 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIlTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIaTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIhTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsItTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIjTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsImTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIyTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIsTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIiTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIxTnNSt3__19enable_ifIXaasr3stdE13is_integral_vIT_Entsr3stdE9is_same_vIS5_bEEbE4typeELb1EEEiRKS5_ |
501 | | |
502 | | template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true> |
503 | | static constexpr int numValDigits(T value) |
504 | 0 | { |
505 | 0 | return numValDigits<int64_t>(static_cast<int64_t>(value)); |
506 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIfTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEiS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder12numValDigitsIdTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEiS5_ |
507 | | |
508 | | template <typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true> |
509 | | static constexpr int numTypeDigits() |
510 | 0 | { |
511 | 0 | return std::numeric_limits<T>::digits; |
512 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIfTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIdTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEiv |
513 | | |
514 | | template <typename T, std::enable_if_t<std::is_integral_v<T>, bool> = true> |
515 | | static constexpr int numTypeDigits() |
516 | 0 | { |
517 | 0 | return numValDigits(std::numeric_limits<T>::max()); |
518 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIhTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsItTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIjTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsImTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIyTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIlTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder13numTypeDigitsIxTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEiv |
519 | | |
520 | | template <typename F, typename T, |
521 | | std::enable_if_t<std::is_integral_v<F>, bool> = true, |
522 | | std::enable_if_t<std::is_floating_point_v<T>, bool> = true> |
523 | | static bool isPrecisionLost(const F& from) |
524 | | // Checks for loss of precision in integral -> floating point conversion. |
525 | 0 | { |
526 | 0 | return numValDigits(from) > numTypeDigits<T>(); |
527 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKafTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKadTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKsfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKsdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKifTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKidTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKlfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKldTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKhfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKhdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKtfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKtdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKjfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKjdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKmfTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15isPrecisionLostIKmdTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1ETnNS5_IXsr3stdE19is_floating_point_vIT0_EEbE4typeELb1EEEbRKS6_ |
528 | | |
529 | | template <typename F, typename T, std::enable_if_t<std::is_integral_v<F>, bool> = true> |
530 | | static void checkUpperLimit(const F& from) |
531 | 0 | { |
532 | 0 | if (from > static_cast<F>(std::numeric_limits<T>::max())) |
533 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too big", from); |
534 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhhTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhtTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhjTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhmTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhyTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIsaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIthTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIttTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitItjTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitItmTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitItyTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIiaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIisTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjhTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjtTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjjTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjmTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjyTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIlaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIlsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIliTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImhTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImtTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImjTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImmTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImyTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIhsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitItaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitItsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitItiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjlTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIjxTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImlTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitImxTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIxaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIxsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIxiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIyhTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIytTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIyjTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIymTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIyyTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIyaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIysTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIyiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIylTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIyxTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ |
535 | | |
536 | | template <typename F, typename T, std::enable_if_t<std::is_integral_v<F>, bool> = true> |
537 | | static void checkLowerLimit(const F& from) |
538 | 0 | { |
539 | 0 | if (from < static_cast<F>(std::numeric_limits<T>::min())) |
540 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too small", from); |
541 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIsaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIiaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIisTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIlaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIlsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIliTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIxaTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIxsTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIxiTnNSt3__19enable_ifIXsr3stdE13is_integral_vIT_EEbE4typeELb1EEEvRKS5_ |
542 | | |
543 | | template <typename F, typename T, std::enable_if_t<std::is_floating_point_v<F>, bool> = true> |
544 | | static void checkUpperLimit(const F& from) |
545 | 0 | { |
546 | 0 | if ((from > static_cast<F>(std::numeric_limits<T>::max()))) |
547 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too big", from); |
548 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfaTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfsTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfiTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIflTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfhTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIftTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfjTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfmTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfxTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIfyTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdaTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdsTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdiTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdlTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdhTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdtTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdjTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdmTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdxTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdyTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkUpperLimitIdfTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ |
549 | | |
550 | | template <typename F, typename T, std::enable_if_t<std::is_floating_point_v<F>, bool> = true> |
551 | | static void checkLowerLimit(const F& from) |
552 | 0 | { |
553 | | if constexpr(std::is_floating_point_v<T>) |
554 | 0 | { |
555 | 0 | if (static_cast<F>(-std::numeric_limits<T>::max()) > from) |
556 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too small", from); |
557 | | } |
558 | 0 | else if (from < static_cast<F>(std::numeric_limits<T>::min())) |
559 | 0 | POCO_VAR_RANGE_EXCEPTION ("Value too small", from); |
560 | 0 | } Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIfaTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIfsTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIfiTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIflTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIfxTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIdaTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIdsTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIdiTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIdlTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIdxTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ Unexecuted instantiation: _ZN4Poco7Dynamic9VarHolder15checkLowerLimitIdfTnNSt3__19enable_ifIXsr3stdE19is_floating_point_vIT_EEbE4typeELb1EEEvRKS5_ |
561 | | }; |
562 | | |
563 | | |
564 | | // |
565 | | // inlines |
566 | | // |
567 | | |
568 | | |
569 | | inline void VarHolder::convert(Int8& /*val*/) const |
570 | 0 | { |
571 | 0 | throw BadCastException("Can not convert to Int8"); |
572 | 0 | } |
573 | | |
574 | | |
575 | | inline void VarHolder::convert(Int16& /*val*/) const |
576 | 0 | { |
577 | 0 | throw BadCastException("Can not convert to Int16"); |
578 | 0 | } |
579 | | |
580 | | |
581 | | inline void VarHolder::convert(Int32& /*val*/) const |
582 | 0 | { |
583 | 0 | throw BadCastException("Can not convert to Int32"); |
584 | 0 | } |
585 | | |
586 | | |
587 | | inline void VarHolder::convert(Int64& /*val*/) const |
588 | 0 | { |
589 | 0 | throw BadCastException("Can not convert to Int64"); |
590 | 0 | } |
591 | | |
592 | | |
593 | | inline void VarHolder::convert(UInt8& /*val*/) const |
594 | 0 | { |
595 | 0 | throw BadCastException("Can not convert to UInt8"); |
596 | 0 | } |
597 | | |
598 | | |
599 | | inline void VarHolder::convert(UInt16& /*val*/) const |
600 | 0 | { |
601 | 0 | throw BadCastException("Can not convert to UInt16"); |
602 | 0 | } |
603 | | |
604 | | |
605 | | inline void VarHolder::convert(UInt32& /*val*/) const |
606 | 0 | { |
607 | 0 | throw BadCastException("Can not convert to UInt32"); |
608 | 0 | } |
609 | | |
610 | | |
611 | | inline void VarHolder::convert(UInt64& /*val*/) const |
612 | 0 | { |
613 | 0 | throw BadCastException("Can not convert to UInt64"); |
614 | 0 | } |
615 | | |
616 | | |
617 | | inline void VarHolder::convert(DateTime& /*val*/) const |
618 | 0 | { |
619 | 0 | throw BadCastException("Can not convert to DateTime"); |
620 | 0 | } |
621 | | |
622 | | |
623 | | inline void VarHolder::convert(LocalDateTime& /*val*/) const |
624 | 0 | { |
625 | 0 | throw BadCastException("Can not convert to LocalDateTime"); |
626 | 0 | } |
627 | | |
628 | | |
629 | | inline void VarHolder::convert(Timestamp& /*val*/) const |
630 | 0 | { |
631 | 0 | throw BadCastException("Can not convert to Timestamp"); |
632 | 0 | } |
633 | | |
634 | | |
635 | | inline void VarHolder::convert(UUID& /*val*/) const |
636 | 0 | { |
637 | 0 | throw BadCastException("Can not convert to UUID"); |
638 | 0 | } |
639 | | |
640 | | |
641 | | #ifndef POCO_INT64_IS_LONG |
642 | | |
643 | | |
644 | | inline void VarHolder::convert(long& val) const |
645 | | { |
646 | | Int32 tmp; |
647 | | convert(tmp); |
648 | | val = tmp; |
649 | | } |
650 | | |
651 | | |
652 | | inline void VarHolder::convert(unsigned long& val) const |
653 | | { |
654 | | UInt32 tmp; |
655 | | convert(tmp); |
656 | | val = tmp; |
657 | | } |
658 | | |
659 | | |
660 | | #else |
661 | | |
662 | | |
663 | | inline void VarHolder::convert(long long& /*val*/) const |
664 | 0 | { |
665 | 0 | throw BadCastException("Can not convert to long long"); |
666 | 0 | } |
667 | | |
668 | | |
669 | | inline void VarHolder::convert(unsigned long long& /*val*/) const |
670 | 0 | { |
671 | 0 | throw BadCastException("Can not convert to unsigned long long"); |
672 | 0 | } |
673 | | |
674 | | |
675 | | #endif |
676 | | |
677 | | |
678 | | inline void VarHolder::convert(bool& /*val*/) const |
679 | 0 | { |
680 | 0 | throw BadCastException("Can not convert to bool"); |
681 | 0 | } |
682 | | |
683 | | |
684 | | inline void VarHolder::convert(float& /*val*/) const |
685 | 0 | { |
686 | 0 | throw BadCastException("Can not convert to float"); |
687 | 0 | } |
688 | | |
689 | | |
690 | | inline void VarHolder::convert(double& /*val*/) const |
691 | 0 | { |
692 | 0 | throw BadCastException("Can not convert to double"); |
693 | 0 | } |
694 | | |
695 | | |
696 | | inline void VarHolder::convert(char& /*val*/) const |
697 | 0 | { |
698 | 0 | throw BadCastException("Can not convert to char"); |
699 | 0 | } |
700 | | |
701 | | |
702 | | inline void VarHolder::convert(std::string& /*val*/) const |
703 | 0 | { |
704 | 0 | throw BadCastException("Can not convert to std::string"); |
705 | 0 | } |
706 | | |
707 | | |
708 | | inline void VarHolder::convert(Poco::UTF16String& /*val*/) const |
709 | 0 | { |
710 | 0 | throw BadCastException("Can not convert to Poco::UTF16String"); |
711 | 0 | } |
712 | | |
713 | | |
714 | | inline bool VarHolder::isArray() const |
715 | 0 | { |
716 | 0 | return true; |
717 | 0 | } |
718 | | |
719 | | |
720 | | inline bool VarHolder::isVector() const |
721 | 0 | { |
722 | 0 | return false; |
723 | 0 | } |
724 | | |
725 | | |
726 | | inline bool VarHolder::isList() const |
727 | 0 | { |
728 | 0 | return false; |
729 | 0 | } |
730 | | |
731 | | |
732 | | inline bool VarHolder::isDeque() const |
733 | 0 | { |
734 | 0 | return false; |
735 | 0 | } |
736 | | |
737 | | |
738 | | inline bool VarHolder::isStruct() const |
739 | 0 | { |
740 | 0 | return false; |
741 | 0 | } |
742 | | |
743 | | |
744 | | inline bool VarHolder::isOrdered() const |
745 | 0 | { |
746 | 0 | return false; |
747 | 0 | } |
748 | | |
749 | | |
750 | | inline bool VarHolder::isInteger() const |
751 | 0 | { |
752 | 0 | return false; |
753 | 0 | } |
754 | | |
755 | | |
756 | | inline bool VarHolder::isSigned() const |
757 | 0 | { |
758 | 0 | return false; |
759 | 0 | } |
760 | | |
761 | | |
762 | | inline bool VarHolder::isNumeric() const |
763 | 0 | { |
764 | 0 | return false; |
765 | 0 | } |
766 | | |
767 | | |
768 | | inline bool VarHolder::isBoolean() const |
769 | 0 | { |
770 | 0 | return false; |
771 | 0 | } |
772 | | |
773 | | |
774 | | inline bool VarHolder::isString() const |
775 | 0 | { |
776 | 0 | return false; |
777 | 0 | } |
778 | | |
779 | | |
780 | | inline bool VarHolder::isDate() const |
781 | 0 | { |
782 | 0 | return false; |
783 | 0 | } |
784 | | |
785 | | |
786 | | inline bool VarHolder::isTime() const |
787 | 0 | { |
788 | 0 | return false; |
789 | 0 | } |
790 | | |
791 | | |
792 | | inline bool VarHolder::isDateTime() const |
793 | 0 | { |
794 | 0 | return false; |
795 | 0 | } |
796 | | |
797 | | |
798 | | inline bool VarHolder::isUUID() const |
799 | 0 | { |
800 | 0 | return false; |
801 | 0 | } |
802 | | |
803 | | |
804 | | inline std::size_t VarHolder::size() const |
805 | 0 | { |
806 | 0 | return 1u; |
807 | 0 | } |
808 | | |
809 | | |
810 | | template <typename T> |
811 | | class VarHolderImpl: public VarHolder |
812 | | /// Template based implementation of a VarHolder. |
813 | | /// This class provides type storage for user-defined types |
814 | | /// that do not have VarHolderImpl specialization. |
815 | | /// |
816 | | /// The actual conversion work happens in the template specializations |
817 | | /// of this class. |
818 | | /// |
819 | | /// VarHolderImpl throws following exceptions: |
820 | | /// BadCastException (if the requested conversion is not implemented) |
821 | | /// RangeException (if an attempt is made to assign a numeric value outside of the target min/max limits |
822 | | /// SyntaxException (if an attempt is made to convert a string containing non-numeric characters to number) |
823 | | /// |
824 | | /// In order to support efficient direct extraction of the held value, |
825 | | /// all specializations must additionally implement a public member function: |
826 | | /// |
827 | | /// const T& value() const |
828 | | /// |
829 | | /// returning a const reference to the actual stored value. |
830 | | { |
831 | | public: |
832 | | VarHolderImpl(const T& val): _val(val) |
833 | | { |
834 | | } |
835 | | |
836 | | ~VarHolderImpl() override = default; |
837 | | |
838 | | VarHolderImpl() = delete; |
839 | | VarHolderImpl(const VarHolderImpl&) = delete; |
840 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
841 | | |
842 | | const std::type_info& type() const override |
843 | | { |
844 | | return typeid(T); |
845 | | } |
846 | | |
847 | | void convert(Int8& val) const override |
848 | | { |
849 | | if constexpr (std::is_enum_v<T>) |
850 | | { |
851 | | convertToSigned(std::underlying_type_t<T>(_val), val); |
852 | | } |
853 | | else |
854 | | { |
855 | | VarHolder::convert(val); |
856 | | } |
857 | | } |
858 | | |
859 | | void convert(Int16& val) const override |
860 | | { |
861 | | if constexpr (std::is_enum_v<T>) |
862 | | { |
863 | | convertToSigned(std::underlying_type_t<T>(_val), val); |
864 | | } |
865 | | else |
866 | | { |
867 | | VarHolder::convert(val); |
868 | | } |
869 | | } |
870 | | |
871 | | void convert(Int32& val) const override |
872 | | { |
873 | | if constexpr (std::is_enum_v<T>) |
874 | | { |
875 | | convertToSigned(std::underlying_type_t<T>(_val), val); |
876 | | } |
877 | | else |
878 | | { |
879 | | VarHolder::convert(val); |
880 | | } |
881 | | } |
882 | | |
883 | | void convert(Int64& val) const override |
884 | | { |
885 | | if constexpr (std::is_enum_v<T>) |
886 | | { |
887 | | convertToSigned(std::underlying_type_t<T>(_val), val); |
888 | | } |
889 | | else |
890 | | { |
891 | | VarHolder::convert(val); |
892 | | } |
893 | | } |
894 | | |
895 | | void convert(UInt8& val) const override |
896 | | { |
897 | | if constexpr (std::is_enum_v<T>) |
898 | | { |
899 | | convertToUnsigned(std::underlying_type_t<T>(_val), val); |
900 | | } |
901 | | else |
902 | | { |
903 | | VarHolder::convert(val); |
904 | | } |
905 | | } |
906 | | |
907 | | void convert(UInt16& val) const override |
908 | | { |
909 | | if constexpr (std::is_enum_v<T>) |
910 | | { |
911 | | convertToUnsigned(std::underlying_type_t<T>(_val), val); |
912 | | } |
913 | | else |
914 | | { |
915 | | VarHolder::convert(val); |
916 | | } |
917 | | } |
918 | | |
919 | | void convert(UInt32& val) const override |
920 | | { |
921 | | if constexpr (std::is_enum_v<T>) |
922 | | { |
923 | | convertToUnsigned(std::underlying_type_t<T>(_val), val); |
924 | | } |
925 | | else |
926 | | { |
927 | | VarHolder::convert(val); |
928 | | } |
929 | | } |
930 | | |
931 | | void convert(UInt64& val) const override |
932 | | { |
933 | | if constexpr (std::is_enum_v<T>) |
934 | | { |
935 | | convertToUnsigned(std::underlying_type_t<T>(_val), val); |
936 | | } |
937 | | else |
938 | | { |
939 | | VarHolder::convert(val); |
940 | | } |
941 | | } |
942 | | |
943 | | #ifdef POCO_INT64_IS_LONG |
944 | | |
945 | | void convert(long long& val) const override |
946 | | { |
947 | | if constexpr (std::is_enum_v<T>) |
948 | | { |
949 | | convertToSigned(std::underlying_type_t<T>(_val), val); |
950 | | } |
951 | | else |
952 | | { |
953 | | VarHolder::convert(val); |
954 | | } |
955 | | } |
956 | | |
957 | | void convert(unsigned long long& val) const override |
958 | | { |
959 | | if constexpr (std::is_enum_v<T>) |
960 | | { |
961 | | convertToUnsigned(std::underlying_type_t<T>(_val), val); |
962 | | } |
963 | | else |
964 | | { |
965 | | VarHolder::convert(val); |
966 | | } |
967 | | } |
968 | | |
969 | | #endif |
970 | | |
971 | | void convert(bool& val) const override |
972 | | { |
973 | | if constexpr (std::is_enum_v<T>) |
974 | | { |
975 | | val = (std::underlying_type_t<T>(_val) != 0); |
976 | | } |
977 | | else |
978 | | { |
979 | | VarHolder::convert(val); |
980 | | } |
981 | | } |
982 | | |
983 | | void convert(float& val) const override |
984 | | { |
985 | | if constexpr (std::is_enum_v<T>) |
986 | | { |
987 | | val = static_cast<float>(_val); |
988 | | } |
989 | | else |
990 | | { |
991 | | VarHolder::convert(val); |
992 | | } |
993 | | } |
994 | | |
995 | | void convert(double& val) const override |
996 | | { |
997 | | if constexpr (std::is_enum_v<T>) |
998 | | { |
999 | | val = static_cast<double>(_val); |
1000 | | } |
1001 | | else |
1002 | | { |
1003 | | VarHolder::convert(val); |
1004 | | } |
1005 | | } |
1006 | | |
1007 | | void convert(char& val) const override |
1008 | | { |
1009 | | if constexpr (std::is_enum_v<T>) |
1010 | | { |
1011 | | val = static_cast<char>(_val); |
1012 | | } |
1013 | | else |
1014 | | { |
1015 | | VarHolder::convert(val); |
1016 | | } |
1017 | | } |
1018 | | |
1019 | | void convert(std::string& val) const override |
1020 | | { |
1021 | | if constexpr (std::is_enum_v<T>) |
1022 | | { |
1023 | | val = NumberFormatter::format(std::underlying_type_t<T>(_val)); |
1024 | | } |
1025 | | else |
1026 | | { |
1027 | | VarHolder::convert(val); |
1028 | | } |
1029 | | } |
1030 | | |
1031 | | void convert(Poco::UTF16String& val) const override |
1032 | | { |
1033 | | if constexpr (std::is_enum_v<T>) |
1034 | | { |
1035 | | std::string str = NumberFormatter::format(std::underlying_type_t<T>(_val)); |
1036 | | Poco::UnicodeConverter::convert(str, val); |
1037 | | } |
1038 | | else |
1039 | | { |
1040 | | VarHolder::convert(val); |
1041 | | } |
1042 | | } |
1043 | | |
1044 | | bool isArray() const override |
1045 | | { |
1046 | | if constexpr (std::is_enum_v<T>) |
1047 | | { |
1048 | | return false; |
1049 | | } |
1050 | | else |
1051 | | { |
1052 | | return VarHolder::isArray(); |
1053 | | } |
1054 | | } |
1055 | | |
1056 | | bool isStruct() const override |
1057 | | { |
1058 | | if constexpr (std::is_enum_v<T>) |
1059 | | { |
1060 | | return false; |
1061 | | } |
1062 | | else |
1063 | | { |
1064 | | return VarHolder::isStruct(); |
1065 | | } |
1066 | | } |
1067 | | |
1068 | | bool isInteger() const override |
1069 | | { |
1070 | | if constexpr (std::is_enum_v<T>) |
1071 | | { |
1072 | | return std::numeric_limits<std::underlying_type_t<T>>::is_integer; |
1073 | | } |
1074 | | else |
1075 | | { |
1076 | | return VarHolder::isInteger(); |
1077 | | } |
1078 | | } |
1079 | | |
1080 | | bool isSigned() const override |
1081 | | { |
1082 | | if constexpr (std::is_enum_v<T>) |
1083 | | { |
1084 | | return std::numeric_limits<std::underlying_type_t<T>>::is_signed; |
1085 | | } |
1086 | | else |
1087 | | { |
1088 | | return VarHolder::isSigned(); |
1089 | | } |
1090 | | } |
1091 | | |
1092 | | bool isNumeric() const override |
1093 | | { |
1094 | | if constexpr (std::is_enum_v<T>) |
1095 | | { |
1096 | | return std::numeric_limits<std::underlying_type_t<T>>::is_specialized; |
1097 | | } |
1098 | | else |
1099 | | { |
1100 | | return VarHolder::isNumeric(); |
1101 | | } |
1102 | | } |
1103 | | |
1104 | | bool isBoolean() const override |
1105 | | { |
1106 | | if constexpr (std::is_enum_v<T>) |
1107 | | { |
1108 | | return false; |
1109 | | } |
1110 | | else |
1111 | | { |
1112 | | return VarHolder::isBoolean(); |
1113 | | } |
1114 | | } |
1115 | | |
1116 | | bool isString() const override |
1117 | | { |
1118 | | if constexpr (std::is_enum_v<T>) |
1119 | | { |
1120 | | return false; |
1121 | | } |
1122 | | else |
1123 | | { |
1124 | | return VarHolder::isString(); |
1125 | | } |
1126 | | } |
1127 | | |
1128 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
1129 | | { |
1130 | | return cloneHolder(pVarHolder, _val); |
1131 | | } |
1132 | | |
1133 | | const T& value() const |
1134 | | { |
1135 | | return _val; |
1136 | | } |
1137 | | |
1138 | | private: |
1139 | | T _val; |
1140 | | }; |
1141 | | |
1142 | | |
1143 | | template <> |
1144 | | class VarHolderImpl<Int8>: public VarHolder |
1145 | | { |
1146 | | public: |
1147 | | VarHolderImpl(Int8 val): _val(val) |
1148 | 0 | { |
1149 | 0 | } |
1150 | | |
1151 | | ~VarHolderImpl() override = default; |
1152 | | |
1153 | | VarHolderImpl() = delete; |
1154 | | VarHolderImpl(const VarHolderImpl&) = delete; |
1155 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
1156 | | |
1157 | | const std::type_info& type() const override |
1158 | 0 | { |
1159 | 0 | return typeid(Int8); |
1160 | 0 | } |
1161 | | |
1162 | | void convert(Int8& val) const override |
1163 | 0 | { |
1164 | 0 | val = _val; |
1165 | 0 | } |
1166 | | |
1167 | | void convert(Int16& val) const override |
1168 | 0 | { |
1169 | 0 | val = _val; |
1170 | 0 | } |
1171 | | |
1172 | | void convert(Int32& val) const override |
1173 | 0 | { |
1174 | 0 | val = _val; |
1175 | 0 | } |
1176 | | |
1177 | | void convert(Int64& val) const override |
1178 | 0 | { |
1179 | 0 | val = _val; |
1180 | 0 | } |
1181 | | |
1182 | | void convert(UInt8& val) const override |
1183 | 0 | { |
1184 | 0 | convertSignedToUnsigned(_val, val); |
1185 | 0 | } |
1186 | | |
1187 | | void convert(UInt16& val) const override |
1188 | 0 | { |
1189 | 0 | convertSignedToUnsigned(_val, val); |
1190 | 0 | } |
1191 | | |
1192 | | void convert(UInt32& val) const override |
1193 | 0 | { |
1194 | 0 | convertSignedToUnsigned(_val, val); |
1195 | 0 | } |
1196 | | |
1197 | | void convert(UInt64& val) const override |
1198 | 0 | { |
1199 | 0 | convertSignedToUnsigned(_val, val); |
1200 | 0 | } |
1201 | | |
1202 | | #ifdef POCO_INT64_IS_LONG |
1203 | | |
1204 | | void convert(long long& val) const override |
1205 | 0 | { |
1206 | 0 | val = _val; |
1207 | 0 | } |
1208 | | |
1209 | | void convert(unsigned long long& val) const override |
1210 | 0 | { |
1211 | 0 | convertSignedToUnsigned(_val, val); |
1212 | 0 | } |
1213 | | |
1214 | | #endif |
1215 | | |
1216 | | void convert(bool& val) const override |
1217 | 0 | { |
1218 | 0 | val = (_val != 0); |
1219 | 0 | } |
1220 | | |
1221 | | void convert(float& val) const override |
1222 | 0 | { |
1223 | 0 | convertToFP(_val, val); |
1224 | 0 | } |
1225 | | |
1226 | | void convert(double& val) const override |
1227 | 0 | { |
1228 | 0 | convertToFP(_val, val); |
1229 | 0 | } |
1230 | | |
1231 | | void convert(char& val) const override |
1232 | 0 | { |
1233 | 0 | val = static_cast<char>(_val); |
1234 | 0 | } |
1235 | | |
1236 | | void convert(std::string& val) const override |
1237 | 0 | { |
1238 | 0 | val = NumberFormatter::format(_val); |
1239 | 0 | } |
1240 | | |
1241 | | void convert(Poco::UTF16String& val) const override |
1242 | 0 | { |
1243 | 0 | const std::string str = NumberFormatter::format(_val); |
1244 | 0 | Poco::UnicodeConverter::convert(str, val); |
1245 | 0 | } |
1246 | | |
1247 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
1248 | 0 | { |
1249 | 0 | return cloneHolder(pVarHolder, _val); |
1250 | 0 | } |
1251 | | |
1252 | | const Int8& value() const |
1253 | 0 | { |
1254 | 0 | return _val; |
1255 | 0 | } |
1256 | | |
1257 | | bool isArray() const override |
1258 | 0 | { |
1259 | 0 | return false; |
1260 | 0 | } |
1261 | | |
1262 | | bool isStruct() const override |
1263 | 0 | { |
1264 | 0 | return false; |
1265 | 0 | } |
1266 | | |
1267 | | bool isInteger() const override |
1268 | 0 | { |
1269 | 0 | return std::numeric_limits<Int8>::is_integer; |
1270 | 0 | } |
1271 | | |
1272 | | bool isSigned() const override |
1273 | 0 | { |
1274 | 0 | return std::numeric_limits<Int8>::is_signed; |
1275 | 0 | } |
1276 | | |
1277 | | bool isNumeric() const override |
1278 | 0 | { |
1279 | 0 | return std::numeric_limits<Int8>::is_specialized; |
1280 | 0 | } |
1281 | | |
1282 | | bool isBoolean() const override |
1283 | 0 | { |
1284 | 0 | return false; |
1285 | 0 | } |
1286 | | |
1287 | | bool isString() const override |
1288 | 0 | { |
1289 | 0 | return false; |
1290 | 0 | } |
1291 | | |
1292 | | private: |
1293 | | Int8 _val; |
1294 | | }; |
1295 | | |
1296 | | |
1297 | | template <> |
1298 | | class VarHolderImpl<Int16>: public VarHolder |
1299 | | { |
1300 | | public: |
1301 | | VarHolderImpl(Int16 val): _val(val) |
1302 | 0 | { |
1303 | 0 | } |
1304 | | |
1305 | | ~VarHolderImpl() override = default; |
1306 | | |
1307 | | VarHolderImpl() = delete; |
1308 | | VarHolderImpl(const VarHolderImpl&) = delete; |
1309 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
1310 | | |
1311 | | const std::type_info& type() const override |
1312 | 0 | { |
1313 | 0 | return typeid(Int16); |
1314 | 0 | } |
1315 | | |
1316 | | void convert(Int8& val) const override |
1317 | 0 | { |
1318 | 0 | convertToSmaller(_val, val); |
1319 | 0 | } |
1320 | | |
1321 | | void convert(Int16& val) const override |
1322 | 0 | { |
1323 | 0 | val = _val; |
1324 | 0 | } |
1325 | | |
1326 | | void convert(Int32& val) const override |
1327 | 0 | { |
1328 | 0 | val = _val; |
1329 | 0 | } |
1330 | | |
1331 | | void convert(Int64& val) const override |
1332 | 0 | { |
1333 | 0 | val = _val; |
1334 | 0 | } |
1335 | | |
1336 | | void convert(UInt8& val) const override |
1337 | 0 | { |
1338 | 0 | convertSignedToUnsigned(_val, val); |
1339 | 0 | } |
1340 | | |
1341 | | void convert(UInt16& val) const override |
1342 | 0 | { |
1343 | 0 | convertSignedToUnsigned(_val, val); |
1344 | 0 | } |
1345 | | |
1346 | | void convert(UInt32& val) const override |
1347 | 0 | { |
1348 | 0 | convertSignedToUnsigned(_val, val); |
1349 | 0 | } |
1350 | | |
1351 | | void convert(UInt64& val) const override |
1352 | 0 | { |
1353 | 0 | convertSignedToUnsigned(_val, val); |
1354 | 0 | } |
1355 | | |
1356 | | #ifdef POCO_INT64_IS_LONG |
1357 | | |
1358 | | void convert(long long& val) const override |
1359 | 0 | { |
1360 | 0 | val = _val; |
1361 | 0 | } |
1362 | | |
1363 | | void convert(unsigned long long& val) const override |
1364 | 0 | { |
1365 | 0 | convertSignedToUnsigned(_val, val); |
1366 | 0 | } |
1367 | | |
1368 | | #endif |
1369 | | |
1370 | | void convert(bool& val) const override |
1371 | 0 | { |
1372 | 0 | val = (_val != 0); |
1373 | 0 | } |
1374 | | |
1375 | | void convert(float& val) const override |
1376 | 0 | { |
1377 | 0 | convertToFP(_val, val); |
1378 | 0 | } |
1379 | | |
1380 | | void convert(double& val) const override |
1381 | 0 | { |
1382 | 0 | convertToFP(_val, val); |
1383 | 0 | } |
1384 | | |
1385 | | void convert(char& val) const override |
1386 | 0 | { |
1387 | 0 | UInt8 tmp; |
1388 | 0 | convert(tmp); |
1389 | 0 | val = static_cast<char>(tmp); |
1390 | 0 | } |
1391 | | |
1392 | | void convert(std::string& val) const override |
1393 | 0 | { |
1394 | 0 | val = NumberFormatter::format(_val); |
1395 | 0 | } |
1396 | | |
1397 | | void convert(Poco::UTF16String& val) const override |
1398 | 0 | { |
1399 | 0 | const std::string str = NumberFormatter::format(_val); |
1400 | 0 | Poco::UnicodeConverter::convert(str, val); |
1401 | 0 | } |
1402 | | |
1403 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
1404 | 0 | { |
1405 | 0 | return cloneHolder(pVarHolder, _val); |
1406 | 0 | } |
1407 | | |
1408 | | const Int16& value() const |
1409 | 0 | { |
1410 | 0 | return _val; |
1411 | 0 | } |
1412 | | |
1413 | | bool isArray() const override |
1414 | 0 | { |
1415 | 0 | return false; |
1416 | 0 | } |
1417 | | |
1418 | | bool isStruct() const override |
1419 | 0 | { |
1420 | 0 | return false; |
1421 | 0 | } |
1422 | | |
1423 | | bool isInteger() const override |
1424 | 0 | { |
1425 | 0 | return std::numeric_limits<Int16>::is_integer; |
1426 | 0 | } |
1427 | | |
1428 | | bool isSigned() const override |
1429 | 0 | { |
1430 | 0 | return std::numeric_limits<Int16>::is_signed; |
1431 | 0 | } |
1432 | | |
1433 | | bool isNumeric() const override |
1434 | 0 | { |
1435 | 0 | return std::numeric_limits<Int16>::is_specialized; |
1436 | 0 | } |
1437 | | |
1438 | | bool isString() const override |
1439 | 0 | { |
1440 | 0 | return false; |
1441 | 0 | } |
1442 | | |
1443 | | private: |
1444 | | Int16 _val; |
1445 | | }; |
1446 | | |
1447 | | |
1448 | | template <> |
1449 | | class VarHolderImpl<Int32>: public VarHolder |
1450 | | { |
1451 | | public: |
1452 | 0 | VarHolderImpl(Int32 val): _val(val) |
1453 | 0 | { |
1454 | 0 | } |
1455 | | |
1456 | | ~VarHolderImpl() override = default; |
1457 | | |
1458 | | VarHolderImpl() = delete; |
1459 | | VarHolderImpl(const VarHolderImpl&) = delete; |
1460 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
1461 | | |
1462 | | const std::type_info& type() const override |
1463 | 0 | { |
1464 | 0 | return typeid(Int32); |
1465 | 0 | } |
1466 | | |
1467 | | void convert(Int8& val) const override |
1468 | 0 | { |
1469 | 0 | convertToSmaller(_val, val); |
1470 | 0 | } |
1471 | | |
1472 | | void convert(Int16& val) const override |
1473 | 0 | { |
1474 | 0 | convertToSmaller(_val, val); |
1475 | 0 | } |
1476 | | |
1477 | | void convert(Int32& val) const override |
1478 | 0 | { |
1479 | 0 | val = _val; |
1480 | 0 | } |
1481 | | |
1482 | | void convert(Int64& val) const override |
1483 | 0 | { |
1484 | 0 | val = _val; |
1485 | 0 | } |
1486 | | |
1487 | | void convert(UInt8& val) const override |
1488 | 0 | { |
1489 | 0 | convertSignedToUnsigned(_val, val); |
1490 | 0 | } |
1491 | | |
1492 | | void convert(UInt16& val) const override |
1493 | 0 | { |
1494 | 0 | convertSignedToUnsigned(_val, val); |
1495 | 0 | } |
1496 | | |
1497 | | void convert(UInt32& val) const override |
1498 | 0 | { |
1499 | 0 | convertSignedToUnsigned(_val, val); |
1500 | 0 | } |
1501 | | |
1502 | | void convert(UInt64& val) const override |
1503 | 0 | { |
1504 | 0 | convertSignedToUnsigned(_val, val); |
1505 | 0 | } |
1506 | | |
1507 | | #ifdef POCO_INT64_IS_LONG |
1508 | | |
1509 | | void convert(long long& val) const override |
1510 | 0 | { |
1511 | 0 | val = _val; |
1512 | 0 | } |
1513 | | |
1514 | | void convert(unsigned long long& val) const override |
1515 | 0 | { |
1516 | 0 | convertSignedToUnsigned(_val, val); |
1517 | 0 | } |
1518 | | |
1519 | | #endif |
1520 | | |
1521 | | void convert(bool& val) const override |
1522 | 0 | { |
1523 | 0 | val = (_val != 0); |
1524 | 0 | } |
1525 | | |
1526 | | void convert(float& val) const override |
1527 | 0 | { |
1528 | 0 | convertToFP(_val, val); |
1529 | 0 | } |
1530 | | |
1531 | | void convert(double& val) const override |
1532 | 0 | { |
1533 | 0 | convertToFP(_val, val); |
1534 | 0 | } |
1535 | | |
1536 | | void convert(char& val) const override |
1537 | 0 | { |
1538 | 0 | UInt8 tmp; |
1539 | 0 | convert(tmp); |
1540 | 0 | val = static_cast<char>(tmp); |
1541 | 0 | } |
1542 | | |
1543 | | void convert(std::string& val) const override |
1544 | 0 | { |
1545 | 0 | val = NumberFormatter::format(_val); |
1546 | 0 | } |
1547 | | |
1548 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
1549 | 0 | { |
1550 | 0 | return cloneHolder(pVarHolder, _val); |
1551 | 0 | } |
1552 | | |
1553 | | const Int32& value() const |
1554 | 0 | { |
1555 | 0 | return _val; |
1556 | 0 | } |
1557 | | |
1558 | | bool isArray() const override |
1559 | 0 | { |
1560 | 0 | return false; |
1561 | 0 | } |
1562 | | |
1563 | | bool isStruct() const override |
1564 | 0 | { |
1565 | 0 | return false; |
1566 | 0 | } |
1567 | | |
1568 | | bool isInteger() const override |
1569 | 0 | { |
1570 | 0 | return std::numeric_limits<Int32>::is_integer; |
1571 | 0 | } |
1572 | | |
1573 | | bool isSigned() const override |
1574 | 0 | { |
1575 | 0 | return std::numeric_limits<Int32>::is_signed; |
1576 | 0 | } |
1577 | | |
1578 | | bool isNumeric() const override |
1579 | 0 | { |
1580 | 0 | return std::numeric_limits<Int32>::is_specialized; |
1581 | 0 | } |
1582 | | |
1583 | | bool isBoolean() const override |
1584 | 0 | { |
1585 | 0 | return false; |
1586 | 0 | } |
1587 | | |
1588 | | bool isString() const override |
1589 | 0 | { |
1590 | 0 | return false; |
1591 | 0 | } |
1592 | | |
1593 | | private: |
1594 | | Int32 _val; |
1595 | | }; |
1596 | | |
1597 | | |
1598 | | template <> |
1599 | | class VarHolderImpl<Int64>: public VarHolder |
1600 | | { |
1601 | | public: |
1602 | 0 | VarHolderImpl(Int64 val): _val(val) |
1603 | 0 | { |
1604 | 0 | } |
1605 | | |
1606 | | ~VarHolderImpl() override = default; |
1607 | | |
1608 | | VarHolderImpl() = delete; |
1609 | | VarHolderImpl(const VarHolderImpl&) = delete; |
1610 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
1611 | | |
1612 | | const std::type_info& type() const override |
1613 | 0 | { |
1614 | 0 | return typeid(Int64); |
1615 | 0 | } |
1616 | | |
1617 | | void convert(Int8& val) const override |
1618 | 0 | { |
1619 | 0 | convertToSmaller(_val, val); |
1620 | 0 | } |
1621 | | |
1622 | | void convert(Int16& val) const override |
1623 | 0 | { |
1624 | 0 | convertToSmaller(_val, val); |
1625 | 0 | } |
1626 | | |
1627 | | void convert(Int32& val) const override |
1628 | 0 | { |
1629 | 0 | convertToSmaller(_val, val); |
1630 | 0 | } |
1631 | | |
1632 | | void convert(Int64& val) const override |
1633 | 0 | { |
1634 | 0 | val = _val; |
1635 | 0 | } |
1636 | | |
1637 | | void convert(UInt8& val) const override |
1638 | 0 | { |
1639 | 0 | convertSignedToUnsigned(_val, val); |
1640 | 0 | } |
1641 | | |
1642 | | void convert(UInt16& val) const override |
1643 | 0 | { |
1644 | 0 | convertSignedToUnsigned(_val, val); |
1645 | 0 | } |
1646 | | |
1647 | | void convert(UInt32& val) const override |
1648 | 0 | { |
1649 | 0 | convertSignedToUnsigned(_val, val); |
1650 | 0 | } |
1651 | | |
1652 | | void convert(UInt64& val) const override |
1653 | 0 | { |
1654 | 0 | convertSignedToUnsigned(_val, val); |
1655 | 0 | } |
1656 | | |
1657 | | #ifdef POCO_INT64_IS_LONG |
1658 | | |
1659 | | void convert(long long& val) const override |
1660 | 0 | { |
1661 | 0 | val = _val; |
1662 | 0 | } |
1663 | | |
1664 | | void convert(unsigned long long& val) const override |
1665 | 0 | { |
1666 | 0 | convertSignedToUnsigned(_val, val); |
1667 | 0 | } |
1668 | | |
1669 | | #endif |
1670 | | |
1671 | | void convert(bool& val) const override |
1672 | 0 | { |
1673 | 0 | val = (_val != 0); |
1674 | 0 | } |
1675 | | |
1676 | | void convert(float& val) const override |
1677 | 0 | { |
1678 | 0 | convertToFP(_val, val); |
1679 | 0 | } |
1680 | | |
1681 | | void convert(double& val) const override |
1682 | 0 | { |
1683 | 0 | convertToFP(_val, val); |
1684 | 0 | } |
1685 | | |
1686 | | void convert(char& val) const override |
1687 | 0 | { |
1688 | 0 | UInt8 tmp; |
1689 | 0 | convert(tmp); |
1690 | 0 | val = static_cast<char>(tmp); |
1691 | 0 | } |
1692 | | |
1693 | | void convert(std::string& val) const override |
1694 | 0 | { |
1695 | 0 | val = NumberFormatter::format(_val); |
1696 | 0 | } |
1697 | | |
1698 | | void convert(DateTime& dt) const override |
1699 | 0 | { |
1700 | 0 | dt = Timestamp(_val); |
1701 | 0 | } |
1702 | | |
1703 | | void convert(LocalDateTime& ldt) const override |
1704 | 0 | { |
1705 | 0 | ldt = Timestamp(_val); |
1706 | 0 | } |
1707 | | |
1708 | | void convert(Timestamp& val) const override |
1709 | 0 | { |
1710 | 0 | val = Timestamp(_val); |
1711 | 0 | } |
1712 | | |
1713 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
1714 | 0 | { |
1715 | 0 | return cloneHolder(pVarHolder, _val); |
1716 | 0 | } |
1717 | | |
1718 | | const Int64& value() const |
1719 | 0 | { |
1720 | 0 | return _val; |
1721 | 0 | } |
1722 | | |
1723 | | bool isArray() const override |
1724 | 0 | { |
1725 | 0 | return false; |
1726 | 0 | } |
1727 | | |
1728 | | bool isStruct() const override |
1729 | 0 | { |
1730 | 0 | return false; |
1731 | 0 | } |
1732 | | |
1733 | | bool isInteger() const override |
1734 | 0 | { |
1735 | 0 | return std::numeric_limits<Int64>::is_integer; |
1736 | 0 | } |
1737 | | |
1738 | | bool isSigned() const override |
1739 | 0 | { |
1740 | 0 | return std::numeric_limits<Int64>::is_signed; |
1741 | 0 | } |
1742 | | |
1743 | | bool isNumeric() const override |
1744 | 0 | { |
1745 | 0 | return std::numeric_limits<Int64>::is_specialized; |
1746 | 0 | } |
1747 | | |
1748 | | bool isBoolean() const override |
1749 | 0 | { |
1750 | 0 | return false; |
1751 | 0 | } |
1752 | | |
1753 | | bool isString() const override |
1754 | 0 | { |
1755 | 0 | return false; |
1756 | 0 | } |
1757 | | |
1758 | | private: |
1759 | | Int64 _val; |
1760 | | }; |
1761 | | |
1762 | | |
1763 | | template <> |
1764 | | class VarHolderImpl<UInt8>: public VarHolder |
1765 | | { |
1766 | | public: |
1767 | | VarHolderImpl(UInt8 val): _val(val) |
1768 | 0 | { |
1769 | 0 | } |
1770 | | |
1771 | | ~VarHolderImpl() override = default; |
1772 | | |
1773 | | VarHolderImpl() = delete; |
1774 | | VarHolderImpl(const VarHolderImpl&) = delete; |
1775 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
1776 | | |
1777 | | const std::type_info& type() const override |
1778 | 0 | { |
1779 | 0 | return typeid(UInt8); |
1780 | 0 | } |
1781 | | |
1782 | | void convert(Int8& val) const override |
1783 | 0 | { |
1784 | 0 | convertUnsignedToSigned(_val, val); |
1785 | 0 | } |
1786 | | |
1787 | | void convert(Int16& val) const override |
1788 | 0 | { |
1789 | 0 | convertUnsignedToSigned(_val, val); |
1790 | 0 | } |
1791 | | |
1792 | | void convert(Int32& val) const override |
1793 | 0 | { |
1794 | 0 | val = static_cast<Int32>(_val); |
1795 | 0 | } |
1796 | | |
1797 | | void convert(Int64& val) const override |
1798 | 0 | { |
1799 | 0 | val = static_cast<Int64>(_val); |
1800 | 0 | } |
1801 | | |
1802 | | void convert(UInt8& val) const override |
1803 | 0 | { |
1804 | 0 | val = _val; |
1805 | 0 | } |
1806 | | |
1807 | | void convert(UInt16& val) const override |
1808 | 0 | { |
1809 | 0 | val = _val; |
1810 | 0 | } |
1811 | | |
1812 | | void convert(UInt32& val) const override |
1813 | 0 | { |
1814 | 0 | val = _val; |
1815 | 0 | } |
1816 | | |
1817 | | void convert(UInt64& val) const override |
1818 | 0 | { |
1819 | 0 | val = _val; |
1820 | 0 | } |
1821 | | |
1822 | | #ifdef POCO_INT64_IS_LONG |
1823 | | |
1824 | | void convert(long long& val) const override |
1825 | 0 | { |
1826 | 0 | val = static_cast<long long>(_val); |
1827 | 0 | } |
1828 | | |
1829 | | void convert(unsigned long long& val) const override |
1830 | 0 | { |
1831 | 0 | val = _val; |
1832 | 0 | } |
1833 | | |
1834 | | #endif |
1835 | | |
1836 | | void convert(bool& val) const override |
1837 | 0 | { |
1838 | 0 | val = (_val != 0); |
1839 | 0 | } |
1840 | | |
1841 | | void convert(float& val) const override |
1842 | 0 | { |
1843 | 0 | convertToFP(_val, val); |
1844 | 0 | } |
1845 | | |
1846 | | void convert(double& val) const override |
1847 | 0 | { |
1848 | 0 | convertToFP(_val, val); |
1849 | 0 | } |
1850 | | |
1851 | | void convert(char& val) const override |
1852 | 0 | { |
1853 | 0 | UInt8 tmp; |
1854 | 0 | convert(tmp); |
1855 | 0 | val = static_cast<char>(tmp); |
1856 | 0 | } |
1857 | | |
1858 | | void convert(std::string& val) const override |
1859 | 0 | { |
1860 | 0 | val = NumberFormatter::format(_val); |
1861 | 0 | } |
1862 | | |
1863 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
1864 | 0 | { |
1865 | 0 | return cloneHolder(pVarHolder, _val); |
1866 | 0 | } |
1867 | | |
1868 | | const UInt8& value() const |
1869 | 0 | { |
1870 | 0 | return _val; |
1871 | 0 | } |
1872 | | |
1873 | | bool isArray() const override |
1874 | 0 | { |
1875 | 0 | return false; |
1876 | 0 | } |
1877 | | |
1878 | | bool isStruct() const override |
1879 | 0 | { |
1880 | 0 | return false; |
1881 | 0 | } |
1882 | | |
1883 | | bool isInteger() const override |
1884 | 0 | { |
1885 | 0 | return std::numeric_limits<UInt8>::is_integer; |
1886 | 0 | } |
1887 | | |
1888 | | bool isSigned() const override |
1889 | 0 | { |
1890 | 0 | return std::numeric_limits<UInt8>::is_signed; |
1891 | 0 | } |
1892 | | |
1893 | | bool isNumeric() const override |
1894 | 0 | { |
1895 | 0 | return std::numeric_limits<UInt8>::is_specialized; |
1896 | 0 | } |
1897 | | |
1898 | | bool isBoolean() const override |
1899 | 0 | { |
1900 | 0 | return false; |
1901 | 0 | } |
1902 | | |
1903 | | bool isString() const override |
1904 | 0 | { |
1905 | 0 | return false; |
1906 | 0 | } |
1907 | | |
1908 | | private: |
1909 | | UInt8 _val; |
1910 | | }; |
1911 | | |
1912 | | |
1913 | | template <> |
1914 | | class VarHolderImpl<UInt16>: public VarHolder |
1915 | | { |
1916 | | public: |
1917 | | VarHolderImpl(UInt16 val): _val(val) |
1918 | 0 | { |
1919 | 0 | } |
1920 | | |
1921 | | ~VarHolderImpl() override = default; |
1922 | | |
1923 | | VarHolderImpl() = delete; |
1924 | | VarHolderImpl(const VarHolderImpl&) = delete; |
1925 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
1926 | | |
1927 | | const std::type_info& type() const override |
1928 | 0 | { |
1929 | 0 | return typeid(UInt16); |
1930 | 0 | } |
1931 | | |
1932 | | void convert(Int8& val) const override |
1933 | 0 | { |
1934 | 0 | convertUnsignedToSigned(_val, val); |
1935 | 0 | } |
1936 | | |
1937 | | void convert(Int16& val) const override |
1938 | 0 | { |
1939 | 0 | convertUnsignedToSigned(_val, val); |
1940 | 0 | } |
1941 | | |
1942 | | void convert(Int32& val) const override |
1943 | 0 | { |
1944 | 0 | convertUnsignedToSigned(_val, val); |
1945 | 0 | } |
1946 | | |
1947 | | void convert(Int64& val) const override |
1948 | 0 | { |
1949 | 0 | val = static_cast<Int64>(_val); |
1950 | 0 | } |
1951 | | |
1952 | | void convert(UInt8& val) const override |
1953 | 0 | { |
1954 | 0 | convertToSmallerUnsigned(_val, val); |
1955 | 0 | } |
1956 | | |
1957 | | void convert(UInt16& val) const override |
1958 | 0 | { |
1959 | 0 | val = _val; |
1960 | 0 | } |
1961 | | |
1962 | | void convert(UInt32& val) const override |
1963 | 0 | { |
1964 | 0 | val = _val; |
1965 | 0 | } |
1966 | | |
1967 | | void convert(UInt64& val) const override |
1968 | 0 | { |
1969 | 0 | val = _val; |
1970 | 0 | } |
1971 | | |
1972 | | #ifdef POCO_INT64_IS_LONG |
1973 | | |
1974 | | void convert(long long& val) const override |
1975 | 0 | { |
1976 | 0 | val = static_cast<long long>(_val); |
1977 | 0 | } |
1978 | | |
1979 | | void convert(unsigned long long& val) const override |
1980 | 0 | { |
1981 | 0 | val = _val; |
1982 | 0 | } |
1983 | | |
1984 | | #endif |
1985 | | |
1986 | | void convert(bool& val) const override |
1987 | 0 | { |
1988 | 0 | val = (_val != 0); |
1989 | 0 | } |
1990 | | |
1991 | | void convert(float& val) const override |
1992 | 0 | { |
1993 | 0 | convertToFP(_val, val); |
1994 | 0 | } |
1995 | | |
1996 | | void convert(double& val) const override |
1997 | 0 | { |
1998 | 0 | convertToFP(_val, val); |
1999 | 0 | } |
2000 | | |
2001 | | void convert(char& val) const override |
2002 | 0 | { |
2003 | 0 | UInt8 tmp; |
2004 | 0 | convert(tmp); |
2005 | 0 | val = static_cast<char>(tmp); |
2006 | 0 | } |
2007 | | |
2008 | | void convert(std::string& val) const override |
2009 | 0 | { |
2010 | 0 | val = NumberFormatter::format(_val); |
2011 | 0 | } |
2012 | | |
2013 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2014 | 0 | { |
2015 | 0 | return cloneHolder(pVarHolder, _val); |
2016 | 0 | } |
2017 | | |
2018 | | const UInt16& value() const |
2019 | 0 | { |
2020 | 0 | return _val; |
2021 | 0 | } |
2022 | | |
2023 | | bool isArray() const override |
2024 | 0 | { |
2025 | 0 | return false; |
2026 | 0 | } |
2027 | | |
2028 | | bool isStruct() const override |
2029 | 0 | { |
2030 | 0 | return false; |
2031 | 0 | } |
2032 | | |
2033 | | bool isInteger() const override |
2034 | 0 | { |
2035 | 0 | return std::numeric_limits<UInt16>::is_integer; |
2036 | 0 | } |
2037 | | |
2038 | | bool isSigned() const override |
2039 | 0 | { |
2040 | 0 | return std::numeric_limits<UInt16>::is_signed; |
2041 | 0 | } |
2042 | | |
2043 | | bool isNumeric() const override |
2044 | 0 | { |
2045 | 0 | return std::numeric_limits<UInt16>::is_specialized; |
2046 | 0 | } |
2047 | | |
2048 | | bool isBoolean() const override |
2049 | 0 | { |
2050 | 0 | return false; |
2051 | 0 | } |
2052 | | |
2053 | | bool isString() const override |
2054 | 0 | { |
2055 | 0 | return false; |
2056 | 0 | } |
2057 | | |
2058 | | private: |
2059 | | UInt16 _val; |
2060 | | }; |
2061 | | |
2062 | | |
2063 | | template <> |
2064 | | class VarHolderImpl<UInt32>: public VarHolder |
2065 | | { |
2066 | | public: |
2067 | 0 | VarHolderImpl(UInt32 val): _val(val) |
2068 | 0 | { |
2069 | 0 | } |
2070 | | |
2071 | | ~VarHolderImpl() override = default; |
2072 | | |
2073 | | VarHolderImpl() = delete; |
2074 | | VarHolderImpl(const VarHolderImpl&) = delete; |
2075 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
2076 | | |
2077 | | const std::type_info& type() const override |
2078 | 0 | { |
2079 | 0 | return typeid(UInt32); |
2080 | 0 | } |
2081 | | |
2082 | | void convert(Int8& val) const override |
2083 | 0 | { |
2084 | 0 | convertUnsignedToSigned(_val, val); |
2085 | 0 | } |
2086 | | |
2087 | | void convert(Int16& val) const override |
2088 | 0 | { |
2089 | 0 | convertUnsignedToSigned(_val, val); |
2090 | 0 | } |
2091 | | |
2092 | | void convert(Int32& val) const override |
2093 | 0 | { |
2094 | 0 | convertUnsignedToSigned(_val, val); |
2095 | 0 | } |
2096 | | |
2097 | | void convert(Int64& val) const override |
2098 | 0 | { |
2099 | 0 | convertUnsignedToSigned(_val, val); |
2100 | 0 | } |
2101 | | |
2102 | | void convert(UInt8& val) const override |
2103 | 0 | { |
2104 | 0 | convertToSmallerUnsigned(_val, val); |
2105 | 0 | } |
2106 | | |
2107 | | void convert(UInt16& val) const override |
2108 | 0 | { |
2109 | 0 | convertToSmallerUnsigned(_val, val); |
2110 | 0 | } |
2111 | | |
2112 | | void convert(UInt32& val) const override |
2113 | 0 | { |
2114 | 0 | val = _val; |
2115 | 0 | } |
2116 | | |
2117 | | void convert(UInt64& val) const override |
2118 | 0 | { |
2119 | 0 | val = _val; |
2120 | 0 | } |
2121 | | |
2122 | | #ifdef POCO_INT64_IS_LONG |
2123 | | |
2124 | | void convert(long long& val) const override |
2125 | 0 | { |
2126 | 0 | convertUnsignedToSigned(_val, val); |
2127 | 0 | } |
2128 | | |
2129 | | void convert(unsigned long long& val) const override |
2130 | 0 | { |
2131 | 0 | val = _val; |
2132 | 0 | } |
2133 | | |
2134 | | #endif |
2135 | | |
2136 | | void convert(bool& val) const override |
2137 | 0 | { |
2138 | 0 | val = (_val != 0); |
2139 | 0 | } |
2140 | | |
2141 | | void convert(float& val) const override |
2142 | 0 | { |
2143 | 0 | convertToFP(_val, val); |
2144 | 0 | } |
2145 | | |
2146 | | void convert(double& val) const override |
2147 | 0 | { |
2148 | 0 | convertToFP(_val, val); |
2149 | 0 | } |
2150 | | |
2151 | | void convert(char& val) const override |
2152 | 0 | { |
2153 | 0 | UInt8 tmp; |
2154 | 0 | convert(tmp); |
2155 | 0 | val = static_cast<char>(tmp); |
2156 | 0 | } |
2157 | | |
2158 | | void convert(std::string& val) const override |
2159 | 0 | { |
2160 | 0 | val = NumberFormatter::format(_val); |
2161 | 0 | } |
2162 | | |
2163 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2164 | 0 | { |
2165 | 0 | return cloneHolder(pVarHolder, _val); |
2166 | 0 | } |
2167 | | |
2168 | | const UInt32& value() const |
2169 | 0 | { |
2170 | 0 | return _val; |
2171 | 0 | } |
2172 | | |
2173 | | bool isArray() const override |
2174 | 0 | { |
2175 | 0 | return false; |
2176 | 0 | } |
2177 | | |
2178 | | bool isStruct() const override |
2179 | 0 | { |
2180 | 0 | return false; |
2181 | 0 | } |
2182 | | |
2183 | | bool isInteger() const override |
2184 | 0 | { |
2185 | 0 | return std::numeric_limits<UInt32>::is_integer; |
2186 | 0 | } |
2187 | | |
2188 | | bool isSigned() const override |
2189 | 0 | { |
2190 | 0 | return std::numeric_limits<UInt32>::is_signed; |
2191 | 0 | } |
2192 | | |
2193 | | bool isNumeric() const override |
2194 | 0 | { |
2195 | 0 | return std::numeric_limits<UInt32>::is_specialized; |
2196 | 0 | } |
2197 | | |
2198 | | bool isBoolean() const override |
2199 | 0 | { |
2200 | 0 | return false; |
2201 | 0 | } |
2202 | | |
2203 | | bool isString() const override |
2204 | 0 | { |
2205 | 0 | return false; |
2206 | 0 | } |
2207 | | |
2208 | | private: |
2209 | | UInt32 _val; |
2210 | | }; |
2211 | | |
2212 | | |
2213 | | template <> |
2214 | | class VarHolderImpl<UInt64>: public VarHolder |
2215 | | { |
2216 | | public: |
2217 | 0 | VarHolderImpl(UInt64 val): _val(val) |
2218 | 0 | { |
2219 | 0 | } |
2220 | | |
2221 | | ~VarHolderImpl() override = default; |
2222 | | |
2223 | | VarHolderImpl() = delete; |
2224 | | VarHolderImpl(const VarHolderImpl&) = delete; |
2225 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
2226 | | |
2227 | | const std::type_info& type() const override |
2228 | 0 | { |
2229 | 0 | return typeid(UInt64); |
2230 | 0 | } |
2231 | | |
2232 | | void convert(Int8& val) const override |
2233 | 0 | { |
2234 | 0 | convertUnsignedToSigned(_val, val); |
2235 | 0 | } |
2236 | | |
2237 | | void convert(Int16& val) const override |
2238 | 0 | { |
2239 | 0 | convertUnsignedToSigned(_val, val); |
2240 | 0 | } |
2241 | | |
2242 | | void convert(Int32& val) const override |
2243 | 0 | { |
2244 | 0 | convertUnsignedToSigned(_val, val); |
2245 | 0 | } |
2246 | | |
2247 | | void convert(Int64& val) const override |
2248 | 0 | { |
2249 | 0 | convertUnsignedToSigned(_val, val); |
2250 | 0 | } |
2251 | | |
2252 | | void convert(UInt8& val) const override |
2253 | 0 | { |
2254 | 0 | convertToSmallerUnsigned(_val, val); |
2255 | 0 | } |
2256 | | |
2257 | | void convert(UInt16& val) const override |
2258 | 0 | { |
2259 | 0 | convertToSmallerUnsigned(_val, val); |
2260 | 0 | } |
2261 | | |
2262 | | void convert(UInt32& val) const override |
2263 | 0 | { |
2264 | 0 | convertToSmallerUnsigned(_val, val); |
2265 | 0 | } |
2266 | | |
2267 | | void convert(UInt64& val) const override |
2268 | 0 | { |
2269 | 0 | val = _val; |
2270 | 0 | } |
2271 | | |
2272 | | #ifdef POCO_INT64_IS_LONG |
2273 | | |
2274 | | void convert(long long& val) const override |
2275 | 0 | { |
2276 | 0 | convertUnsignedToSigned(_val, val); |
2277 | 0 | } |
2278 | | |
2279 | | void convert(unsigned long long& val) const override |
2280 | 0 | { |
2281 | 0 | val = _val; |
2282 | 0 | } |
2283 | | |
2284 | | #endif |
2285 | | |
2286 | | void convert(bool& val) const override |
2287 | 0 | { |
2288 | 0 | val = (_val != 0); |
2289 | 0 | } |
2290 | | |
2291 | | void convert(float& val) const override |
2292 | 0 | { |
2293 | 0 | convertToFP(_val, val); |
2294 | 0 | } |
2295 | | |
2296 | | void convert(double& val) const override |
2297 | 0 | { |
2298 | 0 | convertToFP(_val, val); |
2299 | 0 | } |
2300 | | |
2301 | | void convert(char& val) const override |
2302 | 0 | { |
2303 | 0 | UInt8 tmp; |
2304 | 0 | convert(tmp); |
2305 | 0 | val = static_cast<char>(tmp); |
2306 | 0 | } |
2307 | | |
2308 | | void convert(std::string& val) const override |
2309 | 0 | { |
2310 | 0 | val = NumberFormatter::format(_val); |
2311 | 0 | } |
2312 | | |
2313 | | void convert(DateTime& dt) const override |
2314 | 0 | { |
2315 | 0 | Int64 val; |
2316 | 0 | convertUnsignedToSigned(_val, val); |
2317 | 0 | dt = Timestamp(val); |
2318 | 0 | } |
2319 | | |
2320 | | void convert(LocalDateTime& ldt) const override |
2321 | 0 | { |
2322 | 0 | Int64 val; |
2323 | 0 | convertUnsignedToSigned(_val, val); |
2324 | 0 | ldt = Timestamp(val); |
2325 | 0 | } |
2326 | | |
2327 | | void convert(Timestamp& val) const override |
2328 | 0 | { |
2329 | 0 | Int64 tmp; |
2330 | 0 | convertUnsignedToSigned(_val, tmp); |
2331 | 0 | val = Timestamp(tmp); |
2332 | 0 | } |
2333 | | |
2334 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2335 | 0 | { |
2336 | 0 | return cloneHolder(pVarHolder, _val); |
2337 | 0 | } |
2338 | | |
2339 | | const UInt64& value() const |
2340 | 0 | { |
2341 | 0 | return _val; |
2342 | 0 | } |
2343 | | |
2344 | | bool isArray() const override |
2345 | 0 | { |
2346 | 0 | return false; |
2347 | 0 | } |
2348 | | |
2349 | | bool isStruct() const override |
2350 | 0 | { |
2351 | 0 | return false; |
2352 | 0 | } |
2353 | | |
2354 | | bool isInteger() const override |
2355 | 0 | { |
2356 | 0 | return std::numeric_limits<UInt64>::is_integer; |
2357 | 0 | } |
2358 | | |
2359 | | bool isSigned() const override |
2360 | 0 | { |
2361 | 0 | return std::numeric_limits<UInt64>::is_signed; |
2362 | 0 | } |
2363 | | |
2364 | | bool isNumeric() const override |
2365 | 0 | { |
2366 | 0 | return std::numeric_limits<UInt64>::is_specialized; |
2367 | 0 | } |
2368 | | |
2369 | | bool isBoolean() const override |
2370 | 0 | { |
2371 | 0 | return false; |
2372 | 0 | } |
2373 | | |
2374 | | bool isString() const override |
2375 | 0 | { |
2376 | 0 | return false; |
2377 | 0 | } |
2378 | | |
2379 | | private: |
2380 | | UInt64 _val; |
2381 | | }; |
2382 | | |
2383 | | |
2384 | | template <> |
2385 | | class VarHolderImpl<bool>: public VarHolder |
2386 | | { |
2387 | | public: |
2388 | 0 | VarHolderImpl(bool val): _val(val) |
2389 | 0 | { |
2390 | 0 | } |
2391 | | |
2392 | | ~VarHolderImpl() override = default; |
2393 | | VarHolderImpl() = delete; |
2394 | | VarHolderImpl(const VarHolderImpl&) = delete; |
2395 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
2396 | | |
2397 | | const std::type_info& type() const override |
2398 | 0 | { |
2399 | 0 | return typeid(bool); |
2400 | 0 | } |
2401 | | |
2402 | | void convert(Int8& val) const override |
2403 | 0 | { |
2404 | 0 | val = static_cast<Int8>(_val ? 1 : 0); |
2405 | 0 | } |
2406 | | |
2407 | | void convert(Int16& val) const override |
2408 | 0 | { |
2409 | 0 | val = static_cast<Int16>(_val ? 1 : 0); |
2410 | 0 | } |
2411 | | |
2412 | | void convert(Int32& val) const override |
2413 | 0 | { |
2414 | 0 | val = static_cast<Int32>(_val ? 1 : 0); |
2415 | 0 | } |
2416 | | |
2417 | | void convert(Int64& val) const override |
2418 | 0 | { |
2419 | 0 | val = static_cast<Int64>(_val ? 1 : 0); |
2420 | 0 | } |
2421 | | |
2422 | | void convert(UInt8& val) const override |
2423 | 0 | { |
2424 | 0 | val = static_cast<UInt8>(_val ? 1 : 0); |
2425 | 0 | } |
2426 | | |
2427 | | void convert(UInt16& val) const override |
2428 | 0 | { |
2429 | 0 | val = static_cast<UInt16>(_val ? 1 : 0); |
2430 | 0 | } |
2431 | | |
2432 | | void convert(UInt32& val) const override |
2433 | 0 | { |
2434 | 0 | val = static_cast<UInt32>(_val ? 1 : 0); |
2435 | 0 | } |
2436 | | |
2437 | | void convert(UInt64& val) const override |
2438 | 0 | { |
2439 | 0 | val = static_cast<UInt64>(_val ? 1 : 0); |
2440 | 0 | } |
2441 | | |
2442 | | #ifdef POCO_INT64_IS_LONG |
2443 | | |
2444 | | void convert(long long& val) const override |
2445 | 0 | { |
2446 | 0 | val = static_cast<long long>(_val ? 1 : 0); |
2447 | 0 | } |
2448 | | |
2449 | | void convert(unsigned long long& val) const override |
2450 | 0 | { |
2451 | 0 | val = static_cast<unsigned long long>(_val ? 1 : 0); |
2452 | 0 | } |
2453 | | |
2454 | | #endif |
2455 | | |
2456 | | void convert(bool& val) const override |
2457 | 0 | { |
2458 | 0 | val = _val; |
2459 | 0 | } |
2460 | | |
2461 | | void convert(float& val) const override |
2462 | 0 | { |
2463 | 0 | val = (_val ? 1.0f : 0.0f); |
2464 | 0 | } |
2465 | | |
2466 | | void convert(double& val) const override |
2467 | 0 | { |
2468 | 0 | val = (_val ? 1.0 : 0.0); |
2469 | 0 | } |
2470 | | |
2471 | | void convert(char& val) const override |
2472 | 0 | { |
2473 | 0 | val = static_cast<char>(_val ? 1 : 0); |
2474 | 0 | } |
2475 | | |
2476 | | void convert(std::string& val) const override |
2477 | 0 | { |
2478 | 0 | val = (_val ? "true" : "false"); |
2479 | 0 | } |
2480 | | |
2481 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2482 | 0 | { |
2483 | 0 | return cloneHolder(pVarHolder, _val); |
2484 | 0 | } |
2485 | | |
2486 | | const bool& value() const |
2487 | 0 | { |
2488 | 0 | return _val; |
2489 | 0 | } |
2490 | | |
2491 | | bool isArray() const override |
2492 | 0 | { |
2493 | 0 | return false; |
2494 | 0 | } |
2495 | | |
2496 | | bool isStruct() const override |
2497 | 0 | { |
2498 | 0 | return false; |
2499 | 0 | } |
2500 | | |
2501 | | bool isInteger() const override |
2502 | 0 | { |
2503 | 0 | return std::numeric_limits<bool>::is_integer; |
2504 | 0 | } |
2505 | | |
2506 | | bool isSigned() const override |
2507 | 0 | { |
2508 | 0 | return std::numeric_limits<bool>::is_signed; |
2509 | 0 | } |
2510 | | |
2511 | | bool isNumeric() const override |
2512 | 0 | { |
2513 | 0 | return std::numeric_limits<bool>::is_specialized; |
2514 | 0 | } |
2515 | | |
2516 | | bool isBoolean() const override |
2517 | 0 | { |
2518 | 0 | return true; |
2519 | 0 | } |
2520 | | |
2521 | | bool isString() const override |
2522 | 0 | { |
2523 | 0 | return false; |
2524 | 0 | } |
2525 | | |
2526 | | private: |
2527 | | bool _val; |
2528 | | }; |
2529 | | |
2530 | | |
2531 | | template <> |
2532 | | class VarHolderImpl<float>: public VarHolder |
2533 | | { |
2534 | | public: |
2535 | | VarHolderImpl(float val): _val(val) |
2536 | 0 | { |
2537 | 0 | } |
2538 | | |
2539 | | ~VarHolderImpl() override = default; |
2540 | | |
2541 | | VarHolderImpl() = delete; |
2542 | | VarHolderImpl(const VarHolderImpl&) = delete; |
2543 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
2544 | | |
2545 | | const std::type_info& type() const override |
2546 | 0 | { |
2547 | 0 | return typeid(float); |
2548 | 0 | } |
2549 | | |
2550 | | void convert(Int8& val) const override |
2551 | 0 | { |
2552 | 0 | convertToSmaller(_val, val); |
2553 | 0 | } |
2554 | | |
2555 | | void convert(Int16& val) const override |
2556 | 0 | { |
2557 | 0 | convertToSmaller(_val, val); |
2558 | 0 | } |
2559 | | |
2560 | | void convert(Int32& val) const override |
2561 | 0 | { |
2562 | 0 | convertToSmaller(_val, val); |
2563 | 0 | } |
2564 | | |
2565 | | void convert(Int64& val) const override |
2566 | 0 | { |
2567 | 0 | convertToSmaller(_val, val); |
2568 | 0 | } |
2569 | | |
2570 | | void convert(UInt8& val) const override |
2571 | 0 | { |
2572 | 0 | convertSignedFloatToUnsigned(_val, val); |
2573 | 0 | } |
2574 | | |
2575 | | void convert(UInt16& val) const override |
2576 | 0 | { |
2577 | 0 | convertSignedFloatToUnsigned(_val, val); |
2578 | 0 | } |
2579 | | |
2580 | | void convert(UInt32& val) const override |
2581 | 0 | { |
2582 | 0 | convertSignedFloatToUnsigned(_val, val); |
2583 | 0 | } |
2584 | | |
2585 | | void convert(UInt64& val) const override |
2586 | 0 | { |
2587 | 0 | convertSignedFloatToUnsigned(_val, val); |
2588 | 0 | } |
2589 | | |
2590 | | #ifdef POCO_INT64_IS_LONG |
2591 | | |
2592 | | void convert(long long& val) const override |
2593 | 0 | { |
2594 | 0 | convertToSmaller(_val, val); |
2595 | 0 | } |
2596 | | |
2597 | | void convert(unsigned long long& val) const override |
2598 | 0 | { |
2599 | 0 | convertSignedFloatToUnsigned(_val, val); |
2600 | 0 | } |
2601 | | |
2602 | | #endif |
2603 | | |
2604 | | void convert(bool& val) const override |
2605 | 0 | { |
2606 | 0 | val = _val > std::numeric_limits<float>::min() || |
2607 | 0 | _val < -1 * std::numeric_limits<float>::min(); |
2608 | 0 | } |
2609 | | |
2610 | | void convert(float& val) const override |
2611 | 0 | { |
2612 | 0 | val = _val; |
2613 | 0 | } |
2614 | | |
2615 | | void convert(double& val) const override |
2616 | 0 | { |
2617 | 0 | val = _val; |
2618 | 0 | } |
2619 | | |
2620 | | void convert(char& val) const override |
2621 | 0 | { |
2622 | 0 | UInt8 tmp; |
2623 | 0 | convert(tmp); |
2624 | 0 | val = static_cast<char>(tmp); |
2625 | 0 | } |
2626 | | |
2627 | | void convert(std::string& val) const override |
2628 | 0 | { |
2629 | 0 | val = NumberFormatter::format(_val); |
2630 | 0 | } |
2631 | | |
2632 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2633 | 0 | { |
2634 | 0 | return cloneHolder(pVarHolder, _val); |
2635 | 0 | } |
2636 | | |
2637 | | const float& value() const |
2638 | 0 | { |
2639 | 0 | return _val; |
2640 | 0 | } |
2641 | | |
2642 | | bool isArray() const override |
2643 | 0 | { |
2644 | 0 | return false; |
2645 | 0 | } |
2646 | | |
2647 | | bool isStruct() const override |
2648 | 0 | { |
2649 | 0 | return false; |
2650 | 0 | } |
2651 | | |
2652 | | bool isInteger() const override |
2653 | 0 | { |
2654 | 0 | return std::numeric_limits<float>::is_integer; |
2655 | 0 | } |
2656 | | |
2657 | | bool isSigned() const override |
2658 | 0 | { |
2659 | 0 | return std::numeric_limits<float>::is_signed; |
2660 | 0 | } |
2661 | | |
2662 | | bool isNumeric() const override |
2663 | 0 | { |
2664 | 0 | return std::numeric_limits<float>::is_specialized; |
2665 | 0 | } |
2666 | | |
2667 | | bool isBoolean() const override |
2668 | 0 | { |
2669 | 0 | return false; |
2670 | 0 | } |
2671 | | |
2672 | | bool isString() const override |
2673 | 0 | { |
2674 | 0 | return false; |
2675 | 0 | } |
2676 | | |
2677 | | private: |
2678 | | float _val; |
2679 | | }; |
2680 | | |
2681 | | |
2682 | | template <> |
2683 | | class VarHolderImpl<double>: public VarHolder |
2684 | | { |
2685 | | public: |
2686 | 0 | VarHolderImpl(double val): _val(val) |
2687 | 0 | { |
2688 | 0 | } |
2689 | | |
2690 | | ~VarHolderImpl() override = default; |
2691 | | |
2692 | | VarHolderImpl() = delete; |
2693 | | VarHolderImpl(const VarHolderImpl&) = delete; |
2694 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
2695 | | |
2696 | | const std::type_info& type() const override |
2697 | 0 | { |
2698 | 0 | return typeid(double); |
2699 | 0 | } |
2700 | | |
2701 | | void convert(Int8& val) const override |
2702 | 0 | { |
2703 | 0 | convertToSmaller(_val, val); |
2704 | 0 | } |
2705 | | |
2706 | | void convert(Int16& val) const override |
2707 | 0 | { |
2708 | 0 | convertToSmaller(_val, val); |
2709 | 0 | } |
2710 | | |
2711 | | void convert(Int32& val) const override |
2712 | 0 | { |
2713 | 0 | convertToSmaller(_val, val); |
2714 | 0 | } |
2715 | | |
2716 | | void convert(Int64& val) const override |
2717 | 0 | { |
2718 | 0 | convertToSmaller(_val, val); |
2719 | 0 | } |
2720 | | |
2721 | | void convert(UInt8& val) const override |
2722 | 0 | { |
2723 | 0 | convertSignedFloatToUnsigned(_val, val); |
2724 | 0 | } |
2725 | | |
2726 | | void convert(UInt16& val) const override |
2727 | 0 | { |
2728 | 0 | convertSignedFloatToUnsigned(_val, val); |
2729 | 0 | } |
2730 | | |
2731 | | void convert(UInt32& val) const override |
2732 | 0 | { |
2733 | 0 | convertSignedFloatToUnsigned(_val, val); |
2734 | 0 | } |
2735 | | |
2736 | | void convert(UInt64& val) const override |
2737 | 0 | { |
2738 | 0 | convertSignedFloatToUnsigned(_val, val); |
2739 | 0 | } |
2740 | | |
2741 | | #ifdef POCO_INT64_IS_LONG |
2742 | | |
2743 | | void convert(long long& val) const override |
2744 | 0 | { |
2745 | 0 | convertToSmaller(_val, val); |
2746 | 0 | } |
2747 | | |
2748 | | void convert(unsigned long long& val) const override |
2749 | 0 | { |
2750 | 0 | convertSignedFloatToUnsigned(_val, val); |
2751 | 0 | } |
2752 | | |
2753 | | #endif |
2754 | | |
2755 | | void convert(bool& val) const override |
2756 | 0 | { |
2757 | 0 | val = _val > std::numeric_limits<double>::min() || |
2758 | 0 | _val < -1 * std::numeric_limits<double>::min(); |
2759 | 0 | } |
2760 | | |
2761 | | void convert(float& val) const override |
2762 | 0 | { |
2763 | 0 | const double fMin = -1 * std::numeric_limits<float>::max(); |
2764 | 0 | const double fMax = std::numeric_limits<float>::max(); |
2765 | |
|
2766 | 0 | if (_val < fMin) throw RangeException("Value too small."); |
2767 | 0 | if (_val > fMax) throw RangeException("Value too large."); |
2768 | | |
2769 | 0 | val = static_cast<float>(_val); |
2770 | 0 | } |
2771 | | |
2772 | | void convert(double& val) const override |
2773 | 0 | { |
2774 | 0 | val = _val; |
2775 | 0 | } |
2776 | | |
2777 | | void convert(char& val) const override |
2778 | 0 | { |
2779 | 0 | UInt8 tmp; |
2780 | 0 | convert(tmp); |
2781 | 0 | val = static_cast<char>(tmp); |
2782 | 0 | } |
2783 | | |
2784 | | void convert(std::string& val) const override |
2785 | 0 | { |
2786 | 0 | val = NumberFormatter::format(_val); |
2787 | 0 | } |
2788 | | |
2789 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2790 | 0 | { |
2791 | 0 | return cloneHolder(pVarHolder, _val); |
2792 | 0 | } |
2793 | | |
2794 | | const double& value() const |
2795 | 0 | { |
2796 | 0 | return _val; |
2797 | 0 | } |
2798 | | |
2799 | | bool isArray() const override |
2800 | 0 | { |
2801 | 0 | return false; |
2802 | 0 | } |
2803 | | |
2804 | | bool isStruct() const override |
2805 | 0 | { |
2806 | 0 | return false; |
2807 | 0 | } |
2808 | | |
2809 | | bool isInteger() const override |
2810 | 0 | { |
2811 | 0 | return std::numeric_limits<double>::is_integer; |
2812 | 0 | } |
2813 | | |
2814 | | bool isSigned() const override |
2815 | 0 | { |
2816 | 0 | return std::numeric_limits<double>::is_signed; |
2817 | 0 | } |
2818 | | |
2819 | | bool isNumeric() const override |
2820 | 0 | { |
2821 | 0 | return std::numeric_limits<double>::is_specialized; |
2822 | 0 | } |
2823 | | |
2824 | | bool isBoolean() const override |
2825 | 0 | { |
2826 | 0 | return false; |
2827 | 0 | } |
2828 | | |
2829 | | bool isString() const override |
2830 | 0 | { |
2831 | 0 | return false; |
2832 | 0 | } |
2833 | | |
2834 | | private: |
2835 | | double _val; |
2836 | | }; |
2837 | | |
2838 | | |
2839 | | template <> |
2840 | | class VarHolderImpl<char>: public VarHolder |
2841 | | { |
2842 | | public: |
2843 | | VarHolderImpl(char val): _val(val) |
2844 | 0 | { |
2845 | 0 | } |
2846 | | |
2847 | | ~VarHolderImpl() override = default; |
2848 | | |
2849 | | VarHolderImpl() = delete; |
2850 | | VarHolderImpl(const VarHolderImpl&) = delete; |
2851 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
2852 | | |
2853 | | const std::type_info& type() const override |
2854 | 0 | { |
2855 | 0 | return typeid(char); |
2856 | 0 | } |
2857 | | |
2858 | | void convert(Int8& val) const override |
2859 | 0 | { |
2860 | 0 | val = static_cast<Int8>(_val); |
2861 | 0 | } |
2862 | | |
2863 | | void convert(Int16& val) const override |
2864 | 0 | { |
2865 | 0 | val = static_cast<UInt8>(_val); |
2866 | 0 | } |
2867 | | |
2868 | | void convert(Int32& val) const override |
2869 | 0 | { |
2870 | 0 | val = static_cast<UInt8>(_val); |
2871 | 0 | } |
2872 | | |
2873 | | void convert(Int64& val) const override |
2874 | 0 | { |
2875 | 0 | val = static_cast<UInt8>(_val); |
2876 | 0 | } |
2877 | | |
2878 | | void convert(UInt8& val) const override |
2879 | 0 | { |
2880 | 0 | val = static_cast<UInt8>(_val); |
2881 | 0 | } |
2882 | | |
2883 | | void convert(UInt16& val) const override |
2884 | 0 | { |
2885 | 0 | val = static_cast<UInt8>(_val); |
2886 | 0 | } |
2887 | | |
2888 | | void convert(UInt32& val) const override |
2889 | 0 | { |
2890 | 0 | val = static_cast<UInt8>(_val); |
2891 | 0 | } |
2892 | | |
2893 | | void convert(UInt64& val) const override |
2894 | 0 | { |
2895 | 0 | val = static_cast<UInt8>(_val); |
2896 | 0 | } |
2897 | | |
2898 | | #ifdef POCO_INT64_IS_LONG |
2899 | | |
2900 | | void convert(long long& val) const override |
2901 | 0 | { |
2902 | 0 | val = static_cast<long long>(_val); |
2903 | 0 | } |
2904 | | |
2905 | | void convert(unsigned long long& val) const override |
2906 | 0 | { |
2907 | 0 | val = static_cast<unsigned long long>(_val); |
2908 | 0 | } |
2909 | | |
2910 | | #endif |
2911 | | |
2912 | | void convert(bool& val) const override |
2913 | 0 | { |
2914 | 0 | val = (_val != '\0'); |
2915 | 0 | } |
2916 | | |
2917 | | void convert(float& val) const override |
2918 | 0 | { |
2919 | 0 | val = static_cast<float>(_val); |
2920 | 0 | } |
2921 | | |
2922 | | void convert(double& val) const override |
2923 | 0 | { |
2924 | 0 | val = static_cast<double>(_val); |
2925 | 0 | } |
2926 | | |
2927 | | void convert(char& val) const override |
2928 | 0 | { |
2929 | 0 | val = _val; |
2930 | 0 | } |
2931 | | |
2932 | | void convert(std::string& val) const override |
2933 | 0 | { |
2934 | 0 | val = std::string(1, _val); |
2935 | 0 | } |
2936 | | |
2937 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
2938 | 0 | { |
2939 | 0 | return cloneHolder(pVarHolder, _val); |
2940 | 0 | } |
2941 | | |
2942 | | const char& value() const |
2943 | 0 | { |
2944 | 0 | return _val; |
2945 | 0 | } |
2946 | | |
2947 | | bool isArray() const override |
2948 | 0 | { |
2949 | 0 | return false; |
2950 | 0 | } |
2951 | | |
2952 | | bool isStruct() const override |
2953 | 0 | { |
2954 | 0 | return false; |
2955 | 0 | } |
2956 | | |
2957 | | bool isInteger() const override |
2958 | 0 | { |
2959 | 0 | return std::numeric_limits<char>::is_integer; |
2960 | 0 | } |
2961 | | |
2962 | | bool isSigned() const override |
2963 | 0 | { |
2964 | 0 | return std::numeric_limits<char>::is_signed; |
2965 | 0 | } |
2966 | | |
2967 | | bool isNumeric() const override |
2968 | 0 | { |
2969 | 0 | return std::numeric_limits<char>::is_specialized; |
2970 | 0 | } |
2971 | | |
2972 | | bool isBoolean() const override |
2973 | 0 | { |
2974 | 0 | return false; |
2975 | 0 | } |
2976 | | |
2977 | | bool isString() const override |
2978 | 0 | { |
2979 | 0 | return false; |
2980 | 0 | } |
2981 | | |
2982 | | private: |
2983 | | char _val; |
2984 | | }; |
2985 | | |
2986 | | |
2987 | | template <> |
2988 | | class VarHolderImpl<std::string>: public VarHolder |
2989 | | { |
2990 | | public: |
2991 | | VarHolderImpl(const char* pVal): _val(pVal) |
2992 | 0 | { |
2993 | 0 | } |
2994 | | |
2995 | 0 | VarHolderImpl(const std::string& val) : _val(val) |
2996 | 0 | { |
2997 | 0 | } |
2998 | | |
2999 | 0 | ~VarHolderImpl() override = default; |
3000 | | |
3001 | | VarHolderImpl() = delete; |
3002 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3003 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
3004 | | |
3005 | | const std::type_info& type() const override |
3006 | 0 | { |
3007 | 0 | return typeid(std::string); |
3008 | 0 | } |
3009 | | |
3010 | | void convert(Int8& val) const override |
3011 | 0 | { |
3012 | 0 | const int v = NumberParser::parse(_val); |
3013 | 0 | convertToSmaller(v, val); |
3014 | 0 | } |
3015 | | |
3016 | | void convert(Int16& val) const override |
3017 | 0 | { |
3018 | 0 | const int v = NumberParser::parse(_val); |
3019 | 0 | convertToSmaller(v, val); |
3020 | 0 | } |
3021 | | |
3022 | | void convert(Int32& val) const override |
3023 | 0 | { |
3024 | 0 | val = NumberParser::parse(_val); |
3025 | 0 | } |
3026 | | |
3027 | | void convert(Int64& val) const override |
3028 | 0 | { |
3029 | 0 | val = NumberParser::parse64(_val); |
3030 | 0 | } |
3031 | | |
3032 | | void convert(UInt8& val) const override |
3033 | 0 | { |
3034 | 0 | const unsigned int v = NumberParser::parseUnsigned(_val); |
3035 | 0 | convertToSmallerUnsigned(v, val); |
3036 | 0 | } |
3037 | | |
3038 | | void convert(UInt16& val) const override |
3039 | 0 | { |
3040 | 0 | const unsigned int v = NumberParser::parseUnsigned(_val); |
3041 | 0 | convertToSmallerUnsigned(v, val); |
3042 | 0 | } |
3043 | | |
3044 | | void convert(UInt32& val) const override |
3045 | 0 | { |
3046 | 0 | val = NumberParser::parseUnsigned(_val); |
3047 | 0 | } |
3048 | | |
3049 | | void convert(UInt64& val) const override |
3050 | 0 | { |
3051 | 0 | val = NumberParser::parseUnsigned64(_val); |
3052 | 0 | } |
3053 | | |
3054 | | #ifdef POCO_INT64_IS_LONG |
3055 | | |
3056 | | void convert(long long& val) const override |
3057 | 0 | { |
3058 | 0 | val = NumberParser::parse64(_val); |
3059 | 0 | } |
3060 | | |
3061 | | void convert(unsigned long long& val) const override |
3062 | 0 | { |
3063 | 0 | val = NumberParser::parseUnsigned64(_val); |
3064 | 0 | } |
3065 | | |
3066 | | #endif |
3067 | | |
3068 | | void convert(bool& val) const override |
3069 | 0 | { |
3070 | 0 | if (_val.empty()) |
3071 | 0 | { |
3072 | 0 | val = false; |
3073 | 0 | return; |
3074 | 0 | } |
3075 | | |
3076 | 0 | static const std::string VAL_FALSE("false"); |
3077 | 0 | static const std::string VAL_INT_FALSE("0"); |
3078 | 0 | val = (_val != VAL_INT_FALSE && |
3079 | 0 | (icompare(_val, VAL_FALSE) != 0)); |
3080 | 0 | } |
3081 | | |
3082 | | void convert(float& val) const override |
3083 | 0 | { |
3084 | 0 | const double v = NumberParser::parseFloat(_val); |
3085 | 0 | convertToSmaller(v, val); |
3086 | 0 | } |
3087 | | |
3088 | | void convert(double& val) const override |
3089 | 0 | { |
3090 | 0 | val = NumberParser::parseFloat(_val); |
3091 | 0 | } |
3092 | | |
3093 | | void convert(char& val) const override |
3094 | 0 | { |
3095 | 0 | if (_val.empty()) |
3096 | 0 | val = '\0'; |
3097 | 0 | else |
3098 | 0 | val = _val[0]; |
3099 | 0 | } |
3100 | | |
3101 | | void convert(std::string& val) const override |
3102 | 0 | { |
3103 | 0 | val = _val; |
3104 | 0 | } |
3105 | | |
3106 | | void convert(Poco::UTF16String& val) const override |
3107 | 0 | { |
3108 | 0 | Poco::UnicodeConverter::convert(_val, val); |
3109 | 0 | } |
3110 | | |
3111 | | void convert(DateTime& val) const override |
3112 | 0 | { |
3113 | 0 | int tzd = 0; |
3114 | 0 | if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, _val, val, tzd)) |
3115 | 0 | throw BadCastException("string -> DateTime"); |
3116 | 0 | } |
3117 | | |
3118 | | void convert(LocalDateTime& ldt) const override |
3119 | 0 | { |
3120 | 0 | int tzd = 0; |
3121 | 0 | DateTime tmp; |
3122 | 0 | if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, _val, tmp, tzd)) |
3123 | 0 | throw BadCastException("string -> LocalDateTime"); |
3124 | | |
3125 | 0 | ldt = LocalDateTime(tzd, tmp, false); |
3126 | 0 | } |
3127 | | |
3128 | | void convert(Timestamp& ts) const override |
3129 | 0 | { |
3130 | 0 | int tzd = 0; |
3131 | 0 | DateTime tmp; |
3132 | 0 | if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, _val, tmp, tzd)) |
3133 | 0 | throw BadCastException("string -> Timestamp"); |
3134 | | |
3135 | 0 | ts = tmp.timestamp(); |
3136 | 0 | } |
3137 | | |
3138 | | void convert(UUID& uuid) const override |
3139 | 0 | { |
3140 | 0 | uuid.parse(_val); |
3141 | 0 | } |
3142 | | |
3143 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
3144 | 0 | { |
3145 | 0 | return cloneHolder(pVarHolder, _val); |
3146 | 0 | } |
3147 | | |
3148 | | const std:: string& value() const |
3149 | 0 | { |
3150 | 0 | return _val; |
3151 | 0 | } |
3152 | | |
3153 | | bool isString() const override |
3154 | 0 | { |
3155 | 0 | return true; |
3156 | 0 | } |
3157 | | |
3158 | | std::size_t size() const override |
3159 | 0 | { |
3160 | 0 | return _val.length(); |
3161 | 0 | } |
3162 | | |
3163 | | char& operator[](std::string::size_type n) |
3164 | 0 | { |
3165 | 0 | if (n < size()) return _val.operator[](n); |
3166 | | |
3167 | 0 | throw RangeException("String index out of range"); |
3168 | 0 | } |
3169 | | |
3170 | | const char& operator[](std::string::size_type n) const |
3171 | 0 | { |
3172 | 0 | if (n < size()) return _val.operator[](n); |
3173 | 0 |
|
3174 | 0 | throw RangeException("String index out of range"); |
3175 | 0 | } |
3176 | | |
3177 | | private: |
3178 | | std::string _val; |
3179 | | }; |
3180 | | |
3181 | | |
3182 | | template <> |
3183 | | class VarHolderImpl<UTF16String>: public VarHolder |
3184 | | { |
3185 | | public: |
3186 | | VarHolderImpl(const char* pVal) : _val(Poco::UnicodeConverter::to<UTF16String>(pVal)) |
3187 | 0 | { |
3188 | 0 | } |
3189 | | |
3190 | | VarHolderImpl(const Poco::UTF16String& val) : _val(val) |
3191 | 0 | { |
3192 | 0 | } |
3193 | | |
3194 | | ~VarHolderImpl() override = default; |
3195 | | |
3196 | | VarHolderImpl() = delete; |
3197 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3198 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
3199 | | |
3200 | | const std::type_info& type() const override |
3201 | 0 | { |
3202 | 0 | return typeid(Poco::UTF16String); |
3203 | 0 | } |
3204 | | |
3205 | | void convert(Int8& val) const override |
3206 | 0 | { |
3207 | 0 | const int v = NumberParser::parse(toStdString()); |
3208 | 0 | convertToSmaller(v, val); |
3209 | 0 | } |
3210 | | |
3211 | | void convert(Int16& val) const override |
3212 | 0 | { |
3213 | 0 | const int v = NumberParser::parse(toStdString()); |
3214 | 0 | convertToSmaller(v, val); |
3215 | 0 | } |
3216 | | |
3217 | | void convert(Int32& val) const override |
3218 | 0 | { |
3219 | 0 | val = NumberParser::parse(toStdString()); |
3220 | 0 | } |
3221 | | |
3222 | | void convert(Int64& val) const override |
3223 | 0 | { |
3224 | 0 | val = NumberParser::parse64(toStdString()); |
3225 | 0 | } |
3226 | | |
3227 | | void convert(UInt8& val) const override |
3228 | 0 | { |
3229 | 0 | const unsigned int v = NumberParser::parseUnsigned(toStdString()); |
3230 | 0 | convertToSmallerUnsigned(v, val); |
3231 | 0 | } |
3232 | | |
3233 | | void convert(UInt16& val) const override |
3234 | 0 | { |
3235 | 0 | const unsigned int v = NumberParser::parseUnsigned(toStdString()); |
3236 | 0 | convertToSmallerUnsigned(v, val); |
3237 | 0 | } |
3238 | | |
3239 | | void convert(UInt32& val) const override |
3240 | 0 | { |
3241 | 0 | val = NumberParser::parseUnsigned(toStdString()); |
3242 | 0 | } |
3243 | | |
3244 | | void convert(UInt64& val) const override |
3245 | 0 | { |
3246 | 0 | val = NumberParser::parseUnsigned64(toStdString()); |
3247 | 0 | } |
3248 | | |
3249 | | #ifdef POCO_INT64_IS_LONG |
3250 | | |
3251 | | void convert(long long& val) const override |
3252 | 0 | { |
3253 | 0 | val = NumberParser::parse64(toStdString()); |
3254 | 0 | } |
3255 | | |
3256 | | void convert(unsigned long long& val) const override |
3257 | 0 | { |
3258 | 0 | val = NumberParser::parseUnsigned64(toStdString()); |
3259 | 0 | } |
3260 | | |
3261 | | #endif |
3262 | | |
3263 | | void convert(bool& val) const override |
3264 | 0 | { |
3265 | 0 | static const std::string VAL_FALSE("false"); |
3266 | 0 | static const std::string VAL_INT_FALSE("0"); |
3267 | 0 |
|
3268 | 0 | if (_val.empty()) val = false; |
3269 | 0 |
|
3270 | 0 | std::string str; |
3271 | 0 | UnicodeConverter::convert(_val, str); |
3272 | 0 | val = (str != VAL_INT_FALSE && |
3273 | 0 | (icompare(str, VAL_FALSE) != 0)); |
3274 | 0 | } |
3275 | | |
3276 | | void convert(float& val) const override |
3277 | 0 | { |
3278 | 0 | const double v = NumberParser::parseFloat(toStdString()); |
3279 | 0 | convertToSmaller(v, val); |
3280 | 0 | } |
3281 | | |
3282 | | void convert(double& val) const override |
3283 | 0 | { |
3284 | 0 | val = NumberParser::parseFloat(toStdString()); |
3285 | 0 | } |
3286 | | |
3287 | | void convert(char& val) const override |
3288 | 0 | { |
3289 | 0 | if (_val.empty()) |
3290 | 0 | val = '\0'; |
3291 | 0 | else |
3292 | 0 | { |
3293 | 0 | std::string s; |
3294 | 0 | UnicodeConverter::convert(_val, s); |
3295 | 0 | val = s[0]; |
3296 | 0 | } |
3297 | 0 | } |
3298 | | |
3299 | | void convert(Poco::UTF16String& val) const override |
3300 | 0 | { |
3301 | 0 | val = _val; |
3302 | 0 | } |
3303 | | |
3304 | | void convert(std::string& val) const override |
3305 | 0 | { |
3306 | 0 | UnicodeConverter::convert(_val, val); |
3307 | 0 | } |
3308 | | |
3309 | | void convert(DateTime& val) const override |
3310 | 0 | { |
3311 | 0 | int tzd = 0; |
3312 | 0 | if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, toStdString(), val, tzd)) |
3313 | 0 | throw BadCastException("string -> DateTime"); |
3314 | 0 | } |
3315 | | |
3316 | | void convert(LocalDateTime& ldt) const override |
3317 | 0 | { |
3318 | 0 | int tzd = 0; |
3319 | 0 | DateTime tmp; |
3320 | 0 | if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, toStdString(), tmp, tzd)) |
3321 | 0 | throw BadCastException("string -> LocalDateTime"); |
3322 | 0 |
|
3323 | 0 | ldt = LocalDateTime(tzd, tmp, false); |
3324 | 0 | } |
3325 | | |
3326 | | void convert(Timestamp& ts) const override |
3327 | 0 | { |
3328 | 0 | int tzd = 0; |
3329 | 0 | DateTime tmp; |
3330 | 0 | if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, toStdString(), tmp, tzd)) |
3331 | 0 | throw BadCastException("string -> Timestamp"); |
3332 | 0 |
|
3333 | 0 | ts = tmp.timestamp(); |
3334 | 0 | } |
3335 | | |
3336 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
3337 | 0 | { |
3338 | 0 | return cloneHolder(pVarHolder, _val); |
3339 | 0 | } |
3340 | | |
3341 | | const Poco::UTF16String& value() const |
3342 | 0 | { |
3343 | 0 | return _val; |
3344 | 0 | } |
3345 | | |
3346 | | bool isString() const override |
3347 | 0 | { |
3348 | 0 | return true; |
3349 | 0 | } |
3350 | | |
3351 | | std::size_t size() const override |
3352 | 0 | { |
3353 | 0 | return _val.length(); |
3354 | 0 | } |
3355 | | |
3356 | | UTF16Char& operator[](Poco::UTF16String::size_type n) |
3357 | 0 | { |
3358 | 0 | if (n < size()) return _val.operator[](n); |
3359 | 0 |
|
3360 | 0 | throw RangeException("String index out of range"); |
3361 | 0 | } |
3362 | | |
3363 | | const UTF16Char& operator[](Poco::UTF16String::size_type n) const |
3364 | 0 | { |
3365 | 0 | if (n < size()) return _val.operator[](n); |
3366 | 0 |
|
3367 | 0 | throw RangeException("String index out of range"); |
3368 | 0 | } |
3369 | | |
3370 | | private: |
3371 | | std::string toStdString() const |
3372 | 0 | { |
3373 | 0 | std::string str; |
3374 | 0 | UnicodeConverter::convert(_val, str); |
3375 | 0 | return str; |
3376 | 0 | } |
3377 | | |
3378 | | Poco::UTF16String _val; |
3379 | | }; |
3380 | | |
3381 | | |
3382 | | #ifndef POCO_INT64_IS_LONG |
3383 | | |
3384 | | |
3385 | | template <> |
3386 | | class VarHolderImpl<long>: public VarHolder |
3387 | | { |
3388 | | public: |
3389 | | VarHolderImpl(long val): _val(val) |
3390 | | { |
3391 | | } |
3392 | | |
3393 | | ~VarHolderImpl() override = default; |
3394 | | |
3395 | | VarHolderImpl() = delete; |
3396 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3397 | | VarHolderImpl& operator = (const VarHolderImpl&) = delete; |
3398 | | |
3399 | | const std::type_info& type() const override |
3400 | | { |
3401 | | return typeid(long); |
3402 | | } |
3403 | | |
3404 | | void convert(Int8& val) const override |
3405 | | { |
3406 | | convertToSmaller(_val, val); |
3407 | | } |
3408 | | |
3409 | | void convert(Int16& val) const override |
3410 | | { |
3411 | | convertToSmaller(_val, val); |
3412 | | } |
3413 | | |
3414 | | void convert(Int32& val) const override |
3415 | | { |
3416 | | val = static_cast<Int32>(_val); |
3417 | | } |
3418 | | |
3419 | | void convert(Int64& val) const override |
3420 | | { |
3421 | | val = static_cast<Int64>(_val); |
3422 | | } |
3423 | | |
3424 | | void convert(UInt8& val) const override |
3425 | | { |
3426 | | convertSignedToUnsigned(_val, val); |
3427 | | } |
3428 | | |
3429 | | void convert(UInt16& val) const override |
3430 | | { |
3431 | | convertSignedToUnsigned(_val, val); |
3432 | | } |
3433 | | |
3434 | | void convert(UInt32& val) const override |
3435 | | { |
3436 | | convertSignedToUnsigned(_val, val); |
3437 | | } |
3438 | | |
3439 | | void convert(UInt64& val) const override |
3440 | | { |
3441 | | convertSignedToUnsigned(_val, val); |
3442 | | } |
3443 | | |
3444 | | void convert(bool& val) const override |
3445 | | { |
3446 | | val = (_val != 0); |
3447 | | } |
3448 | | |
3449 | | void convert(float& val) const override |
3450 | | { |
3451 | | val = static_cast<float>(_val); |
3452 | | } |
3453 | | |
3454 | | void convert(double& val) const override |
3455 | | { |
3456 | | val = static_cast<double>(_val); |
3457 | | } |
3458 | | |
3459 | | void convert(char& val) const override |
3460 | | { |
3461 | | UInt8 tmp; |
3462 | | convert(tmp); |
3463 | | val = static_cast<char>(tmp); |
3464 | | } |
3465 | | |
3466 | | void convert(std::string& val) const override |
3467 | | { |
3468 | | val = NumberFormatter::format(_val); |
3469 | | } |
3470 | | |
3471 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const override |
3472 | | { |
3473 | | return cloneHolder(pVarHolder, _val); |
3474 | | } |
3475 | | |
3476 | | const long& value() const |
3477 | | { |
3478 | | return _val; |
3479 | | } |
3480 | | |
3481 | | bool isArray() const override |
3482 | | { |
3483 | | return false; |
3484 | | } |
3485 | | |
3486 | | bool isStruct() const override |
3487 | | { |
3488 | | return false; |
3489 | | } |
3490 | | |
3491 | | bool isInteger() const override |
3492 | | { |
3493 | | return std::numeric_limits<long>::is_integer; |
3494 | | } |
3495 | | |
3496 | | bool isSigned() const override |
3497 | | { |
3498 | | return std::numeric_limits<long>::is_signed; |
3499 | | } |
3500 | | |
3501 | | bool isNumeric() const override |
3502 | | { |
3503 | | return std::numeric_limits<long>::is_specialized; |
3504 | | } |
3505 | | |
3506 | | bool isBoolean() const override |
3507 | | { |
3508 | | return false; |
3509 | | } |
3510 | | |
3511 | | bool isString() const override |
3512 | | { |
3513 | | return false; |
3514 | | } |
3515 | | |
3516 | | private: |
3517 | | long _val; |
3518 | | }; |
3519 | | |
3520 | | |
3521 | | template <> |
3522 | | class VarHolderImpl<unsigned long>: public VarHolder |
3523 | | { |
3524 | | public: |
3525 | | VarHolderImpl(unsigned long val): _val(val) |
3526 | | { |
3527 | | } |
3528 | | |
3529 | | ~VarHolderImpl() override = default; |
3530 | | |
3531 | | VarHolderImpl() = delete; |
3532 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3533 | | VarHolderImpl& operator = (const VarHolderImpl&) = delete; |
3534 | | |
3535 | | const std::type_info& type() const override |
3536 | | { |
3537 | | return typeid(unsigned long); |
3538 | | } |
3539 | | |
3540 | | void convert(Int8& val) const override |
3541 | | { |
3542 | | convertUnsignedToSigned(_val, val); |
3543 | | } |
3544 | | |
3545 | | void convert(Int16& val) const override |
3546 | | { |
3547 | | convertUnsignedToSigned(_val, val); |
3548 | | } |
3549 | | |
3550 | | void convert(Int32& val) const override |
3551 | | { |
3552 | | convertUnsignedToSigned(_val, val); |
3553 | | } |
3554 | | |
3555 | | void convert(Int64& val) const override |
3556 | | { |
3557 | | convertUnsignedToSigned(_val, val); |
3558 | | } |
3559 | | |
3560 | | void convert(UInt8& val) const override |
3561 | | { |
3562 | | convertToSmallerUnsigned(_val, val); |
3563 | | } |
3564 | | |
3565 | | void convert(UInt16& val) const override |
3566 | | { |
3567 | | convertToSmallerUnsigned(_val, val); |
3568 | | } |
3569 | | |
3570 | | void convert(UInt32& val) const override |
3571 | | { |
3572 | | convertToSmallerUnsigned(_val, val); |
3573 | | } |
3574 | | |
3575 | | void convert(UInt64& val) const override |
3576 | | { |
3577 | | val = static_cast<UInt64>(_val); |
3578 | | } |
3579 | | |
3580 | | void convert(bool& val) const override |
3581 | | { |
3582 | | val = (_val != 0); |
3583 | | } |
3584 | | |
3585 | | void convert(float& val) const override |
3586 | | { |
3587 | | val = static_cast<float>(_val); |
3588 | | } |
3589 | | |
3590 | | void convert(double& val) const override |
3591 | | { |
3592 | | val = static_cast<double>(_val); |
3593 | | } |
3594 | | |
3595 | | void convert(char& val) const override |
3596 | | { |
3597 | | UInt8 tmp; |
3598 | | convert(tmp); |
3599 | | val = static_cast<char>(tmp); |
3600 | | } |
3601 | | |
3602 | | void convert(std::string& val) const override |
3603 | | { |
3604 | | val = NumberFormatter::format(_val); |
3605 | | } |
3606 | | |
3607 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const override |
3608 | | { |
3609 | | return cloneHolder(pVarHolder, _val); |
3610 | | } |
3611 | | |
3612 | | const unsigned long& value() const |
3613 | | { |
3614 | | return _val; |
3615 | | } |
3616 | | |
3617 | | bool isArray() const override |
3618 | | { |
3619 | | return false; |
3620 | | } |
3621 | | |
3622 | | bool isStruct() const override |
3623 | | { |
3624 | | return false; |
3625 | | } |
3626 | | |
3627 | | bool isInteger() const override |
3628 | | { |
3629 | | return std::numeric_limits<unsigned long>::is_integer; |
3630 | | } |
3631 | | |
3632 | | bool isSigned() const override |
3633 | | { |
3634 | | return std::numeric_limits<unsigned long>::is_signed; |
3635 | | } |
3636 | | |
3637 | | bool isNumeric() const override |
3638 | | { |
3639 | | return std::numeric_limits<unsigned long>::is_specialized; |
3640 | | } |
3641 | | |
3642 | | bool isBoolean() const override |
3643 | | { |
3644 | | return false; |
3645 | | } |
3646 | | |
3647 | | bool isString() const override |
3648 | | { |
3649 | | return false; |
3650 | | } |
3651 | | |
3652 | | private: |
3653 | | unsigned long _val; |
3654 | | }; |
3655 | | |
3656 | | |
3657 | | #else // if defined (POCO_INT64_IS_LONG) |
3658 | | |
3659 | | |
3660 | | template <> |
3661 | | class VarHolderImpl<long long>: public VarHolder |
3662 | | { |
3663 | | public: |
3664 | | VarHolderImpl(long long val): _val(val) |
3665 | 0 | { |
3666 | 0 | } |
3667 | | |
3668 | | ~VarHolderImpl() override = default; |
3669 | | |
3670 | | VarHolderImpl() = delete; |
3671 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3672 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
3673 | | |
3674 | | const std::type_info& type() const override |
3675 | 0 | { |
3676 | 0 | return typeid(long long); |
3677 | 0 | } |
3678 | | |
3679 | | void convert(Int8& val) const override |
3680 | 0 | { |
3681 | 0 | convertToSmaller(_val, val); |
3682 | 0 | } |
3683 | | |
3684 | | void convert(Int16& val) const override |
3685 | 0 | { |
3686 | 0 | convertToSmaller(_val, val); |
3687 | 0 | } |
3688 | | |
3689 | | void convert(Int32& val) const override |
3690 | 0 | { |
3691 | 0 | convertToSmaller(_val, val); |
3692 | 0 | } |
3693 | | |
3694 | | void convert(Int64& val) const override |
3695 | 0 | { |
3696 | 0 | val = static_cast<Int64>(_val); |
3697 | 0 | } |
3698 | | |
3699 | | void convert(UInt8& val) const override |
3700 | 0 | { |
3701 | 0 | convertSignedToUnsigned(_val, val); |
3702 | 0 | } |
3703 | | |
3704 | | void convert(UInt16& val) const override |
3705 | 0 | { |
3706 | 0 | convertSignedToUnsigned(_val, val); |
3707 | 0 | } |
3708 | | |
3709 | | void convert(UInt32& val) const override |
3710 | 0 | { |
3711 | 0 | convertSignedToUnsigned(_val, val); |
3712 | 0 | } |
3713 | | |
3714 | | void convert(UInt64& val) const override |
3715 | 0 | { |
3716 | 0 | convertSignedToUnsigned(_val, val); |
3717 | 0 | } |
3718 | | |
3719 | | void convert(long long& val) const override |
3720 | 0 | { |
3721 | 0 | val = _val; |
3722 | 0 | } |
3723 | | |
3724 | | void convert(unsigned long long& val) const override |
3725 | 0 | { |
3726 | 0 | convertSignedToUnsigned(_val, val); |
3727 | 0 | } |
3728 | | |
3729 | | void convert(bool& val) const override |
3730 | 0 | { |
3731 | 0 | val = (_val != 0); |
3732 | 0 | } |
3733 | | |
3734 | | void convert(float& val) const override |
3735 | 0 | { |
3736 | 0 | val = static_cast<float>(_val); |
3737 | 0 | } |
3738 | | |
3739 | | void convert(double& val) const override |
3740 | 0 | { |
3741 | 0 | val = static_cast<double>(_val); |
3742 | 0 | } |
3743 | | |
3744 | | void convert(char& val) const override |
3745 | 0 | { |
3746 | 0 | UInt8 tmp; |
3747 | 0 | convert(tmp); |
3748 | 0 | val = static_cast<char>(tmp); |
3749 | 0 | } |
3750 | | |
3751 | | void convert(std::string& val) const override |
3752 | 0 | { |
3753 | 0 | val = NumberFormatter::format(_val); |
3754 | 0 | } |
3755 | | |
3756 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
3757 | 0 | { |
3758 | 0 | return cloneHolder(pVarHolder, _val); |
3759 | 0 | } |
3760 | | |
3761 | | const long long& value() const |
3762 | 0 | { |
3763 | 0 | return _val; |
3764 | 0 | } |
3765 | | |
3766 | | bool isArray() const override |
3767 | 0 | { |
3768 | 0 | return false; |
3769 | 0 | } |
3770 | | |
3771 | | bool isStruct() const override |
3772 | 0 | { |
3773 | 0 | return false; |
3774 | 0 | } |
3775 | | |
3776 | | bool isInteger() const override |
3777 | 0 | { |
3778 | 0 | return std::numeric_limits<long long>::is_integer; |
3779 | 0 | } |
3780 | | |
3781 | | bool isSigned() const override |
3782 | 0 | { |
3783 | 0 | return std::numeric_limits<long long>::is_signed; |
3784 | 0 | } |
3785 | | |
3786 | | bool isNumeric() const override |
3787 | 0 | { |
3788 | 0 | return std::numeric_limits<long long>::is_specialized; |
3789 | 0 | } |
3790 | | |
3791 | | bool isBoolean() const override |
3792 | 0 | { |
3793 | 0 | return false; |
3794 | 0 | } |
3795 | | |
3796 | | bool isString() const override |
3797 | 0 | { |
3798 | 0 | return false; |
3799 | 0 | } |
3800 | | |
3801 | | private: |
3802 | | long long _val; |
3803 | | }; |
3804 | | |
3805 | | |
3806 | | template <> |
3807 | | class VarHolderImpl<unsigned long long>: public VarHolder |
3808 | | { |
3809 | | public: |
3810 | | VarHolderImpl(unsigned long long val): _val(val) |
3811 | 0 | { |
3812 | 0 | } |
3813 | | |
3814 | | ~VarHolderImpl() override = default; |
3815 | | |
3816 | | VarHolderImpl() = delete; |
3817 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3818 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
3819 | | |
3820 | | const std::type_info& type() const override |
3821 | 0 | { |
3822 | 0 | return typeid(unsigned long long); |
3823 | 0 | } |
3824 | | |
3825 | | void convert(Int8& val) const override |
3826 | 0 | { |
3827 | 0 | convertUnsignedToSigned(_val, val); |
3828 | 0 | } |
3829 | | |
3830 | | void convert(Int16& val) const override |
3831 | 0 | { |
3832 | 0 | convertUnsignedToSigned(_val, val); |
3833 | 0 | } |
3834 | | |
3835 | | void convert(Int32& val) const override |
3836 | 0 | { |
3837 | 0 | convertUnsignedToSigned(_val, val); |
3838 | 0 | } |
3839 | | |
3840 | | void convert(Int64& val) const override |
3841 | 0 | { |
3842 | 0 | convertUnsignedToSigned(_val, val); |
3843 | 0 | } |
3844 | | |
3845 | | void convert(UInt8& val) const override |
3846 | 0 | { |
3847 | 0 | convertToSmallerUnsigned(_val, val); |
3848 | 0 | } |
3849 | | |
3850 | | void convert(UInt16& val) const override |
3851 | 0 | { |
3852 | 0 | convertToSmallerUnsigned(_val, val); |
3853 | 0 | } |
3854 | | |
3855 | | void convert(UInt32& val) const override |
3856 | 0 | { |
3857 | 0 | convertToSmallerUnsigned(_val, val); |
3858 | 0 | } |
3859 | | |
3860 | | void convert(UInt64& val) const override |
3861 | 0 | { |
3862 | 0 | val = static_cast<UInt64>(_val); |
3863 | 0 | } |
3864 | | |
3865 | | void convert(long long& val) const override |
3866 | 0 | { |
3867 | 0 | convertUnsignedToSigned(_val, val); |
3868 | 0 | } |
3869 | | |
3870 | | void convert(unsigned long long& val) const override |
3871 | 0 | { |
3872 | 0 | val = _val; |
3873 | 0 | } |
3874 | | |
3875 | | void convert(bool& val) const override |
3876 | 0 | { |
3877 | 0 | val = (_val != 0); |
3878 | 0 | } |
3879 | | |
3880 | | void convert(float& val) const override |
3881 | 0 | { |
3882 | 0 | val = static_cast<float>(_val); |
3883 | 0 | } |
3884 | | |
3885 | | void convert(double& val) const override |
3886 | 0 | { |
3887 | 0 | val = static_cast<double>(_val); |
3888 | 0 | } |
3889 | | |
3890 | | void convert(char& val) const override |
3891 | 0 | { |
3892 | 0 | UInt8 tmp; |
3893 | 0 | convert(tmp); |
3894 | 0 | val = static_cast<char>(tmp); |
3895 | 0 | } |
3896 | | |
3897 | | void convert(std::string& val) const override |
3898 | 0 | { |
3899 | 0 | val = NumberFormatter::format(_val); |
3900 | 0 | } |
3901 | | |
3902 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
3903 | 0 | { |
3904 | 0 | return cloneHolder(pVarHolder, _val); |
3905 | 0 | } |
3906 | | |
3907 | | const unsigned long long& value() const |
3908 | 0 | { |
3909 | 0 | return _val; |
3910 | 0 | } |
3911 | | |
3912 | | bool isArray() const override |
3913 | 0 | { |
3914 | 0 | return false; |
3915 | 0 | } |
3916 | | |
3917 | | bool isStruct() const override |
3918 | 0 | { |
3919 | 0 | return false; |
3920 | 0 | } |
3921 | | |
3922 | | bool isInteger() const override |
3923 | 0 | { |
3924 | 0 | return std::numeric_limits<unsigned long long>::is_integer; |
3925 | 0 | } |
3926 | | |
3927 | | bool isSigned() const override |
3928 | 0 | { |
3929 | 0 | return std::numeric_limits<unsigned long long>::is_signed; |
3930 | 0 | } |
3931 | | |
3932 | | bool isNumeric() const override |
3933 | 0 | { |
3934 | 0 | return std::numeric_limits<unsigned long long>::is_specialized; |
3935 | 0 | } |
3936 | | |
3937 | | bool isBoolean() const override |
3938 | 0 | { |
3939 | 0 | return false; |
3940 | 0 | } |
3941 | | |
3942 | | bool isString() const override |
3943 | 0 | { |
3944 | 0 | return false; |
3945 | 0 | } |
3946 | | |
3947 | | private: |
3948 | | unsigned long long _val; |
3949 | | }; |
3950 | | |
3951 | | |
3952 | | #endif // POCO_INT64_IS_LONG |
3953 | | |
3954 | | |
3955 | | template <typename T> |
3956 | | class VarHolderImpl<std::vector<T>>: public VarHolder |
3957 | | { |
3958 | | public: |
3959 | 0 | VarHolderImpl(const std::vector<T>& val): _val(val) |
3960 | 0 | { |
3961 | 0 | } |
3962 | | |
3963 | 0 | ~VarHolderImpl() override = default; |
3964 | | |
3965 | | VarHolderImpl() = delete; |
3966 | | VarHolderImpl(const VarHolderImpl&) = delete; |
3967 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
3968 | | |
3969 | | const std::type_info& type() const override |
3970 | 0 | { |
3971 | 0 | return typeid(std::vector<T>); |
3972 | 0 | } |
3973 | | |
3974 | | void convert(std::string& val) const override |
3975 | 0 | { |
3976 | 0 | Impl::containerToJSON(_val, val); |
3977 | 0 | } |
3978 | | |
3979 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
3980 | 0 | { |
3981 | 0 | return cloneHolder(pVarHolder, _val); |
3982 | 0 | } |
3983 | | |
3984 | | const std::vector<T>& value() const |
3985 | | { |
3986 | | return _val; |
3987 | | } |
3988 | | |
3989 | | bool isVector() const override |
3990 | 0 | { |
3991 | 0 | return true; |
3992 | 0 | } |
3993 | | |
3994 | | std::size_t size() const override |
3995 | 0 | { |
3996 | 0 | return _val.size(); |
3997 | 0 | } |
3998 | | |
3999 | | T& operator[](typename std::vector<T>::size_type n) |
4000 | 0 | { |
4001 | 0 | if (n < size()) return _val.operator[](n); |
4002 | | |
4003 | 0 | throw RangeException("List index out of range"); |
4004 | 0 | } |
4005 | | |
4006 | | const T& operator[](typename std::vector<T>::size_type n) const |
4007 | | { |
4008 | | if (n < size()) return _val.operator[](n); |
4009 | | |
4010 | | throw RangeException("List index out of range"); |
4011 | | } |
4012 | | |
4013 | | private: |
4014 | | std::vector<T> _val; |
4015 | | }; |
4016 | | |
4017 | | |
4018 | | template <typename T> |
4019 | | class VarHolderImpl<std::list<T>>: public VarHolder |
4020 | | { |
4021 | | public: |
4022 | | VarHolderImpl(const std::list<T>& val): _val(val) |
4023 | | { |
4024 | | } |
4025 | | |
4026 | | ~VarHolderImpl() override = default; |
4027 | | |
4028 | | VarHolderImpl() = delete; |
4029 | | VarHolderImpl(const VarHolderImpl&) = delete; |
4030 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
4031 | | |
4032 | | const std::type_info& type() const override |
4033 | | { |
4034 | | return typeid(std::list<T>); |
4035 | | } |
4036 | | |
4037 | | void convert(std::string& val) const override |
4038 | | { |
4039 | | Impl::containerToJSON(_val, val); |
4040 | | } |
4041 | | |
4042 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
4043 | | { |
4044 | | return cloneHolder(pVarHolder, _val); |
4045 | | } |
4046 | | |
4047 | | const std::list<T>& value() const |
4048 | | { |
4049 | | return _val; |
4050 | | } |
4051 | | |
4052 | | bool isList() const override |
4053 | | { |
4054 | | return true; |
4055 | | } |
4056 | | |
4057 | | std::size_t size() const override |
4058 | 0 | { |
4059 | 0 | return _val.size(); |
4060 | 0 | } |
4061 | | |
4062 | | T& operator[](typename std::list<T>::size_type n) |
4063 | 0 | { |
4064 | 0 | if (n >= size()) |
4065 | 0 | throw RangeException("List index out of range"); |
4066 | | |
4067 | 0 | typename std::list<T>::size_type counter = 0; |
4068 | 0 | typename std::list<T>::iterator it = _val.begin(); |
4069 | 0 | for (; counter < n; ++counter) ++it; |
4070 | |
|
4071 | 0 | return *it; |
4072 | 0 | } |
4073 | | |
4074 | | const T& operator[](typename std::list<T>::size_type n) const |
4075 | | { |
4076 | | if (n >= size()) |
4077 | | throw RangeException("List index out of range"); |
4078 | | |
4079 | | typename std::list<T>::size_type counter = 0; |
4080 | | typename std::list<T>::const_iterator it = _val.begin(); |
4081 | | for (; counter < n; ++counter) ++it; |
4082 | | |
4083 | | return *it; |
4084 | | } |
4085 | | |
4086 | | private: |
4087 | | std::list<T> _val; |
4088 | | }; |
4089 | | |
4090 | | |
4091 | | template <typename T> |
4092 | | class VarHolderImpl<std::deque<T>>: public VarHolder |
4093 | | { |
4094 | | public: |
4095 | | VarHolderImpl(const std::deque<T>& val): _val(val) |
4096 | | { |
4097 | | } |
4098 | | |
4099 | | ~VarHolderImpl() override = default; |
4100 | | |
4101 | | VarHolderImpl() = delete; |
4102 | | VarHolderImpl(const VarHolderImpl&) = delete; |
4103 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
4104 | | |
4105 | | const std::type_info& type() const override |
4106 | | { |
4107 | | return typeid(std::deque<T>); |
4108 | | } |
4109 | | |
4110 | | void convert(std::string& val) const override |
4111 | | { |
4112 | | Impl::containerToJSON(_val, val); |
4113 | | } |
4114 | | |
4115 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
4116 | | { |
4117 | | return cloneHolder(pVarHolder, _val); |
4118 | | } |
4119 | | |
4120 | | const std::deque<T>& value() const |
4121 | | { |
4122 | | return _val; |
4123 | | } |
4124 | | |
4125 | | bool isDeque() const override |
4126 | | { |
4127 | | return true; |
4128 | | } |
4129 | | |
4130 | | std::size_t size() const override |
4131 | 0 | { |
4132 | 0 | return _val.size(); |
4133 | 0 | } |
4134 | | |
4135 | | T& operator[](typename std::deque<T>::size_type n) |
4136 | 0 | { |
4137 | 0 | if (n < size()) return _val.operator[](n); |
4138 | | |
4139 | 0 | throw RangeException("List index out of range"); |
4140 | 0 | } |
4141 | | |
4142 | | const T& operator[](typename std::deque<T>::size_type n) const |
4143 | | { |
4144 | | if (n < size()) return _val.operator[](n); |
4145 | | |
4146 | | throw RangeException("List index out of range"); |
4147 | | } |
4148 | | |
4149 | | private: |
4150 | | std::deque<T> _val; |
4151 | | }; |
4152 | | |
4153 | | |
4154 | | template <> |
4155 | | class VarHolderImpl<DateTime>: public VarHolder |
4156 | | { |
4157 | | public: |
4158 | | VarHolderImpl(const DateTime& val): _val(val) |
4159 | 0 | { |
4160 | 0 | } |
4161 | | |
4162 | | ~VarHolderImpl() override = default; |
4163 | | |
4164 | | VarHolderImpl() = delete; |
4165 | | VarHolderImpl(const VarHolderImpl&) = delete; |
4166 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
4167 | | |
4168 | | const std::type_info& type() const override |
4169 | 0 | { |
4170 | 0 | return typeid(DateTime); |
4171 | 0 | } |
4172 | | |
4173 | | void convert(Int8 & /*val*/) const override |
4174 | 0 | { |
4175 | 0 | throw BadCastException(); |
4176 | 0 | } |
4177 | | |
4178 | | void convert(Int16 & /*val*/) const override |
4179 | 0 | { |
4180 | 0 | throw BadCastException(); |
4181 | 0 | } |
4182 | | |
4183 | | void convert(Int32 & /*val*/) const override |
4184 | 0 | { |
4185 | 0 | throw BadCastException(); |
4186 | 0 | } |
4187 | | |
4188 | | void convert(Int64& val) const override |
4189 | 0 | { |
4190 | 0 | val = _val.timestamp().epochMicroseconds(); |
4191 | 0 | } |
4192 | | |
4193 | | void convert(UInt64& val) const override |
4194 | 0 | { |
4195 | 0 | val = _val.timestamp().epochMicroseconds(); |
4196 | 0 | } |
4197 | | |
4198 | | #ifdef POCO_INT64_IS_LONG |
4199 | | |
4200 | | void convert(long long& val) const override |
4201 | 0 | { |
4202 | 0 | val = _val.timestamp().epochMicroseconds(); |
4203 | 0 | } |
4204 | | |
4205 | | void convert(unsigned long long& val) const override |
4206 | 0 | { |
4207 | 0 | val = _val.timestamp().epochMicroseconds(); |
4208 | 0 | } |
4209 | | |
4210 | | #endif |
4211 | | |
4212 | | void convert(std::string& val) const override |
4213 | 0 | { |
4214 | 0 | val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT); |
4215 | 0 | } |
4216 | | |
4217 | | void convert(DateTime& val) const override |
4218 | 0 | { |
4219 | 0 | val = _val; |
4220 | 0 | } |
4221 | | |
4222 | | void convert(LocalDateTime &ldt) const override |
4223 | 0 | { |
4224 | 0 | ldt = _val.timestamp(); |
4225 | 0 | } |
4226 | | |
4227 | | void convert(Timestamp &ts) const override |
4228 | 0 | { |
4229 | 0 | ts = _val.timestamp(); |
4230 | 0 | } |
4231 | | |
4232 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
4233 | 0 | { |
4234 | 0 | return cloneHolder(pVarHolder, _val); |
4235 | 0 | } |
4236 | | |
4237 | | const DateTime& value() const |
4238 | 0 | { |
4239 | 0 | return _val; |
4240 | 0 | } |
4241 | | |
4242 | | bool isArray() const override |
4243 | 0 | { |
4244 | 0 | return false; |
4245 | 0 | } |
4246 | | |
4247 | | bool isStruct() const override |
4248 | 0 | { |
4249 | 0 | return false; |
4250 | 0 | } |
4251 | | |
4252 | | bool isInteger() const override |
4253 | 0 | { |
4254 | 0 | return false; |
4255 | 0 | } |
4256 | | |
4257 | | bool isSigned() const override |
4258 | 0 | { |
4259 | 0 | return false; |
4260 | 0 | } |
4261 | | |
4262 | | bool isNumeric() const override |
4263 | 0 | { |
4264 | 0 | return false; |
4265 | 0 | } |
4266 | | |
4267 | | bool isBoolean() const override |
4268 | 0 | { |
4269 | 0 | return false; |
4270 | 0 | } |
4271 | | |
4272 | | bool isString() const override |
4273 | 0 | { |
4274 | 0 | return false; |
4275 | 0 | } |
4276 | | |
4277 | | bool isDate() const override |
4278 | 0 | { |
4279 | 0 | return true; |
4280 | 0 | } |
4281 | | |
4282 | | bool isTime() const override |
4283 | 0 | { |
4284 | 0 | return true; |
4285 | 0 | } |
4286 | | |
4287 | | bool isDateTime() const override |
4288 | 0 | { |
4289 | 0 | return true; |
4290 | 0 | } |
4291 | | |
4292 | | bool isUUID() const override |
4293 | 0 | { |
4294 | 0 | return false; |
4295 | 0 | } |
4296 | | |
4297 | | private: |
4298 | | DateTime _val; |
4299 | | }; |
4300 | | |
4301 | | |
4302 | | template <> |
4303 | | class VarHolderImpl<LocalDateTime>: public VarHolder |
4304 | | { |
4305 | | public: |
4306 | | VarHolderImpl(const LocalDateTime& val): _val(val) |
4307 | 0 | { |
4308 | 0 | } |
4309 | | |
4310 | | ~VarHolderImpl() override = default; |
4311 | | |
4312 | | VarHolderImpl() = delete; |
4313 | | VarHolderImpl(const VarHolderImpl&) = delete; |
4314 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
4315 | | |
4316 | | const std::type_info& type() const override |
4317 | 0 | { |
4318 | 0 | return typeid(LocalDateTime); |
4319 | 0 | } |
4320 | | |
4321 | | void convert(Int64& val) const override |
4322 | 0 | { |
4323 | 0 | val = _val.timestamp().epochMicroseconds(); |
4324 | 0 | } |
4325 | | |
4326 | 0 | void convert(UInt64& val) const override { |
4327 | 0 | val = _val.timestamp().epochMicroseconds(); |
4328 | 0 | } |
4329 | | |
4330 | | #ifdef POCO_INT64_IS_LONG |
4331 | | |
4332 | | void convert(long long& val) const override |
4333 | 0 | { |
4334 | 0 | val = _val.timestamp().epochMicroseconds(); |
4335 | 0 | } |
4336 | | |
4337 | | void convert(unsigned long long& val) const override |
4338 | 0 | { |
4339 | 0 | val = _val.timestamp().epochMicroseconds(); |
4340 | 0 | } |
4341 | | |
4342 | | #endif |
4343 | | |
4344 | | void convert(std::string& val) const override |
4345 | 0 | { |
4346 | 0 | val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT); |
4347 | 0 | } |
4348 | | |
4349 | | void convert(DateTime& val) const override |
4350 | 0 | { |
4351 | 0 | val = _val.timestamp(); |
4352 | 0 | } |
4353 | | |
4354 | | void convert(LocalDateTime &ldt) const override |
4355 | 0 | { |
4356 | 0 | ldt = _val; |
4357 | 0 | } |
4358 | | |
4359 | | void convert(Timestamp &ts) const override |
4360 | 0 | { |
4361 | 0 | ts = _val.timestamp(); |
4362 | 0 | } |
4363 | | |
4364 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
4365 | 0 | { |
4366 | 0 | return cloneHolder(pVarHolder, _val); |
4367 | 0 | } |
4368 | | |
4369 | | const LocalDateTime& value() const |
4370 | 0 | { |
4371 | 0 | return _val; |
4372 | 0 | } |
4373 | | |
4374 | | bool isArray() const override |
4375 | 0 | { |
4376 | 0 | return false; |
4377 | 0 | } |
4378 | | |
4379 | | bool isStruct() const override |
4380 | 0 | { |
4381 | 0 | return false; |
4382 | 0 | } |
4383 | | |
4384 | | bool isInteger() const override |
4385 | 0 | { |
4386 | 0 | return false; |
4387 | 0 | } |
4388 | | |
4389 | | bool isSigned() const override |
4390 | 0 | { |
4391 | 0 | return false; |
4392 | 0 | } |
4393 | | |
4394 | | bool isNumeric() const override |
4395 | 0 | { |
4396 | 0 | return false; |
4397 | 0 | } |
4398 | | |
4399 | | bool isBoolean() const override |
4400 | 0 | { |
4401 | 0 | return false; |
4402 | 0 | } |
4403 | | |
4404 | | bool isString() const override |
4405 | 0 | { |
4406 | 0 | return false; |
4407 | 0 | } |
4408 | | |
4409 | | bool isDate() const override |
4410 | 0 | { |
4411 | 0 | return true; |
4412 | 0 | } |
4413 | | |
4414 | | bool isTime() const override |
4415 | 0 | { |
4416 | 0 | return true; |
4417 | 0 | } |
4418 | | |
4419 | | bool isDateTime() const override |
4420 | 0 | { |
4421 | 0 | return true; |
4422 | 0 | } |
4423 | | |
4424 | | bool isUUID() const override |
4425 | 0 | { |
4426 | 0 | return false; |
4427 | 0 | } |
4428 | | |
4429 | | private: |
4430 | | LocalDateTime _val; |
4431 | | }; |
4432 | | |
4433 | | |
4434 | | template <> |
4435 | | class VarHolderImpl<Timestamp>: public VarHolder |
4436 | | { |
4437 | | public: |
4438 | | VarHolderImpl(const Timestamp& val): _val(val) |
4439 | 0 | { |
4440 | 0 | } |
4441 | | |
4442 | | ~VarHolderImpl() override = default; |
4443 | | |
4444 | | VarHolderImpl() = delete; |
4445 | | VarHolderImpl(const VarHolderImpl&) = delete; |
4446 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
4447 | | |
4448 | | const std::type_info& type() const override |
4449 | 0 | { |
4450 | 0 | return typeid(Timestamp); |
4451 | 0 | } |
4452 | | |
4453 | | void convert(Int64& val) const override |
4454 | 0 | { |
4455 | 0 | val = _val.epochMicroseconds(); |
4456 | 0 | } |
4457 | | |
4458 | | void convert(UInt64& val) const override |
4459 | 0 | { |
4460 | 0 | val = _val.epochMicroseconds(); |
4461 | 0 | } |
4462 | | |
4463 | | #ifdef POCO_INT64_IS_LONG |
4464 | | |
4465 | | void convert(long long& val) const override |
4466 | 0 | { |
4467 | 0 | val = _val.epochMicroseconds(); |
4468 | 0 | } |
4469 | | |
4470 | | void convert(unsigned long long& val) const override |
4471 | 0 | { |
4472 | 0 | val = _val.epochMicroseconds(); |
4473 | 0 | } |
4474 | | |
4475 | | #endif |
4476 | | |
4477 | | void convert(std::string& val) const override |
4478 | 0 | { |
4479 | 0 | val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT); |
4480 | 0 | } |
4481 | | |
4482 | | void convert(DateTime& val) const override |
4483 | 0 | { |
4484 | 0 | val = _val; |
4485 | 0 | } |
4486 | | |
4487 | | void convert(LocalDateTime &ldt) const override |
4488 | 0 | { |
4489 | 0 | ldt = _val; |
4490 | 0 | } |
4491 | | |
4492 | | void convert(Timestamp &ts) const override |
4493 | 0 | { |
4494 | 0 | ts = _val; |
4495 | 0 | } |
4496 | | |
4497 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
4498 | 0 | { |
4499 | 0 | return cloneHolder(pVarHolder, _val); |
4500 | 0 | } |
4501 | | |
4502 | | const Timestamp& value() const |
4503 | 0 | { |
4504 | 0 | return _val; |
4505 | 0 | } |
4506 | | |
4507 | | bool isArray() const override |
4508 | 0 | { |
4509 | 0 | return false; |
4510 | 0 | } |
4511 | | |
4512 | | bool isStruct() const override |
4513 | 0 | { |
4514 | 0 | return false; |
4515 | 0 | } |
4516 | | |
4517 | | bool isInteger() const override |
4518 | 0 | { |
4519 | 0 | return false; |
4520 | 0 | } |
4521 | | |
4522 | | bool isSigned() const override |
4523 | 0 | { |
4524 | 0 | return false; |
4525 | 0 | } |
4526 | | |
4527 | | bool isNumeric() const override |
4528 | 0 | { |
4529 | 0 | return false; |
4530 | 0 | } |
4531 | | |
4532 | | bool isBoolean() const override |
4533 | 0 | { |
4534 | 0 | return false; |
4535 | 0 | } |
4536 | | |
4537 | | bool isString() const override |
4538 | 0 | { |
4539 | 0 | return false; |
4540 | 0 | } |
4541 | | |
4542 | | bool isDate() const override |
4543 | 0 | { |
4544 | 0 | return true; |
4545 | 0 | } |
4546 | | |
4547 | | bool isTime() const override |
4548 | 0 | { |
4549 | 0 | return true; |
4550 | 0 | } |
4551 | | |
4552 | | bool isDateTime() const override |
4553 | 0 | { |
4554 | 0 | return true; |
4555 | 0 | } |
4556 | | |
4557 | | bool isUUID() const override |
4558 | 0 | { |
4559 | 0 | return false; |
4560 | 0 | } |
4561 | | |
4562 | | private: |
4563 | | Timestamp _val; |
4564 | | }; |
4565 | | |
4566 | | |
4567 | | template <> |
4568 | | class VarHolderImpl<UUID>: public VarHolder |
4569 | | { |
4570 | | public: |
4571 | | VarHolderImpl(const UUID& val): _val(val) |
4572 | 0 | { |
4573 | 0 | } |
4574 | | |
4575 | | ~VarHolderImpl() override = default; |
4576 | | |
4577 | | VarHolderImpl() = delete; |
4578 | | VarHolderImpl(const VarHolderImpl&) = delete; |
4579 | | VarHolderImpl& operator=(const VarHolderImpl&) = delete; |
4580 | | |
4581 | | const std::type_info& type() const override |
4582 | 0 | { |
4583 | 0 | return typeid(UUID); |
4584 | 0 | } |
4585 | | |
4586 | | void convert(std::string& val) const override |
4587 | 0 | { |
4588 | 0 | val = _val.toString(); |
4589 | 0 | } |
4590 | | |
4591 | | VarHolder* clone(Placeholder<VarHolder>* pVarHolder = nullptr) const override |
4592 | 0 | { |
4593 | 0 | return cloneHolder(pVarHolder, _val); |
4594 | 0 | } |
4595 | | |
4596 | | const UUID& value() const |
4597 | 0 | { |
4598 | 0 | return _val; |
4599 | 0 | } |
4600 | | |
4601 | | bool isArray() const override |
4602 | 0 | { |
4603 | 0 | return false; |
4604 | 0 | } |
4605 | | |
4606 | | bool isStruct() const override |
4607 | 0 | { |
4608 | 0 | return false; |
4609 | 0 | } |
4610 | | |
4611 | | bool isInteger() const override |
4612 | 0 | { |
4613 | 0 | return false; |
4614 | 0 | } |
4615 | | |
4616 | | bool isSigned() const override |
4617 | 0 | { |
4618 | 0 | return false; |
4619 | 0 | } |
4620 | | |
4621 | | bool isNumeric() const override |
4622 | 0 | { |
4623 | 0 | return false; |
4624 | 0 | } |
4625 | | |
4626 | | bool isBoolean() const override |
4627 | 0 | { |
4628 | 0 | return false; |
4629 | 0 | } |
4630 | | |
4631 | | bool isString() const override |
4632 | 0 | { |
4633 | 0 | return false; |
4634 | 0 | } |
4635 | | |
4636 | | bool isDate() const override |
4637 | 0 | { |
4638 | 0 | return false; |
4639 | 0 | } |
4640 | | |
4641 | | bool isTime() const override |
4642 | 0 | { |
4643 | 0 | return false; |
4644 | 0 | } |
4645 | | |
4646 | | bool isDateTime() const override |
4647 | 0 | { |
4648 | 0 | return false; |
4649 | 0 | } |
4650 | | |
4651 | | bool isUUID() const override |
4652 | 0 | { |
4653 | 0 | return true; |
4654 | 0 | } |
4655 | | |
4656 | | private: |
4657 | | Poco::UUID _val; |
4658 | | }; |
4659 | | |
4660 | | |
4661 | | using Vector = std::vector<Var>; |
4662 | | using Deque = std::deque<Var>; |
4663 | | using List = std::list<Var>; |
4664 | | using Array = Vector; |
4665 | | |
4666 | | |
4667 | | } } // namespace Poco::Dynamic |
4668 | | |
4669 | | |
4670 | | #endif // Foundation_VarHolder_INCLUDED |