1 | // |
2 | // Var.h |
3 | // |
4 | // Library: Foundation |
5 | // Package: Dynamic |
6 | // Module: Var |
7 | // |
8 | // Definition of the Var 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_Var_INCLUDED |
18 | #define Foundation_Var_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Foundation.h" |
22 | #include "Poco/Format.h" |
23 | #include "Poco/SharedPtr.h" |
24 | #include "Poco/OrderedMap.h" |
25 | #include "Poco/OrderedSet.h" |
26 | #include "Poco/Dynamic/VarHolder.h" |
27 | #include "Poco/Dynamic/VarIterator.h" |
28 | #include <typeinfo> |
29 | #include <map> |
30 | #include <set> |
31 | |
32 | |
33 | namespace Poco { |
34 | namespace Dynamic { |
35 | |
36 | |
37 | template <typename K, typename M, typename S> |
38 | class Struct; |
39 | |
40 | |
41 | class Foundation_API Var |
42 | /// Var allows to store data of different types and to convert between these types transparently. |
43 | /// Var puts forth the best effort to provide intuitive and reasonable conversion semantics and prevent |
44 | /// unexpected data loss, particularly when performing narrowing or signedness conversions of numeric data types. |
45 | /// |
46 | /// An attempt to convert or extract from a non-initialized ("empty") Var variable shall result |
47 | /// in an exception being thrown. |
48 | /// |
49 | /// Loss of signedness is not allowed for numeric values. This means that if an attempt is made to convert |
50 | /// the internal value which is a negative signed integer to an unsigned integer type storage, a RangeException is thrown. |
51 | /// Overflow is not allowed, so if the internal value is a larger number than the target numeric type size can accomodate, |
52 | /// a RangeException is thrown. |
53 | /// |
54 | /// Precision loss, such as in conversion from floating-point types to integers or from double to float on platforms |
55 | /// where they differ in size (provided internal actual value fits in float min/max range), is allowed. |
56 | /// |
57 | /// String truncation is allowed -- it is possible to convert between string and character when string length is |
58 | /// greater than 1. An empty string gets converted to the char '\0', a non-empty string is truncated to the first character. |
59 | /// |
60 | /// Boolean conversion is performed as follows: |
61 | /// |
62 | /// A string value "false" (not case sensitive), "0" or "" (empty string) can be converted to a boolean value false, |
63 | /// any other string not being false by the above criteria evaluates to true (e.g: "hi" -> true). |
64 | /// Integer 0 values are false, everything else is true. |
65 | /// Floating point values equal to the minimal FP representation on a given platform are false, everything else is true. |
66 | /// |
67 | /// Arithmetic operations with POD types as well as between Var's are supported, subject to following |
68 | /// limitations: |
69 | /// |
70 | /// - for std::string and const char* values, only '+' and '+=' operations are supported |
71 | /// |
72 | /// - for integral and floating point numeric values, following operations are supported: |
73 | /// '+', '+=', '-', '-=', '*', '*=' , '/' and '/=' |
74 | /// |
75 | /// - for integral values, following operations are supported: |
76 | /// prefix and postfix increment (++) and decrement (--) |
77 | /// |
78 | /// - for all other types, InvalidArgumentException is thrown upon attempt of an arithmetic operation |
79 | /// |
80 | /// A Var can be created from and converted to a value of any type for which a specialization of |
81 | /// VarHolderImpl is available. For supported types, see VarHolder documentation. |
82 | { |
83 | public: |
84 | typedef SharedPtr<Var> Ptr; |
85 | typedef Poco::Dynamic::VarIterator Iterator; |
86 | typedef const VarIterator ConstIterator; |
87 | |
88 | Var(); |
89 | /// Creates an empty Var. |
90 | |
91 | template <typename T> |
92 | Var(const T& val) |
93 | /// Creates the Var from the given value. |
94 | #ifdef POCO_NO_SOO |
95 | : _pHolder(new VarHolderImpl<T>(val)) |
96 | { |
97 | } |
98 | #else |
99 | { |
100 | construct(val); |
101 | } |
102 | #endif |
103 | |
104 | Var(const char* pVal); |
105 | // Convenience constructor for const char* which gets mapped to a std::string internally, i.e. pVal is deep-copied. |
106 | |
107 | Var(const Var& other); |
108 | /// Copy constructor. |
109 | |
110 | ~Var(); |
111 | /// Destroys the Var. |
112 | |
113 | void swap(Var& other); |
114 | /// Swaps the content of the this Var with the other Var. |
115 | |
116 | ConstIterator begin() const; |
117 | /// Returns the const Var iterator. |
118 | |
119 | ConstIterator end() const; |
120 | /// Returns the const Var iterator. |
121 | |
122 | Iterator begin(); |
123 | /// Returns the Var iterator. |
124 | |
125 | Iterator end(); |
126 | /// Returns the Var iterator. |
127 | |
128 | template <typename T> |
129 | void convert(T& val) const |
130 | /// Invoke this method to perform a safe conversion. |
131 | /// |
132 | /// Example usage: |
133 | /// Var any("42"); |
134 | /// int i; |
135 | /// any.convert(i); |
136 | /// |
137 | /// Throws a RangeException if the value does not fit |
138 | /// into the result variable. |
139 | /// Throws a NotImplementedException if conversion is |
140 | /// not available for the given type. |
141 | /// Throws InvalidAccessException if Var is empty. |
142 | { |
143 | VarHolder* pHolder = content(); |
144 | |
145 | if (!pHolder) |
146 | throw InvalidAccessException("Can not convert empty value." ); |
147 | |
148 | pHolder->convert(val); |
149 | } |
150 | |
151 | template <typename T> |
152 | T convert() const |
153 | /// Invoke this method to perform a safe conversion. |
154 | /// |
155 | /// Example usage: |
156 | /// Var any("42"); |
157 | /// int i = any.convert<int>(); |
158 | /// |
159 | /// Throws a RangeException if the value does not fit |
160 | /// into the result variable. |
161 | /// Throws a NotImplementedException if conversion is |
162 | /// not available for the given type. |
163 | /// Throws InvalidAccessException if Var is empty. |
164 | { |
165 | VarHolder* pHolder = content(); |
166 | |
167 | if (!pHolder) |
168 | throw InvalidAccessException("Can not convert empty value." ); |
169 | |
170 | if (typeid(T) == pHolder->type()) return extract<T>(); |
171 | |
172 | T result; |
173 | pHolder->convert(result); |
174 | return result; |
175 | } |
176 | |
177 | template <typename T> |
178 | operator T () const |
179 | /// Safe conversion operator for implicit type |
180 | /// conversions. If the requested type T is same as the |
181 | /// type being held, the operation performed is direct |
182 | /// extraction, otherwise it is the conversion of the value |
183 | /// from type currently held to the one requested. |
184 | /// |
185 | /// Throws a RangeException if the value does not fit |
186 | /// into the result variable. |
187 | /// Throws a NotImplementedException if conversion is |
188 | /// not available for the given type. |
189 | /// Throws InvalidAccessException if Var is empty. |
190 | { |
191 | VarHolder* pHolder = content(); |
192 | |
193 | if (!pHolder) |
194 | throw InvalidAccessException("Can not convert empty value." ); |
195 | |
196 | if (typeid(T) == pHolder->type()) |
197 | return extract<T>(); |
198 | else |
199 | { |
200 | T result; |
201 | pHolder->convert(result); |
202 | return result; |
203 | } |
204 | } |
205 | |
206 | template <typename T> |
207 | const T& () const |
208 | /// Returns a const reference to the actual value. |
209 | /// |
210 | /// Must be instantiated with the exact type of |
211 | /// the stored value, otherwise a BadCastException |
212 | /// is thrown. |
213 | /// Throws InvalidAccessException if Var is empty. |
214 | { |
215 | VarHolder* pHolder = content(); |
216 | |
217 | if (pHolder && pHolder->type() == typeid(T)) |
218 | { |
219 | VarHolderImpl<T>* pHolderImpl = static_cast<VarHolderImpl<T>*>(pHolder); |
220 | return pHolderImpl->value(); |
221 | } |
222 | else if (!pHolder) |
223 | throw InvalidAccessException("Can not extract empty value." ); |
224 | else |
225 | throw BadCastException(format("Can not convert %s to %s." , |
226 | std::string(pHolder->type().name()), |
227 | std::string(typeid(T).name()))); |
228 | } |
229 | |
230 | template <typename T> |
231 | Var& operator = (const T& other) |
232 | /// Assignment operator for assigning POD to Var |
233 | { |
234 | #ifdef POCO_NO_SOO |
235 | Var tmp(other); |
236 | swap(tmp); |
237 | #else |
238 | construct(other); |
239 | #endif |
240 | return *this; |
241 | } |
242 | |
243 | bool operator ! () const; |
244 | /// Logical NOT operator. |
245 | |
246 | Var& operator = (const Var& other); |
247 | /// Assignment operator specialization for Var |
248 | |
249 | template <typename T> |
250 | const Var operator + (const T& other) const |
251 | /// Addition operator for adding POD to Var |
252 | { |
253 | return convert<T>() + other; |
254 | } |
255 | |
256 | const Var operator + (const Var& other) const; |
257 | /// Addition operator specialization for Var |
258 | |
259 | const Var operator + (const char* other) const; |
260 | /// Addition operator specialization for adding const char* to Var |
261 | |
262 | Var& operator ++ (); |
263 | /// Pre-increment operator |
264 | |
265 | const Var operator ++ (int); |
266 | /// Post-increment operator |
267 | |
268 | Var& operator -- (); |
269 | /// Pre-decrement operator |
270 | |
271 | const Var operator -- (int); |
272 | /// Post-decrement operator |
273 | |
274 | template <typename T> |
275 | Var& operator += (const T& other) |
276 | /// Addition asignment operator for addition/assignment of POD to Var. |
277 | { |
278 | return *this = convert<T>() + other; |
279 | } |
280 | |
281 | Var& operator += (const Var& other); |
282 | /// Addition asignment operator overload for Var |
283 | |
284 | Var& operator += (const char* other); |
285 | /// Addition asignment operator overload for const char* |
286 | |
287 | template <typename T> |
288 | const Var operator - (const T& other) const |
289 | /// Subtraction operator for subtracting POD from Var |
290 | { |
291 | return convert<T>() - other; |
292 | } |
293 | |
294 | const Var operator - (const Var& other) const; |
295 | /// Subtraction operator overload for Var |
296 | |
297 | template <typename T> |
298 | Var& operator -= (const T& other) |
299 | /// Subtraction asignment operator |
300 | { |
301 | return *this = convert<T>() - other; |
302 | } |
303 | |
304 | Var& operator -= (const Var& other); |
305 | /// Subtraction asignment operator overload for Var |
306 | |
307 | template <typename T> |
308 | const Var operator * (const T& other) const |
309 | /// Multiplication operator for multiplying Var with POD |
310 | { |
311 | return convert<T>() * other; |
312 | } |
313 | |
314 | const Var operator * (const Var& other) const; |
315 | /// Multiplication operator overload for Var |
316 | |
317 | template <typename T> |
318 | Var& operator *= (const T& other) |
319 | /// Multiplication asignment operator |
320 | { |
321 | return *this = convert<T>() * other; |
322 | } |
323 | |
324 | Var& operator *= (const Var& other); |
325 | /// Multiplication asignment operator overload for Var |
326 | |
327 | template <typename T> |
328 | const Var operator / (const T& other) const |
329 | /// Division operator for dividing Var with POD |
330 | { |
331 | return convert<T>() / other; |
332 | } |
333 | |
334 | const Var operator / (const Var& other) const; |
335 | /// Division operator overload for Var |
336 | |
337 | template <typename T> |
338 | Var& operator /= (const T& other) |
339 | /// Division asignment operator |
340 | { |
341 | return *this = convert<T>() / other; |
342 | } |
343 | |
344 | Var& operator /= (const Var& other); |
345 | /// Division asignment operator specialization for Var |
346 | |
347 | template <typename T> |
348 | bool operator == (const T& other) const |
349 | /// Equality operator |
350 | { |
351 | if (isEmpty()) return false; |
352 | return convert<T>() == other; |
353 | } |
354 | |
355 | bool operator == (const char* other) const; |
356 | /// Equality operator overload for const char* |
357 | |
358 | bool operator == (const Var& other) const; |
359 | /// Equality operator overload for Var |
360 | |
361 | template <typename T> |
362 | bool operator != (const T& other) const |
363 | /// Inequality operator |
364 | { |
365 | if (isEmpty()) return true; |
366 | return convert<T>() != other; |
367 | } |
368 | |
369 | bool operator != (const Var& other) const; |
370 | /// Inequality operator overload for Var |
371 | |
372 | bool operator != (const char* other) const; |
373 | /// Inequality operator overload for const char* |
374 | |
375 | template <typename T> |
376 | bool operator < (const T& other) const |
377 | /// Less than operator |
378 | { |
379 | if (isEmpty()) return false; |
380 | return convert<T>() < other; |
381 | } |
382 | |
383 | bool operator < (const Var& other) const; |
384 | /// Less than operator overload for Var |
385 | |
386 | template <typename T> |
387 | bool operator <= (const T& other) const |
388 | /// Less than or equal operator |
389 | { |
390 | if (isEmpty()) return false; |
391 | return convert<T>() <= other; |
392 | } |
393 | |
394 | bool operator <= (const Var& other) const; |
395 | /// Less than or equal operator overload for Var |
396 | |
397 | template <typename T> |
398 | bool operator > (const T& other) const |
399 | /// Greater than operator |
400 | { |
401 | if (isEmpty()) return false; |
402 | return convert<T>() > other; |
403 | } |
404 | |
405 | bool operator > (const Var& other) const; |
406 | /// Greater than operator overload for Var |
407 | |
408 | template <typename T> |
409 | bool operator >= (const T& other) const |
410 | /// Greater than or equal operator |
411 | { |
412 | if (isEmpty()) return false; |
413 | return convert<T>() >= other; |
414 | } |
415 | |
416 | bool operator >= (const Var& other) const; |
417 | /// Greater than or equal operator overload for Var |
418 | |
419 | template <typename T> |
420 | bool operator || (const T& other) const |
421 | /// Logical OR operator |
422 | { |
423 | if (isEmpty()) return false; |
424 | return convert<bool>() || other; |
425 | } |
426 | |
427 | bool operator || (const Var& other) const; |
428 | /// Logical OR operator operator overload for Var |
429 | |
430 | template <typename T> |
431 | bool operator && (const T& other) const |
432 | /// Logical AND operator. |
433 | { |
434 | if (isEmpty()) return false; |
435 | return convert<bool>() && other; |
436 | } |
437 | |
438 | bool operator && (const Var& other) const; |
439 | /// Logical AND operator operator overload for Var. |
440 | |
441 | bool isArray() const; |
442 | /// Returns true if Var is an array. |
443 | |
444 | bool isVector() const; |
445 | /// Returns true if Var represents a vector. |
446 | |
447 | bool isList() const; |
448 | /// Returns true if Var represents a list. |
449 | |
450 | bool isDeque() const; |
451 | /// Returns true if Var represents a deque. |
452 | |
453 | bool isStruct() const; |
454 | /// Returns true if Var represents a struct. |
455 | |
456 | bool isOrdered() const; |
457 | /// Returns true if Var represents an ordered struct, |
458 | /// false if struct is sorted. |
459 | |
460 | char& at(std::size_t n); |
461 | /// Returns character at position n. This function only works with |
462 | /// Var containing a std::string. |
463 | |
464 | |
465 | template <typename T> |
466 | Var& operator [] (const T& n) |
467 | { |
468 | return getAt(n); |
469 | } |
470 | |
471 | template <typename T> |
472 | const Var& operator [] (const T& n) const |
473 | { |
474 | return const_cast<Var*>(this)->getAt(n); |
475 | } |
476 | |
477 | Var& operator [] (const std::string& name); |
478 | /// Index operator by name, only use on Vars where isStruct |
479 | /// returns true! In all other cases InvalidAccessException is thrown. |
480 | |
481 | const Var& operator [] (const std::string& name) const; |
482 | /// Index operator by name, only use on Vars where isStruct |
483 | /// returns true! In all other cases InvalidAccessException is thrown. |
484 | |
485 | const std::type_info& type() const; |
486 | /// Returns the type information of the stored content. |
487 | |
488 | //@ deprecated |
489 | void empty(); |
490 | /// Empties Var. |
491 | /// This function is deprecated and will be removed. |
492 | /// Please use clear(). |
493 | |
494 | void clear(); |
495 | /// Empties Var. |
496 | |
497 | bool isEmpty() const; |
498 | /// Returns true if empty. |
499 | |
500 | bool isInteger() const; |
501 | /// Returns true if stored value is integer. |
502 | |
503 | bool isSigned() const; |
504 | /// Returns true if stored value is signed. |
505 | |
506 | bool isNumeric() const; |
507 | /// Returns true if stored value is numeric. |
508 | /// Returns false for numeric strings (e.g. "123" is string, not number) |
509 | |
510 | bool isBoolean() const; |
511 | /// Returns true if stored value is boolean. |
512 | /// Returns false for boolean strings (e.g. "true" is string, not number) |
513 | |
514 | bool isString() const; |
515 | /// Returns true if stored value is std::string. |
516 | |
517 | bool isDate() const; |
518 | /// Returns true if stored value represents a date. |
519 | |
520 | bool isTime() const; |
521 | /// Returns true if stored value represents time or date/time. |
522 | |
523 | bool isDateTime() const; |
524 | /// Returns true if stored value represents a date/time. |
525 | |
526 | std::size_t size() const; |
527 | /// Returns the size of this Var. |
528 | /// This function returns 0 when Var is empty, 1 for POD or the size (i.e. length) |
529 | /// for held container. |
530 | |
531 | std::string toString() const |
532 | /// Returns the stored value as string. |
533 | { |
534 | VarHolder* pHolder = content(); |
535 | |
536 | if (!pHolder) |
537 | throw InvalidAccessException("Can not convert empty value." ); |
538 | |
539 | if (typeid(std::string) == pHolder->type()) |
540 | return extract<std::string>(); |
541 | else |
542 | { |
543 | std::string result; |
544 | pHolder->convert(result); |
545 | return result; |
546 | } |
547 | } |
548 | |
549 | static Var parse(const std::string& val); |
550 | /// Parses the string which must be in JSON format |
551 | |
552 | static std::string toString(const Var& var); |
553 | /// Converts the Var to a string in JSON format. Note that toString(const Var&) will return |
554 | /// a different result than Var::convert<std::string>() and Var::toString()! |
555 | |
556 | private: |
557 | Var& getAt(std::size_t n); |
558 | Var& getAt(const std::string& n); |
559 | |
560 | static Var parse(const std::string& val, std::string::size_type& offset); |
561 | /// Parses the string which must be in JSON format |
562 | |
563 | static Var parseObject(const std::string& val, std::string::size_type& pos); |
564 | static Var parseArray(const std::string& val, std::string::size_type& pos); |
565 | static std::string parseString(const std::string& val, std::string::size_type& pos); |
566 | static std::string parseJSONString(const std::string& val, std::string::size_type& pos); |
567 | static void skipWhiteSpace(const std::string& val, std::string::size_type& pos); |
568 | |
569 | template <typename T> |
570 | T add(const Var& other) const |
571 | { |
572 | return convert<T>() + other.convert<T>(); |
573 | } |
574 | |
575 | template <typename T> |
576 | T subtract(const Var& other) const |
577 | { |
578 | return convert<T>() - other.convert<T>(); |
579 | } |
580 | |
581 | template <typename T> |
582 | T multiply(const Var& other) const |
583 | { |
584 | return convert<T>() * other.convert<T>(); |
585 | } |
586 | |
587 | template <typename T> |
588 | T divide(const Var& other) const |
589 | { |
590 | return convert<T>() / other.convert<T>(); |
591 | } |
592 | |
593 | template <typename T, typename E> |
594 | VarHolderImpl<T>* holderImpl(const std::string errorMessage = "" ) const |
595 | { |
596 | VarHolder* pHolder = content(); |
597 | |
598 | if (pHolder && pHolder->type() == typeid(T)) |
599 | return static_cast<VarHolderImpl<T>*>(pHolder); |
600 | else if (!pHolder) |
601 | throw InvalidAccessException("Can not access empty value." ); |
602 | else |
603 | throw E(errorMessage); |
604 | } |
605 | |
606 | template <typename T, typename N> |
607 | Var& structIndexOperator(T* pStr, N n) const |
608 | { |
609 | return pStr->operator[](n); |
610 | } |
611 | |
612 | #ifdef POCO_NO_SOO |
613 | |
614 | VarHolder* content() const |
615 | { |
616 | return _pHolder; |
617 | } |
618 | |
619 | void destruct() |
620 | { |
621 | if (!isEmpty()) delete content(); |
622 | } |
623 | |
624 | VarHolder* _pHolder; |
625 | |
626 | #else |
627 | |
628 | VarHolder* content() const |
629 | { |
630 | return _placeholder.content(); |
631 | } |
632 | |
633 | template<typename ValueType> |
634 | void construct(const ValueType& value) |
635 | { |
636 | if (sizeof(VarHolderImpl<ValueType>) <= Placeholder<ValueType>::Size::value) |
637 | { |
638 | new (reinterpret_cast<VarHolder*>(_placeholder.holder)) VarHolderImpl<ValueType>(value); |
639 | _placeholder.setLocal(true); |
640 | } |
641 | else |
642 | { |
643 | _placeholder.pHolder = new VarHolderImpl<ValueType>(value); |
644 | _placeholder.setLocal(false); |
645 | } |
646 | } |
647 | |
648 | void construct(const char* value) |
649 | { |
650 | std::string val(value); |
651 | if (sizeof(VarHolderImpl<std::string>) <= Placeholder<std::string>::Size::value) |
652 | { |
653 | new (reinterpret_cast<VarHolder*>(_placeholder.holder)) VarHolderImpl<std::string>(val); |
654 | _placeholder.setLocal(true); |
655 | } |
656 | else |
657 | { |
658 | _placeholder.pHolder = new VarHolderImpl<std::string>(val); |
659 | _placeholder.setLocal(false); |
660 | } |
661 | } |
662 | |
663 | void construct(const Var& other) |
664 | { |
665 | if (!other.isEmpty()) |
666 | other.content()->clone(&_placeholder); |
667 | else |
668 | _placeholder.erase(); |
669 | } |
670 | |
671 | void destruct() |
672 | { |
673 | if (!isEmpty()) |
674 | { |
675 | if (_placeholder.isLocal()) |
676 | content()->~VarHolder(); |
677 | else |
678 | delete content(); |
679 | } |
680 | } |
681 | |
682 | Placeholder<VarHolder> _placeholder; |
683 | |
684 | #endif // POCO_NO_SOO |
685 | }; |
686 | |
687 | |
688 | /// |
689 | /// inlines |
690 | /// |
691 | |
692 | |
693 | /// |
694 | /// Var members |
695 | /// |
696 | |
697 | inline void Var::swap(Var& other) |
698 | { |
699 | #ifdef POCO_NO_SOO |
700 | |
701 | std::swap(_pHolder, other._pHolder); |
702 | |
703 | #else |
704 | |
705 | if (this == &other) return; |
706 | |
707 | if (!_placeholder.isLocal() && !other._placeholder.isLocal()) |
708 | { |
709 | std::swap(_placeholder.pHolder, other._placeholder.pHolder); |
710 | } |
711 | else |
712 | { |
713 | Var tmp(*this); |
714 | try |
715 | { |
716 | if (_placeholder.isLocal()) destruct(); |
717 | construct(other); |
718 | other = tmp; |
719 | } |
720 | catch (...) |
721 | { |
722 | construct(tmp); |
723 | throw; |
724 | } |
725 | } |
726 | |
727 | #endif |
728 | } |
729 | |
730 | |
731 | inline const std::type_info& Var::type() const |
732 | { |
733 | VarHolder* pHolder = content(); |
734 | return pHolder ? pHolder->type() : typeid(void); |
735 | } |
736 | |
737 | |
738 | inline Var::ConstIterator Var::begin() const |
739 | { |
740 | if (isEmpty()) return ConstIterator(const_cast<Var*>(this), true); |
741 | |
742 | return ConstIterator(const_cast<Var*>(this), false); |
743 | } |
744 | |
745 | inline Var::ConstIterator Var::end() const |
746 | { |
747 | return ConstIterator(const_cast<Var*>(this), true); |
748 | } |
749 | |
750 | inline Var::Iterator Var::begin() |
751 | { |
752 | if (isEmpty()) return Iterator(const_cast<Var*>(this), true); |
753 | |
754 | return Iterator(const_cast<Var*>(this), false); |
755 | } |
756 | |
757 | inline Var::Iterator Var::end() |
758 | { |
759 | return Iterator(this, true); |
760 | } |
761 | |
762 | |
763 | inline Var& Var::operator [] (const std::string& name) |
764 | { |
765 | return getAt(name); |
766 | } |
767 | |
768 | |
769 | inline const Var& Var::operator [] (const std::string& name) const |
770 | { |
771 | return const_cast<Var*>(this)->getAt(name); |
772 | } |
773 | |
774 | |
775 | inline const Var Var::operator + (const char* other) const |
776 | { |
777 | return convert<std::string>() + other; |
778 | } |
779 | |
780 | |
781 | inline Var& Var::operator += (const char*other) |
782 | { |
783 | return *this = convert<std::string>() + other; |
784 | } |
785 | |
786 | |
787 | inline bool Var::operator ! () const |
788 | { |
789 | return !convert<bool>(); |
790 | } |
791 | |
792 | |
793 | inline bool Var::isEmpty() const |
794 | { |
795 | return 0 == content(); |
796 | } |
797 | |
798 | |
799 | inline bool Var::isArray() const |
800 | { |
801 | if (isEmpty() || |
802 | isString()) return false; |
803 | |
804 | VarHolder* pHolder = content(); |
805 | return pHolder ? pHolder->isArray() : false; |
806 | } |
807 | |
808 | |
809 | inline bool Var::isVector() const |
810 | { |
811 | VarHolder* pHolder = content(); |
812 | return pHolder ? pHolder->isVector() : false; |
813 | } |
814 | |
815 | |
816 | inline bool Var::isList() const |
817 | { |
818 | VarHolder* pHolder = content(); |
819 | return pHolder ? pHolder->isList() : false; |
820 | } |
821 | |
822 | |
823 | inline bool Var::isDeque() const |
824 | { |
825 | VarHolder* pHolder = content(); |
826 | return pHolder ? pHolder->isDeque() : false; |
827 | } |
828 | |
829 | |
830 | inline bool Var::isStruct() const |
831 | { |
832 | VarHolder* pHolder = content(); |
833 | return pHolder ? pHolder->isStruct() : false; |
834 | } |
835 | |
836 | |
837 | inline bool Var::isOrdered() const |
838 | { |
839 | VarHolder* pHolder = content(); |
840 | return pHolder ? pHolder->isOrdered() : false; |
841 | } |
842 | |
843 | |
844 | inline bool Var::isInteger() const |
845 | { |
846 | VarHolder* pHolder = content(); |
847 | return pHolder ? pHolder->isInteger() : false; |
848 | } |
849 | |
850 | |
851 | inline bool Var::isSigned() const |
852 | { |
853 | VarHolder* pHolder = content(); |
854 | return pHolder ? pHolder->isSigned() : false; |
855 | } |
856 | |
857 | |
858 | inline bool Var::isNumeric() const |
859 | { |
860 | VarHolder* pHolder = content(); |
861 | return pHolder ? pHolder->isNumeric() : false; |
862 | } |
863 | |
864 | |
865 | inline bool Var::isBoolean() const |
866 | { |
867 | VarHolder* pHolder = content(); |
868 | return pHolder ? pHolder->isBoolean() : false; |
869 | } |
870 | |
871 | |
872 | inline bool Var::isString() const |
873 | { |
874 | VarHolder* pHolder = content(); |
875 | return pHolder ? pHolder->isString() : false; |
876 | } |
877 | |
878 | |
879 | inline bool Var::isDate() const |
880 | { |
881 | VarHolder* pHolder = content(); |
882 | return pHolder ? pHolder->isDate() : false; |
883 | } |
884 | |
885 | |
886 | inline bool Var::isTime() const |
887 | { |
888 | VarHolder* pHolder = content(); |
889 | return pHolder ? pHolder->isTime() : false; |
890 | } |
891 | |
892 | |
893 | inline bool Var::isDateTime() const |
894 | { |
895 | VarHolder* pHolder = content(); |
896 | return pHolder ? pHolder->isDateTime() : false; |
897 | } |
898 | |
899 | |
900 | inline std::size_t Var::size() const |
901 | { |
902 | VarHolder* pHolder = content(); |
903 | return pHolder ? pHolder->size() : 0; |
904 | } |
905 | |
906 | |
907 | /// |
908 | /// Var non-member functions |
909 | /// |
910 | |
911 | inline const Var operator + (const char* other, const Var& da) |
912 | /// Addition operator for adding Var to const char* |
913 | { |
914 | std::string tmp = other; |
915 | return tmp + da.convert<std::string>(); |
916 | } |
917 | |
918 | |
919 | inline char operator + (const char& other, const Var& da) |
920 | /// Addition operator for adding Var to char |
921 | { |
922 | return other + da.convert<char>(); |
923 | } |
924 | |
925 | |
926 | inline char operator - (const char& other, const Var& da) |
927 | /// Subtraction operator for subtracting Var from char |
928 | { |
929 | return other - da.convert<char>(); |
930 | } |
931 | |
932 | |
933 | inline char operator * (const char& other, const Var& da) |
934 | /// Multiplication operator for multiplying Var with char |
935 | { |
936 | return other * da.convert<char>(); |
937 | } |
938 | |
939 | |
940 | inline char operator / (const char& other, const Var& da) |
941 | /// Division operator for dividing Var with char |
942 | { |
943 | return other / da.convert<char>(); |
944 | } |
945 | |
946 | |
947 | inline char operator += (char& other, const Var& da) |
948 | /// Addition asignment operator for adding Var to char |
949 | { |
950 | return other += da.convert<char>(); |
951 | } |
952 | |
953 | |
954 | inline char operator -= (char& other, const Var& da) |
955 | /// Subtraction asignment operator for subtracting Var from char |
956 | { |
957 | return other -= da.convert<char>(); |
958 | } |
959 | |
960 | |
961 | inline char operator *= (char& other, const Var& da) |
962 | /// Multiplication asignment operator for multiplying Var with char |
963 | { |
964 | return other *= da.convert<char>(); |
965 | } |
966 | |
967 | |
968 | inline char operator /= (char& other, const Var& da) |
969 | /// Division asignment operator for dividing Var with char |
970 | { |
971 | return other /= da.convert<char>(); |
972 | } |
973 | |
974 | |
975 | inline bool operator == (const char& other, const Var& da) |
976 | /// Equality operator for comparing Var with char |
977 | { |
978 | if (da.isEmpty()) return false; |
979 | return other == da.convert<char>(); |
980 | } |
981 | |
982 | |
983 | inline bool operator != (const char& other, const Var& da) |
984 | /// Inequality operator for comparing Var with char |
985 | { |
986 | if (da.isEmpty()) return true; |
987 | return other != da.convert<char>(); |
988 | } |
989 | |
990 | |
991 | inline bool operator < (const char& other, const Var& da) |
992 | /// Less than operator for comparing Var with char |
993 | { |
994 | if (da.isEmpty()) return false; |
995 | return other < da.convert<char>(); |
996 | } |
997 | |
998 | |
999 | inline bool operator <= (const char& other, const Var& da) |
1000 | /// Less than or equal operator for comparing Var with char |
1001 | { |
1002 | if (da.isEmpty()) return false; |
1003 | return other <= da.convert<char>(); |
1004 | } |
1005 | |
1006 | |
1007 | inline bool operator > (const char& other, const Var& da) |
1008 | /// Greater than operator for comparing Var with char |
1009 | { |
1010 | if (da.isEmpty())return false; |
1011 | return other > da.convert<char>(); |
1012 | } |
1013 | |
1014 | |
1015 | inline bool operator >= (const char& other, const Var& da) |
1016 | /// Greater than or equal operator for comparing Var with char |
1017 | { |
1018 | if (da.isEmpty())return false; |
1019 | return other >= da.convert<char>(); |
1020 | } |
1021 | |
1022 | |
1023 | inline Poco::Int8 operator + (const Poco::Int8& other, const Var& da) |
1024 | /// Addition operator for adding Var to Poco::Int8 |
1025 | { |
1026 | return other + da.convert<Poco::Int8>(); |
1027 | } |
1028 | |
1029 | |
1030 | inline Poco::Int8 operator - (const Poco::Int8& other, const Var& da) |
1031 | /// Subtraction operator for subtracting Var from Poco::Int8 |
1032 | { |
1033 | return other - da.convert<Poco::Int8>(); |
1034 | } |
1035 | |
1036 | |
1037 | inline Poco::Int8 operator * (const Poco::Int8& other, const Var& da) |
1038 | /// Multiplication operator for multiplying Var with Poco::Int8 |
1039 | { |
1040 | return other * da.convert<Poco::Int8>(); |
1041 | } |
1042 | |
1043 | |
1044 | inline Poco::Int8 operator / (const Poco::Int8& other, const Var& da) |
1045 | /// Division operator for dividing Var with Poco::Int8 |
1046 | { |
1047 | return other / da.convert<Poco::Int8>(); |
1048 | } |
1049 | |
1050 | |
1051 | inline Poco::Int8 operator += (Poco::Int8& other, const Var& da) |
1052 | /// Addition asignment operator for adding Var to Poco::Int8 |
1053 | { |
1054 | return other += da.convert<Poco::Int8>(); |
1055 | } |
1056 | |
1057 | |
1058 | inline Poco::Int8 operator -= (Poco::Int8& other, const Var& da) |
1059 | /// Subtraction asignment operator for subtracting Var from Poco::Int8 |
1060 | { |
1061 | return other -= da.convert<Poco::Int8>(); |
1062 | } |
1063 | |
1064 | |
1065 | inline Poco::Int8 operator *= (Poco::Int8& other, const Var& da) |
1066 | /// Multiplication asignment operator for multiplying Var with Poco::Int8 |
1067 | { |
1068 | return other *= da.convert<Poco::Int8>(); |
1069 | } |
1070 | |
1071 | |
1072 | inline Poco::Int8 operator /= (Poco::Int8& other, const Var& da) |
1073 | /// Division asignment operator for dividing Var with Poco::Int8 |
1074 | { |
1075 | return other /= da.convert<Poco::Int8>(); |
1076 | } |
1077 | |
1078 | |
1079 | inline bool operator == (const Poco::Int8& other, const Var& da) |
1080 | /// Equality operator for comparing Var with Poco::Int8 |
1081 | { |
1082 | if (da.isEmpty()) return false; |
1083 | return other == da.convert<Poco::Int8>(); |
1084 | } |
1085 | |
1086 | |
1087 | inline bool operator != (const Poco::Int8& other, const Var& da) |
1088 | /// Inequality operator for comparing Var with Poco::Int8 |
1089 | { |
1090 | if (da.isEmpty()) return true; |
1091 | return other != da.convert<Poco::Int8>(); |
1092 | } |
1093 | |
1094 | |
1095 | inline bool operator < (const Poco::Int8& other, const Var& da) |
1096 | /// Less than operator for comparing Var with Poco::Int8 |
1097 | { |
1098 | if (da.isEmpty()) return false; |
1099 | return other < da.convert<Poco::Int8>(); |
1100 | } |
1101 | |
1102 | |
1103 | inline bool operator <= (const Poco::Int8& other, const Var& da) |
1104 | /// Less than or equal operator for comparing Var with Poco::Int8 |
1105 | { |
1106 | if (da.isEmpty()) return false; |
1107 | return other <= da.convert<Poco::Int8>(); |
1108 | } |
1109 | |
1110 | |
1111 | inline bool operator > (const Poco::Int8& other, const Var& da) |
1112 | /// Greater than operator for comparing Var with Poco::Int8 |
1113 | { |
1114 | if (da.isEmpty()) return false; |
1115 | return other > da.convert<Poco::Int8>(); |
1116 | } |
1117 | |
1118 | |
1119 | inline bool operator >= (const Poco::Int8& other, const Var& da) |
1120 | /// Greater than or equal operator for comparing Var with Poco::Int8 |
1121 | { |
1122 | if (da.isEmpty()) return false; |
1123 | return other >= da.convert<Poco::Int8>(); |
1124 | } |
1125 | |
1126 | |
1127 | inline Poco::UInt8 operator + (const Poco::UInt8& other, const Var& da) |
1128 | /// Addition operator for adding Var to Poco::UInt8 |
1129 | { |
1130 | return other + da.convert<Poco::UInt8>(); |
1131 | } |
1132 | |
1133 | |
1134 | inline Poco::UInt8 operator - (const Poco::UInt8& other, const Var& da) |
1135 | /// Subtraction operator for subtracting Var from Poco::UInt8 |
1136 | { |
1137 | return other - da.convert<Poco::UInt8>(); |
1138 | } |
1139 | |
1140 | |
1141 | inline Poco::UInt8 operator * (const Poco::UInt8& other, const Var& da) |
1142 | /// Multiplication operator for multiplying Var with Poco::UInt8 |
1143 | { |
1144 | return other * da.convert<Poco::UInt8>(); |
1145 | } |
1146 | |
1147 | |
1148 | inline Poco::UInt8 operator / (const Poco::UInt8& other, const Var& da) |
1149 | /// Division operator for dividing Var with Poco::UInt8 |
1150 | { |
1151 | return other / da.convert<Poco::UInt8>(); |
1152 | } |
1153 | |
1154 | |
1155 | inline Poco::UInt8 operator += (Poco::UInt8& other, const Var& da) |
1156 | /// Addition asignment operator for adding Var to Poco::UInt8 |
1157 | { |
1158 | return other += da.convert<Poco::UInt8>(); |
1159 | } |
1160 | |
1161 | |
1162 | inline Poco::UInt8 operator -= (Poco::UInt8& other, const Var& da) |
1163 | /// Subtraction asignment operator for subtracting Var from Poco::UInt8 |
1164 | { |
1165 | return other -= da.convert<Poco::UInt8>(); |
1166 | } |
1167 | |
1168 | |
1169 | inline Poco::UInt8 operator *= (Poco::UInt8& other, const Var& da) |
1170 | /// Multiplication asignment operator for multiplying Var with Poco::UInt8 |
1171 | { |
1172 | return other *= da.convert<Poco::UInt8>(); |
1173 | } |
1174 | |
1175 | |
1176 | inline Poco::UInt8 operator /= (Poco::UInt8& other, const Var& da) |
1177 | /// Division asignment operator for dividing Var with Poco::UInt8 |
1178 | { |
1179 | return other /= da.convert<Poco::UInt8>(); |
1180 | } |
1181 | |
1182 | |
1183 | inline bool operator == (const Poco::UInt8& other, const Var& da) |
1184 | /// Equality operator for comparing Var with Poco::UInt8 |
1185 | { |
1186 | if (da.isEmpty()) return false; |
1187 | return other == da.convert<Poco::UInt8>(); |
1188 | } |
1189 | |
1190 | |
1191 | inline bool operator != (const Poco::UInt8& other, const Var& da) |
1192 | /// Inequality operator for comparing Var with Poco::UInt8 |
1193 | { |
1194 | if (da.isEmpty()) return true; |
1195 | return other != da.convert<Poco::UInt8>(); |
1196 | } |
1197 | |
1198 | |
1199 | inline bool operator < (const Poco::UInt8& other, const Var& da) |
1200 | /// Less than operator for comparing Var with Poco::UInt8 |
1201 | { |
1202 | if (da.isEmpty()) return false; |
1203 | return other < da.convert<Poco::UInt8>(); |
1204 | } |
1205 | |
1206 | |
1207 | inline bool operator <= (const Poco::UInt8& other, const Var& da) |
1208 | /// Less than or equal operator for comparing Var with Poco::UInt8 |
1209 | { |
1210 | if (da.isEmpty()) return false; |
1211 | return other <= da.convert<Poco::UInt8>(); |
1212 | } |
1213 | |
1214 | |
1215 | inline bool operator > (const Poco::UInt8& other, const Var& da) |
1216 | /// Greater than operator for comparing Var with Poco::UInt8 |
1217 | { |
1218 | if (da.isEmpty()) return false; |
1219 | return other > da.convert<Poco::UInt8>(); |
1220 | } |
1221 | |
1222 | |
1223 | inline bool operator >= (const Poco::UInt8& other, const Var& da) |
1224 | /// Greater than or equal operator for comparing Var with Poco::UInt8 |
1225 | { |
1226 | if (da.isEmpty()) return false; |
1227 | return other >= da.convert<Poco::UInt8>(); |
1228 | } |
1229 | |
1230 | |
1231 | inline Poco::Int16 operator + (const Poco::Int16& other, const Var& da) |
1232 | /// Addition operator for adding Var to Poco::Int16 |
1233 | { |
1234 | return other + da.convert<Poco::Int16>(); |
1235 | } |
1236 | |
1237 | |
1238 | inline Poco::Int16 operator - (const Poco::Int16& other, const Var& da) |
1239 | /// Subtraction operator for subtracting Var from Poco::Int16 |
1240 | { |
1241 | return other - da.convert<Poco::Int16>(); |
1242 | } |
1243 | |
1244 | |
1245 | inline Poco::Int16 operator * (const Poco::Int16& other, const Var& da) |
1246 | /// Multiplication operator for multiplying Var with Poco::Int16 |
1247 | { |
1248 | return other * da.convert<Poco::Int16>(); |
1249 | } |
1250 | |
1251 | |
1252 | inline Poco::Int16 operator / (const Poco::Int16& other, const Var& da) |
1253 | /// Division operator for dividing Var with Poco::Int16 |
1254 | { |
1255 | return other / da.convert<Poco::Int16>(); |
1256 | } |
1257 | |
1258 | |
1259 | inline Poco::Int16 operator += (Poco::Int16& other, const Var& da) |
1260 | /// Addition asignment operator for adding Var to Poco::Int16 |
1261 | { |
1262 | return other += da.convert<Poco::Int16>(); |
1263 | } |
1264 | |
1265 | |
1266 | inline Poco::Int16 operator -= (Poco::Int16& other, const Var& da) |
1267 | /// Subtraction asignment operator for subtracting Var from Poco::Int16 |
1268 | { |
1269 | return other -= da.convert<Poco::Int16>(); |
1270 | } |
1271 | |
1272 | |
1273 | inline Poco::Int16 operator *= (Poco::Int16& other, const Var& da) |
1274 | /// Multiplication asignment operator for multiplying Var with Poco::Int16 |
1275 | { |
1276 | return other *= da.convert<Poco::Int16>(); |
1277 | } |
1278 | |
1279 | |
1280 | inline Poco::Int16 operator /= (Poco::Int16& other, const Var& da) |
1281 | /// Division asignment operator for dividing Var with Poco::Int16 |
1282 | { |
1283 | return other /= da.convert<Poco::Int16>(); |
1284 | } |
1285 | |
1286 | |
1287 | inline bool operator == (const Poco::Int16& other, const Var& da) |
1288 | /// Equality operator for comparing Var with Poco::Int16 |
1289 | { |
1290 | if (da.isEmpty()) return false; |
1291 | return other == da.convert<Poco::Int16>(); |
1292 | } |
1293 | |
1294 | |
1295 | inline bool operator != (const Poco::Int16& other, const Var& da) |
1296 | /// Inequality operator for comparing Var with Poco::Int16 |
1297 | { |
1298 | if (da.isEmpty()) return true; |
1299 | return other != da.convert<Poco::Int16>(); |
1300 | } |
1301 | |
1302 | |
1303 | inline bool operator < (const Poco::Int16& other, const Var& da) |
1304 | /// Less than operator for comparing Var with Poco::Int16 |
1305 | { |
1306 | if (da.isEmpty()) return false; |
1307 | return other < da.convert<Poco::Int16>(); |
1308 | } |
1309 | |
1310 | |
1311 | inline bool operator <= (const Poco::Int16& other, const Var& da) |
1312 | /// Less than or equal operator for comparing Var with Poco::Int16 |
1313 | { |
1314 | if (da.isEmpty()) return false; |
1315 | return other <= da.convert<Poco::Int16>(); |
1316 | } |
1317 | |
1318 | |
1319 | inline bool operator > (const Poco::Int16& other, const Var& da) |
1320 | /// Greater than operator for comparing Var with Poco::Int16 |
1321 | { |
1322 | if (da.isEmpty()) return false; |
1323 | return other > da.convert<Poco::Int16>(); |
1324 | } |
1325 | |
1326 | |
1327 | inline bool operator >= (const Poco::Int16& other, const Var& da) |
1328 | /// Greater than or equal operator for comparing Var with Poco::Int16 |
1329 | { |
1330 | if (da.isEmpty()) return false; |
1331 | return other >= da.convert<Poco::Int16>(); |
1332 | } |
1333 | |
1334 | |
1335 | inline Poco::UInt16 operator + (const Poco::UInt16& other, const Var& da) |
1336 | /// Addition operator for adding Var to Poco::UInt16 |
1337 | { |
1338 | return other + da.convert<Poco::UInt16>(); |
1339 | } |
1340 | |
1341 | |
1342 | inline Poco::UInt16 operator - (const Poco::UInt16& other, const Var& da) |
1343 | /// Subtraction operator for subtracting Var from Poco::UInt16 |
1344 | { |
1345 | return other - da.convert<Poco::UInt16>(); |
1346 | } |
1347 | |
1348 | |
1349 | inline Poco::UInt16 operator * (const Poco::UInt16& other, const Var& da) |
1350 | /// Multiplication operator for multiplying Var with Poco::UInt16 |
1351 | { |
1352 | return other * da.convert<Poco::UInt16>(); |
1353 | } |
1354 | |
1355 | |
1356 | inline Poco::UInt16 operator / (const Poco::UInt16& other, const Var& da) |
1357 | /// Division operator for dividing Var with Poco::UInt16 |
1358 | { |
1359 | return other / da.convert<Poco::UInt16>(); |
1360 | } |
1361 | |
1362 | |
1363 | inline Poco::UInt16 operator += (Poco::UInt16& other, const Var& da) |
1364 | /// Addition asignment operator for adding Var to Poco::UInt16 |
1365 | { |
1366 | return other += da.convert<Poco::UInt16>(); |
1367 | } |
1368 | |
1369 | |
1370 | inline Poco::UInt16 operator -= (Poco::UInt16& other, const Var& da) |
1371 | /// Subtraction asignment operator for subtracting Var from Poco::UInt16 |
1372 | { |
1373 | return other -= da.convert<Poco::UInt16>(); |
1374 | } |
1375 | |
1376 | |
1377 | inline Poco::UInt16 operator *= (Poco::UInt16& other, const Var& da) |
1378 | /// Multiplication asignment operator for multiplying Var with Poco::UInt16 |
1379 | { |
1380 | return other *= da.convert<Poco::UInt16>(); |
1381 | } |
1382 | |
1383 | |
1384 | inline Poco::UInt16 operator /= (Poco::UInt16& other, const Var& da) |
1385 | /// Division asignment operator for dividing Var with Poco::UInt16 |
1386 | { |
1387 | return other /= da.convert<Poco::UInt16>(); |
1388 | } |
1389 | |
1390 | |
1391 | inline bool operator == (const Poco::UInt16& other, const Var& da) |
1392 | /// Equality operator for comparing Var with Poco::UInt16 |
1393 | { |
1394 | if (da.isEmpty()) return false; |
1395 | return other == da.convert<Poco::UInt16>(); |
1396 | } |
1397 | |
1398 | |
1399 | inline bool operator != (const Poco::UInt16& other, const Var& da) |
1400 | /// Inequality operator for comparing Var with Poco::UInt16 |
1401 | { |
1402 | if (da.isEmpty()) return true; |
1403 | return other != da.convert<Poco::UInt16>(); |
1404 | } |
1405 | |
1406 | |
1407 | inline bool operator < (const Poco::UInt16& other, const Var& da) |
1408 | /// Less than operator for comparing Var with Poco::UInt16 |
1409 | { |
1410 | if (da.isEmpty()) return false; |
1411 | return other < da.convert<Poco::UInt16>(); |
1412 | } |
1413 | |
1414 | |
1415 | inline bool operator <= (const Poco::UInt16& other, const Var& da) |
1416 | /// Less than or equal operator for comparing Var with Poco::UInt16 |
1417 | { |
1418 | if (da.isEmpty()) return false; |
1419 | return other <= da.convert<Poco::UInt16>(); |
1420 | } |
1421 | |
1422 | |
1423 | inline bool operator > (const Poco::UInt16& other, const Var& da) |
1424 | /// Greater than operator for comparing Var with Poco::UInt16 |
1425 | { |
1426 | if (da.isEmpty()) return false; |
1427 | return other > da.convert<Poco::UInt16>(); |
1428 | } |
1429 | |
1430 | |
1431 | inline bool operator >= (const Poco::UInt16& other, const Var& da) |
1432 | /// Greater than or equal operator for comparing Var with Poco::UInt16 |
1433 | { |
1434 | if (da.isEmpty()) return false; |
1435 | return other >= da.convert<Poco::UInt16>(); |
1436 | } |
1437 | |
1438 | |
1439 | inline Poco::Int32 operator + (const Poco::Int32& other, const Var& da) |
1440 | /// Addition operator for adding Var to Poco::Int32 |
1441 | { |
1442 | return other + da.convert<Poco::Int32>(); |
1443 | } |
1444 | |
1445 | |
1446 | inline Poco::Int32 operator - (const Poco::Int32& other, const Var& da) |
1447 | /// Subtraction operator for subtracting Var from Poco::Int32 |
1448 | { |
1449 | return other - da.convert<Poco::Int32>(); |
1450 | } |
1451 | |
1452 | |
1453 | inline Poco::Int32 operator * (const Poco::Int32& other, const Var& da) |
1454 | /// Multiplication operator for multiplying Var with Poco::Int32 |
1455 | { |
1456 | return other * da.convert<Poco::Int32>(); |
1457 | } |
1458 | |
1459 | |
1460 | inline Poco::Int32 operator / (const Poco::Int32& other, const Var& da) |
1461 | /// Division operator for dividing Var with Poco::Int32 |
1462 | { |
1463 | return other / da.convert<Poco::Int32>(); |
1464 | } |
1465 | |
1466 | |
1467 | inline Poco::Int32 operator += (Poco::Int32& other, const Var& da) |
1468 | /// Addition asignment operator for adding Var to Poco::Int32 |
1469 | { |
1470 | return other += da.convert<Poco::Int32>(); |
1471 | } |
1472 | |
1473 | |
1474 | inline Poco::Int32 operator -= (Poco::Int32& other, const Var& da) |
1475 | /// Subtraction asignment operator for subtracting Var from Poco::Int32 |
1476 | { |
1477 | return other -= da.convert<Poco::Int32>(); |
1478 | } |
1479 | |
1480 | |
1481 | inline Poco::Int32 operator *= (Poco::Int32& other, const Var& da) |
1482 | /// Multiplication asignment operator for multiplying Var with Poco::Int32 |
1483 | { |
1484 | return other *= da.convert<Poco::Int32>(); |
1485 | } |
1486 | |
1487 | |
1488 | inline Poco::Int32 operator /= (Poco::Int32& other, const Var& da) |
1489 | /// Division asignment operator for dividing Var with Poco::Int32 |
1490 | { |
1491 | return other /= da.convert<Poco::Int32>(); |
1492 | } |
1493 | |
1494 | |
1495 | inline bool operator == (const Poco::Int32& other, const Var& da) |
1496 | /// Equality operator for comparing Var with Poco::Int32 |
1497 | { |
1498 | if (da.isEmpty()) return false; |
1499 | return other == da.convert<Poco::Int32>(); |
1500 | } |
1501 | |
1502 | |
1503 | inline bool operator != (const Poco::Int32& other, const Var& da) |
1504 | /// Inequality operator for comparing Var with Poco::Int32 |
1505 | { |
1506 | if (da.isEmpty()) return true; |
1507 | return other != da.convert<Poco::Int32>(); |
1508 | } |
1509 | |
1510 | |
1511 | inline bool operator < (const Poco::Int32& other, const Var& da) |
1512 | /// Less than operator for comparing Var with Poco::Int32 |
1513 | { |
1514 | if (da.isEmpty()) return false; |
1515 | return other < da.convert<Poco::Int32>(); |
1516 | } |
1517 | |
1518 | |
1519 | inline bool operator <= (const Poco::Int32& other, const Var& da) |
1520 | /// Less than or equal operator for comparing Var with Poco::Int32 |
1521 | { |
1522 | if (da.isEmpty()) return false; |
1523 | return other <= da.convert<Poco::Int32>(); |
1524 | } |
1525 | |
1526 | |
1527 | inline bool operator > (const Poco::Int32& other, const Var& da) |
1528 | /// Greater than operator for comparing Var with Poco::Int32 |
1529 | { |
1530 | if (da.isEmpty()) return false; |
1531 | return other > da.convert<Poco::Int32>(); |
1532 | } |
1533 | |
1534 | |
1535 | inline bool operator >= (const Poco::Int32& other, const Var& da) |
1536 | /// Greater than or equal operator for comparing Var with Poco::Int32 |
1537 | { |
1538 | if (da.isEmpty()) return false; |
1539 | return other >= da.convert<Poco::Int32>(); |
1540 | } |
1541 | |
1542 | |
1543 | inline Poco::UInt32 operator + (const Poco::UInt32& other, const Var& da) |
1544 | /// Addition operator for adding Var to Poco::UInt32 |
1545 | { |
1546 | return other + da.convert<Poco::UInt32>(); |
1547 | } |
1548 | |
1549 | |
1550 | inline Poco::UInt32 operator - (const Poco::UInt32& other, const Var& da) |
1551 | /// Subtraction operator for subtracting Var from Poco::UInt32 |
1552 | { |
1553 | return other - da.convert<Poco::UInt32>(); |
1554 | } |
1555 | |
1556 | |
1557 | inline Poco::UInt32 operator * (const Poco::UInt32& other, const Var& da) |
1558 | /// Multiplication operator for multiplying Var with Poco::UInt32 |
1559 | { |
1560 | return other * da.convert<Poco::UInt32>(); |
1561 | } |
1562 | |
1563 | |
1564 | inline Poco::UInt32 operator / (const Poco::UInt32& other, const Var& da) |
1565 | /// Division operator for dividing Var with Poco::UInt32 |
1566 | { |
1567 | return other / da.convert<Poco::UInt32>(); |
1568 | } |
1569 | |
1570 | |
1571 | inline Poco::UInt32 operator += (Poco::UInt32& other, const Var& da) |
1572 | /// Addition asignment operator for adding Var to Poco::UInt32 |
1573 | { |
1574 | return other += da.convert<Poco::UInt32>(); |
1575 | } |
1576 | |
1577 | |
1578 | inline Poco::UInt32 operator -= (Poco::UInt32& other, const Var& da) |
1579 | /// Subtraction asignment operator for subtracting Var from Poco::UInt32 |
1580 | { |
1581 | return other -= da.convert<Poco::UInt32>(); |
1582 | } |
1583 | |
1584 | |
1585 | inline Poco::UInt32 operator *= (Poco::UInt32& other, const Var& da) |
1586 | /// Multiplication asignment operator for multiplying Var with Poco::UInt32 |
1587 | { |
1588 | return other *= da.convert<Poco::UInt32>(); |
1589 | } |
1590 | |
1591 | |
1592 | inline Poco::UInt32 operator /= (Poco::UInt32& other, const Var& da) |
1593 | /// Division asignment operator for dividing Var with Poco::UInt32 |
1594 | { |
1595 | return other /= da.convert<Poco::UInt32>(); |
1596 | } |
1597 | |
1598 | |
1599 | inline bool operator == (const Poco::UInt32& other, const Var& da) |
1600 | /// Equality operator for comparing Var with Poco::UInt32 |
1601 | { |
1602 | if (da.isEmpty()) return false; |
1603 | return other == da.convert<Poco::UInt32>(); |
1604 | } |
1605 | |
1606 | |
1607 | inline bool operator != (const Poco::UInt32& other, const Var& da) |
1608 | /// Inequality operator for comparing Var with Poco::UInt32 |
1609 | { |
1610 | if (da.isEmpty()) return true; |
1611 | return other != da.convert<Poco::UInt32>(); |
1612 | } |
1613 | |
1614 | |
1615 | inline bool operator < (const Poco::UInt32& other, const Var& da) |
1616 | /// Less than operator for comparing Var with Poco::UInt32 |
1617 | { |
1618 | if (da.isEmpty()) return false; |
1619 | return other < da.convert<Poco::UInt32>(); |
1620 | } |
1621 | |
1622 | |
1623 | inline bool operator <= (const Poco::UInt32& other, const Var& da) |
1624 | /// Less than or equal operator for comparing Var with Poco::UInt32 |
1625 | { |
1626 | if (da.isEmpty()) return false; |
1627 | return other <= da.convert<Poco::UInt32>(); |
1628 | } |
1629 | |
1630 | |
1631 | inline bool operator > (const Poco::UInt32& other, const Var& da) |
1632 | /// Greater than operator for comparing Var with Poco::UInt32 |
1633 | { |
1634 | if (da.isEmpty()) return false; |
1635 | return other > da.convert<Poco::UInt32>(); |
1636 | } |
1637 | |
1638 | |
1639 | inline bool operator >= (const Poco::UInt32& other, const Var& da) |
1640 | /// Greater than or equal operator for comparing Var with Poco::UInt32 |
1641 | { |
1642 | if (da.isEmpty()) return false; |
1643 | return other >= da.convert<Poco::UInt32>(); |
1644 | } |
1645 | |
1646 | |
1647 | inline Poco::Int64 operator + (const Poco::Int64& other, const Var& da) |
1648 | /// Addition operator for adding Var to Poco::Int64 |
1649 | { |
1650 | return other + da.convert<Poco::Int64>(); |
1651 | } |
1652 | |
1653 | |
1654 | inline Poco::Int64 operator - (const Poco::Int64& other, const Var& da) |
1655 | /// Subtraction operator for subtracting Var from Poco::Int64 |
1656 | { |
1657 | return other - da.convert<Poco::Int64>(); |
1658 | } |
1659 | |
1660 | |
1661 | inline Poco::Int64 operator * (const Poco::Int64& other, const Var& da) |
1662 | /// Multiplication operator for multiplying Var with Poco::Int64 |
1663 | { |
1664 | return other * da.convert<Poco::Int64>(); |
1665 | } |
1666 | |
1667 | |
1668 | inline Poco::Int64 operator / (const Poco::Int64& other, const Var& da) |
1669 | /// Division operator for dividing Var with Poco::Int64 |
1670 | { |
1671 | return other / da.convert<Poco::Int64>(); |
1672 | } |
1673 | |
1674 | |
1675 | inline Poco::Int64 operator += (Poco::Int64& other, const Var& da) |
1676 | /// Addition asignment operator for adding Var to Poco::Int64 |
1677 | { |
1678 | return other += da.convert<Poco::Int64>(); |
1679 | } |
1680 | |
1681 | |
1682 | inline Poco::Int64 operator -= (Poco::Int64& other, const Var& da) |
1683 | /// Subtraction asignment operator for subtracting Var from Poco::Int64 |
1684 | { |
1685 | return other -= da.convert<Poco::Int64>(); |
1686 | } |
1687 | |
1688 | |
1689 | inline Poco::Int64 operator *= (Poco::Int64& other, const Var& da) |
1690 | /// Multiplication asignment operator for multiplying Var with Poco::Int64 |
1691 | { |
1692 | return other *= da.convert<Poco::Int64>(); |
1693 | } |
1694 | |
1695 | |
1696 | inline Poco::Int64 operator /= (Poco::Int64& other, const Var& da) |
1697 | /// Division asignment operator for dividing Var with Poco::Int64 |
1698 | { |
1699 | return other /= da.convert<Poco::Int64>(); |
1700 | } |
1701 | |
1702 | |
1703 | inline bool operator == (const Poco::Int64& other, const Var& da) |
1704 | /// Equality operator for comparing Var with Poco::Int64 |
1705 | { |
1706 | if (da.isEmpty()) return false; |
1707 | return other == da.convert<Poco::Int64>(); |
1708 | } |
1709 | |
1710 | |
1711 | inline bool operator != (const Poco::Int64& other, const Var& da) |
1712 | /// Inequality operator for comparing Var with Poco::Int64 |
1713 | { |
1714 | if (da.isEmpty()) return true; |
1715 | return other != da.convert<Poco::Int64>(); |
1716 | } |
1717 | |
1718 | |
1719 | inline bool operator < (const Poco::Int64& other, const Var& da) |
1720 | /// Less than operator for comparing Var with Poco::Int64 |
1721 | { |
1722 | if (da.isEmpty()) return false; |
1723 | return other < da.convert<Poco::Int64>(); |
1724 | } |
1725 | |
1726 | |
1727 | inline bool operator <= (const Poco::Int64& other, const Var& da) |
1728 | /// Less than or equal operator for comparing Var with Poco::Int64 |
1729 | { |
1730 | if (da.isEmpty()) return false; |
1731 | return other <= da.convert<Poco::Int64>(); |
1732 | } |
1733 | |
1734 | |
1735 | inline bool operator > (const Poco::Int64& other, const Var& da) |
1736 | /// Greater than operator for comparing Var with Poco::Int64 |
1737 | { |
1738 | if (da.isEmpty()) return false; |
1739 | return other > da.convert<Poco::Int64>(); |
1740 | } |
1741 | |
1742 | |
1743 | inline bool operator >= (const Poco::Int64& other, const Var& da) |
1744 | /// Greater than or equal operator for comparing Var with Poco::Int64 |
1745 | { |
1746 | if (da.isEmpty()) return false; |
1747 | return other >= da.convert<Poco::Int64>(); |
1748 | } |
1749 | |
1750 | |
1751 | inline Poco::UInt64 operator + (const Poco::UInt64& other, const Var& da) |
1752 | /// Addition operator for adding Var to Poco::UInt64 |
1753 | { |
1754 | return other + da.convert<Poco::UInt64>(); |
1755 | } |
1756 | |
1757 | |
1758 | inline Poco::UInt64 operator - (const Poco::UInt64& other, const Var& da) |
1759 | /// Subtraction operator for subtracting Var from Poco::UInt64 |
1760 | { |
1761 | return other - da.convert<Poco::UInt64>(); |
1762 | } |
1763 | |
1764 | |
1765 | inline Poco::UInt64 operator * (const Poco::UInt64& other, const Var& da) |
1766 | /// Multiplication operator for multiplying Var with Poco::UInt64 |
1767 | { |
1768 | return other * da.convert<Poco::UInt64>(); |
1769 | } |
1770 | |
1771 | |
1772 | inline Poco::UInt64 operator / (const Poco::UInt64& other, const Var& da) |
1773 | /// Division operator for dividing Var with Poco::UInt64 |
1774 | { |
1775 | return other / da.convert<Poco::UInt64>(); |
1776 | } |
1777 | |
1778 | |
1779 | inline Poco::UInt64 operator += (Poco::UInt64& other, const Var& da) |
1780 | /// Addition asignment operator for adding Var to Poco::UInt64 |
1781 | { |
1782 | return other += da.convert<Poco::UInt64>(); |
1783 | } |
1784 | |
1785 | |
1786 | inline Poco::UInt64 operator -= (Poco::UInt64& other, const Var& da) |
1787 | /// Subtraction asignment operator for subtracting Var from Poco::UInt64 |
1788 | { |
1789 | return other -= da.convert<Poco::UInt64>(); |
1790 | } |
1791 | |
1792 | |
1793 | inline Poco::UInt64 operator *= (Poco::UInt64& other, const Var& da) |
1794 | /// Multiplication asignment operator for multiplying Var with Poco::UInt64 |
1795 | { |
1796 | return other *= da.convert<Poco::UInt64>(); |
1797 | } |
1798 | |
1799 | |
1800 | inline Poco::UInt64 operator /= (Poco::UInt64& other, const Var& da) |
1801 | /// Division asignment operator for dividing Var with Poco::UInt64 |
1802 | { |
1803 | return other /= da.convert<Poco::UInt64>(); |
1804 | } |
1805 | |
1806 | |
1807 | inline bool operator == (const Poco::UInt64& other, const Var& da) |
1808 | /// Equality operator for comparing Var with Poco::UInt64 |
1809 | { |
1810 | if (da.isEmpty()) return false; |
1811 | return other == da.convert<Poco::UInt64>(); |
1812 | } |
1813 | |
1814 | |
1815 | inline bool operator != (const Poco::UInt64& other, const Var& da) |
1816 | /// Inequality operator for comparing Var with Poco::UInt64 |
1817 | { |
1818 | if (da.isEmpty()) return true; |
1819 | return other != da.convert<Poco::UInt64>(); |
1820 | } |
1821 | |
1822 | |
1823 | inline bool operator < (const Poco::UInt64& other, const Var& da) |
1824 | /// Less than operator for comparing Var with Poco::UInt64 |
1825 | { |
1826 | if (da.isEmpty()) return false; |
1827 | return other < da.convert<Poco::UInt64>(); |
1828 | } |
1829 | |
1830 | |
1831 | inline bool operator <= (const Poco::UInt64& other, const Var& da) |
1832 | /// Less than or equal operator for comparing Var with Poco::UInt64 |
1833 | { |
1834 | if (da.isEmpty()) return false; |
1835 | return other <= da.convert<Poco::UInt64>(); |
1836 | } |
1837 | |
1838 | |
1839 | inline bool operator > (const Poco::UInt64& other, const Var& da) |
1840 | /// Greater than operator for comparing Var with Poco::UInt64 |
1841 | { |
1842 | if (da.isEmpty()) return false; |
1843 | return other > da.convert<Poco::UInt64>(); |
1844 | } |
1845 | |
1846 | |
1847 | inline bool operator >= (const Poco::UInt64& other, const Var& da) |
1848 | /// Greater than or equal operator for comparing Var with Poco::UInt64 |
1849 | { |
1850 | if (da.isEmpty()) return false; |
1851 | return other >= da.convert<Poco::UInt64>(); |
1852 | } |
1853 | |
1854 | |
1855 | inline float operator + (const float& other, const Var& da) |
1856 | /// Addition operator for adding Var to float |
1857 | { |
1858 | return other + da.convert<float>(); |
1859 | } |
1860 | |
1861 | |
1862 | inline float operator - (const float& other, const Var& da) |
1863 | /// Subtraction operator for subtracting Var from float |
1864 | { |
1865 | return other - da.convert<float>(); |
1866 | } |
1867 | |
1868 | |
1869 | inline float operator * (const float& other, const Var& da) |
1870 | /// Multiplication operator for multiplying Var with float |
1871 | { |
1872 | return other * da.convert<float>(); |
1873 | } |
1874 | |
1875 | |
1876 | inline float operator / (const float& other, const Var& da) |
1877 | /// Division operator for dividing Var with float |
1878 | { |
1879 | return other / da.convert<float>(); |
1880 | } |
1881 | |
1882 | |
1883 | inline float operator += (float& other, const Var& da) |
1884 | /// Addition asignment operator for adding Var to float |
1885 | { |
1886 | return other += da.convert<float>(); |
1887 | } |
1888 | |
1889 | |
1890 | inline float operator -= (float& other, const Var& da) |
1891 | /// Subtraction asignment operator for subtracting Var from float |
1892 | { |
1893 | return other -= da.convert<float>(); |
1894 | } |
1895 | |
1896 | |
1897 | inline float operator *= (float& other, const Var& da) |
1898 | /// Multiplication asignment operator for multiplying Var with float |
1899 | { |
1900 | return other *= da.convert<float>(); |
1901 | } |
1902 | |
1903 | |
1904 | inline float operator /= (float& other, const Var& da) |
1905 | /// Division asignment operator for dividing Var with float |
1906 | { |
1907 | return other /= da.convert<float>(); |
1908 | } |
1909 | |
1910 | |
1911 | inline bool operator == (const float& other, const Var& da) |
1912 | /// Equality operator for comparing Var with float |
1913 | { |
1914 | if (da.isEmpty()) return false; |
1915 | return other == da.convert<float>(); |
1916 | } |
1917 | |
1918 | |
1919 | inline bool operator != (const float& other, const Var& da) |
1920 | /// Inequality operator for comparing Var with float |
1921 | { |
1922 | if (da.isEmpty()) return true; |
1923 | return other != da.convert<float>(); |
1924 | } |
1925 | |
1926 | |
1927 | inline bool operator < (const float& other, const Var& da) |
1928 | /// Less than operator for comparing Var with float |
1929 | { |
1930 | if (da.isEmpty()) return false; |
1931 | return other < da.convert<float>(); |
1932 | } |
1933 | |
1934 | |
1935 | inline bool operator <= (const float& other, const Var& da) |
1936 | /// Less than or equal operator for comparing Var with float |
1937 | { |
1938 | if (da.isEmpty()) return false; |
1939 | return other <= da.convert<float>(); |
1940 | } |
1941 | |
1942 | |
1943 | inline bool operator > (const float& other, const Var& da) |
1944 | /// Greater than operator for comparing Var with float |
1945 | { |
1946 | if (da.isEmpty()) return false; |
1947 | return other > da.convert<float>(); |
1948 | } |
1949 | |
1950 | |
1951 | inline bool operator >= (const float& other, const Var& da) |
1952 | /// Greater than or equal operator for comparing Var with float |
1953 | { |
1954 | if (da.isEmpty()) return false; |
1955 | return other >= da.convert<float>(); |
1956 | } |
1957 | |
1958 | |
1959 | inline double operator + (const double& other, const Var& da) |
1960 | /// Addition operator for adding Var to double |
1961 | { |
1962 | return other + da.convert<double>(); |
1963 | } |
1964 | |
1965 | |
1966 | inline double operator - (const double& other, const Var& da) |
1967 | /// Subtraction operator for subtracting Var from double |
1968 | { |
1969 | return other - da.convert<double>(); |
1970 | } |
1971 | |
1972 | |
1973 | inline double operator * (const double& other, const Var& da) |
1974 | /// Multiplication operator for multiplying Var with double |
1975 | { |
1976 | return other * da.convert<double>(); |
1977 | } |
1978 | |
1979 | |
1980 | inline double operator / (const double& other, const Var& da) |
1981 | /// Division operator for dividing Var with double |
1982 | { |
1983 | return other / da.convert<double>(); |
1984 | } |
1985 | |
1986 | |
1987 | inline double operator += (double& other, const Var& da) |
1988 | /// Addition asignment operator for adding Var to double |
1989 | { |
1990 | return other += da.convert<double>(); |
1991 | } |
1992 | |
1993 | |
1994 | inline double operator -= (double& other, const Var& da) |
1995 | /// Subtraction asignment operator for subtracting Var from double |
1996 | { |
1997 | return other -= da.convert<double>(); |
1998 | } |
1999 | |
2000 | |
2001 | inline double operator *= (double& other, const Var& da) |
2002 | /// Multiplication asignment operator for multiplying Var with double |
2003 | { |
2004 | return other *= da.convert<double>(); |
2005 | } |
2006 | |
2007 | |
2008 | inline double operator /= (double& other, const Var& da) |
2009 | /// Division asignment operator for dividing Var with double |
2010 | { |
2011 | return other /= da.convert<double>(); |
2012 | } |
2013 | |
2014 | |
2015 | inline bool operator == (const double& other, const Var& da) |
2016 | /// Equality operator for comparing Var with double |
2017 | { |
2018 | if (da.isEmpty()) return false; |
2019 | return other == da.convert<double>(); |
2020 | } |
2021 | |
2022 | |
2023 | inline bool operator != (const double& other, const Var& da) |
2024 | /// Inequality operator for comparing Var with double |
2025 | { |
2026 | if (da.isEmpty()) return true; |
2027 | return other != da.convert<double>(); |
2028 | } |
2029 | |
2030 | |
2031 | inline bool operator < (const double& other, const Var& da) |
2032 | /// Less than operator for comparing Var with double |
2033 | { |
2034 | if (da.isEmpty()) return false; |
2035 | return other < da.convert<double>(); |
2036 | } |
2037 | |
2038 | |
2039 | inline bool operator <= (const double& other, const Var& da) |
2040 | /// Less than or equal operator for comparing Var with double |
2041 | { |
2042 | if (da.isEmpty()) return false; |
2043 | return other <= da.convert<double>(); |
2044 | } |
2045 | |
2046 | |
2047 | inline bool operator > (const double& other, const Var& da) |
2048 | /// Greater than operator for comparing Var with double |
2049 | { |
2050 | if (da.isEmpty()) return false; |
2051 | return other > da.convert<double>(); |
2052 | } |
2053 | |
2054 | |
2055 | inline bool operator >= (const double& other, const Var& da) |
2056 | /// Greater than or equal operator for comparing Var with double |
2057 | { |
2058 | if (da.isEmpty()) return false; |
2059 | return other >= da.convert<double>(); |
2060 | } |
2061 | |
2062 | |
2063 | inline bool operator == (const bool& other, const Var& da) |
2064 | /// Equality operator for comparing Var with bool |
2065 | { |
2066 | if (da.isEmpty()) return false; |
2067 | return other == da.convert<bool>(); |
2068 | } |
2069 | |
2070 | |
2071 | inline bool operator != (const bool& other, const Var& da) |
2072 | /// Inequality operator for comparing Var with bool |
2073 | { |
2074 | if (da.isEmpty()) return true; |
2075 | return other != da.convert<bool>(); |
2076 | } |
2077 | |
2078 | |
2079 | inline bool operator == (const std::string& other, const Var& da) |
2080 | /// Equality operator for comparing Var with std::string |
2081 | { |
2082 | if (da.isEmpty()) return false; |
2083 | return other == da.convert<std::string>(); |
2084 | } |
2085 | |
2086 | |
2087 | inline bool operator != (const std::string& other, const Var& da) |
2088 | /// Inequality operator for comparing Var with std::string |
2089 | { |
2090 | if (da.isEmpty()) return true; |
2091 | return other != da.convert<std::string>(); |
2092 | } |
2093 | |
2094 | |
2095 | inline bool operator == (const UTF16String& other, const Var& da) |
2096 | /// Equality operator for comparing Var with UTF16String |
2097 | { |
2098 | if (da.isEmpty()) return false; |
2099 | return other == da.convert<UTF16String>(); |
2100 | } |
2101 | |
2102 | |
2103 | inline bool operator != (const UTF16String& other, const Var& da) |
2104 | /// Inequality operator for comparing Var with UTF16String |
2105 | { |
2106 | if (da.isEmpty()) return true; |
2107 | return other != da.convert<UTF16String>(); |
2108 | } |
2109 | |
2110 | |
2111 | inline bool operator == (const char* other, const Var& da) |
2112 | /// Equality operator for comparing Var with const char* |
2113 | { |
2114 | if (da.isEmpty()) return false; |
2115 | return da.convert<std::string>() == other; |
2116 | } |
2117 | |
2118 | |
2119 | inline bool operator != (const char* other, const Var& da) |
2120 | /// Inequality operator for comparing Var with const char* |
2121 | { |
2122 | if (da.isEmpty()) return true; |
2123 | return da.convert<std::string>() != other; |
2124 | } |
2125 | |
2126 | |
2127 | #ifndef POCO_LONG_IS_64_BIT |
2128 | |
2129 | |
2130 | inline long operator + (const long& other, const Var& da) |
2131 | /// Addition operator for adding Var to long |
2132 | { |
2133 | return other + da.convert<long>(); |
2134 | } |
2135 | |
2136 | |
2137 | inline long operator - (const long& other, const Var& da) |
2138 | /// Subtraction operator for subtracting Var from long |
2139 | { |
2140 | return other - da.convert<long>(); |
2141 | } |
2142 | |
2143 | |
2144 | inline long operator * (const long& other, const Var& da) |
2145 | /// Multiplication operator for multiplying Var with long |
2146 | { |
2147 | return other * da.convert<long>(); |
2148 | } |
2149 | |
2150 | |
2151 | inline long operator / (const long& other, const Var& da) |
2152 | /// Division operator for dividing Var with long |
2153 | { |
2154 | return other / da.convert<long>(); |
2155 | } |
2156 | |
2157 | |
2158 | inline long operator += (long& other, const Var& da) |
2159 | /// Addition asignment operator for adding Var to long |
2160 | { |
2161 | return other += da.convert<long>(); |
2162 | } |
2163 | |
2164 | |
2165 | inline long operator -= (long& other, const Var& da) |
2166 | /// Subtraction asignment operator for subtracting Var from long |
2167 | { |
2168 | return other -= da.convert<long>(); |
2169 | } |
2170 | |
2171 | |
2172 | inline long operator *= (long& other, const Var& da) |
2173 | /// Multiplication asignment operator for multiplying Var with long |
2174 | { |
2175 | return other *= da.convert<long>(); |
2176 | } |
2177 | |
2178 | |
2179 | inline long operator /= (long& other, const Var& da) |
2180 | /// Division asignment operator for dividing Var with long |
2181 | { |
2182 | return other /= da.convert<long>(); |
2183 | } |
2184 | |
2185 | |
2186 | inline bool operator == (const long& other, const Var& da) |
2187 | /// Equality operator for comparing Var with long |
2188 | { |
2189 | if (da.isEmpty()) return false; |
2190 | return other == da.convert<long>(); |
2191 | } |
2192 | |
2193 | |
2194 | inline bool operator != (const long& other, const Var& da) |
2195 | /// Inequality operator for comparing Var with long |
2196 | { |
2197 | if (da.isEmpty()) return true; |
2198 | return other != da.convert<long>(); |
2199 | } |
2200 | |
2201 | |
2202 | inline bool operator < (const long& other, const Var& da) |
2203 | /// Less than operator for comparing Var with long |
2204 | { |
2205 | if (da.isEmpty()) return false; |
2206 | return other < da.convert<long>(); |
2207 | } |
2208 | |
2209 | |
2210 | inline bool operator <= (const long& other, const Var& da) |
2211 | /// Less than or equal operator for comparing Var with long |
2212 | { |
2213 | if (da.isEmpty()) return false; |
2214 | return other <= da.convert<long>(); |
2215 | } |
2216 | |
2217 | |
2218 | inline bool operator > (const long& other, const Var& da) |
2219 | /// Greater than operator for comparing Var with long |
2220 | { |
2221 | if (da.isEmpty()) return false; |
2222 | return other > da.convert<long>(); |
2223 | } |
2224 | |
2225 | |
2226 | inline bool operator >= (const long& other, const Var& da) |
2227 | /// Greater than or equal operator for comparing Var with long |
2228 | { |
2229 | if (da.isEmpty()) return false; |
2230 | return other >= da.convert<long>(); |
2231 | } |
2232 | |
2233 | |
2234 | inline unsigned long operator + (const unsigned long& other, const Var& da) |
2235 | /// Addition operator for adding Var to unsigned long |
2236 | { |
2237 | return other + da.convert<unsigned long>(); |
2238 | } |
2239 | |
2240 | |
2241 | inline unsigned long operator - (const unsigned long& other, const Var& da) |
2242 | /// Subtraction operator for subtracting Var from unsigned long |
2243 | { |
2244 | return other - da.convert<unsigned long>(); |
2245 | } |
2246 | |
2247 | |
2248 | inline unsigned long operator * (const unsigned long& other, const Var& da) |
2249 | /// Multiplication operator for multiplying Var with unsigned long |
2250 | { |
2251 | return other * da.convert<unsigned long>(); |
2252 | } |
2253 | |
2254 | |
2255 | inline unsigned long operator / (const unsigned long& other, const Var& da) |
2256 | /// Division operator for dividing Var with unsigned long |
2257 | { |
2258 | return other / da.convert<unsigned long>(); |
2259 | } |
2260 | |
2261 | |
2262 | inline unsigned long operator += (unsigned long& other, const Var& da) |
2263 | /// Addition assignment operator for adding Var to unsigned long |
2264 | { |
2265 | return other += da.convert<unsigned long>(); |
2266 | } |
2267 | |
2268 | |
2269 | inline unsigned long operator -= (unsigned long& other, const Var& da) |
2270 | /// Subtraction assignment operator for subtracting Var from unsigned long |
2271 | { |
2272 | return other -= da.convert<unsigned long>(); |
2273 | } |
2274 | |
2275 | |
2276 | inline unsigned long operator *= (unsigned long& other, const Var& da) |
2277 | /// Multiplication assignment operator for multiplying Var with unsigned long |
2278 | { |
2279 | return other *= da.convert<unsigned long>(); |
2280 | } |
2281 | |
2282 | |
2283 | inline unsigned long operator /= (unsigned long& other, const Var& da) |
2284 | /// Division assignment operator for dividing Var with unsigned long |
2285 | { |
2286 | return other /= da.convert<unsigned long>(); |
2287 | } |
2288 | |
2289 | |
2290 | inline bool operator == (const unsigned long& other, const Var& da) |
2291 | /// Equality operator for comparing Var with unsigned long |
2292 | { |
2293 | if (da.isEmpty()) return false; |
2294 | return other == da.convert<unsigned long>(); |
2295 | } |
2296 | |
2297 | |
2298 | inline bool operator != (const unsigned long& other, const Var& da) |
2299 | /// Inequality operator for comparing Var with unsigned long |
2300 | { |
2301 | if (da.isEmpty()) return true; |
2302 | return other != da.convert<unsigned long>(); |
2303 | } |
2304 | |
2305 | |
2306 | inline bool operator < (const unsigned long& other, const Var& da) |
2307 | /// Less than operator for comparing Var with unsigned long |
2308 | { |
2309 | if (da.isEmpty()) return false; |
2310 | return other < da.convert<unsigned long>(); |
2311 | } |
2312 | |
2313 | |
2314 | inline bool operator <= (const unsigned long& other, const Var& da) |
2315 | /// Less than or equal operator for comparing Var with unsigned long |
2316 | { |
2317 | if (da.isEmpty()) return false; |
2318 | return other <= da.convert<unsigned long>(); |
2319 | } |
2320 | |
2321 | |
2322 | inline bool operator > (const unsigned long& other, const Var& da) |
2323 | /// Greater than operator for comparing Var with unsigned long |
2324 | { |
2325 | if (da.isEmpty()) return false; |
2326 | return other > da.convert<unsigned long>(); |
2327 | } |
2328 | |
2329 | |
2330 | inline bool operator >= (const unsigned long& other, const Var& da) |
2331 | /// Greater than or equal operator for comparing Var with unsigned long |
2332 | { |
2333 | if (da.isEmpty()) return false; |
2334 | return other >= da.convert<unsigned long>(); |
2335 | } |
2336 | |
2337 | |
2338 | #endif // POCO_LONG_IS_64_BIT |
2339 | |
2340 | |
2341 | } // namespace Dynamic |
2342 | |
2343 | |
2344 | //@ deprecated |
2345 | typedef Dynamic::Var DynamicAny; |
2346 | |
2347 | |
2348 | } // namespace Poco |
2349 | |
2350 | |
2351 | #endif // Foundation_Var_INCLUDED |
2352 | |