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