mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-02 05:46:22 +01:00
back-port JSON and accompanying Foundation portions (JSONString, Dynamic::Var etc)
This commit is contained in:
@@ -169,6 +169,12 @@ public:
|
||||
return _data.empty();
|
||||
}
|
||||
|
||||
inline void clear()
|
||||
/// Clears the Struct contents
|
||||
{
|
||||
_data.clear();
|
||||
}
|
||||
|
||||
SizeType size() const
|
||||
/// Returns the number of members the Struct contains
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ class Foundation_API Var
|
||||
///
|
||||
/// Loss of signedness is not allowed for numeric values. This means that if an attempt is made to convert
|
||||
/// the internal value which is a negative signed integer to an unsigned integer type storage, a RangeException is thrown.
|
||||
/// Overflow is not allowed, so if the internal value is a larger number than the target numeric type size can accomodate,
|
||||
/// Overflow is not allowed, so if the internal value is a larger number than the target numeric type size can accommodate,
|
||||
/// a RangeException is thrown.
|
||||
///
|
||||
/// Precision loss, such as in conversion from floating-point types to integers or from double to float on platforms
|
||||
@@ -269,16 +269,16 @@ public:
|
||||
|
||||
template <typename T>
|
||||
Var& operator += (const T& other)
|
||||
/// Addition asignment operator for addition/assignment of POD to Var.
|
||||
/// Addition assignment operator for addition/assignment of POD to Var.
|
||||
{
|
||||
return *this = convert<T>() + other;
|
||||
}
|
||||
|
||||
Var& operator += (const Var& other);
|
||||
/// Addition asignment operator overload for Var
|
||||
/// Addition assignment operator overload for Var
|
||||
|
||||
Var& operator += (const char* other);
|
||||
/// Addition asignment operator overload for const char*
|
||||
/// Addition assignment operator overload for const char*
|
||||
|
||||
template <typename T>
|
||||
const Var operator - (const T& other) const
|
||||
@@ -292,13 +292,13 @@ public:
|
||||
|
||||
template <typename T>
|
||||
Var& operator -= (const T& other)
|
||||
/// Subtraction asignment operator
|
||||
/// Subtraction assignment operator
|
||||
{
|
||||
return *this = convert<T>() - other;
|
||||
}
|
||||
|
||||
Var& operator -= (const Var& other);
|
||||
/// Subtraction asignment operator overload for Var
|
||||
/// Subtraction assignment operator overload for Var
|
||||
|
||||
template <typename T>
|
||||
const Var operator * (const T& other) const
|
||||
@@ -312,13 +312,13 @@ public:
|
||||
|
||||
template <typename T>
|
||||
Var& operator *= (const T& other)
|
||||
/// Multiplication asignment operator
|
||||
/// Multiplication assignment operator
|
||||
{
|
||||
return *this = convert<T>() * other;
|
||||
}
|
||||
|
||||
Var& operator *= (const Var& other);
|
||||
/// Multiplication asignment operator overload for Var
|
||||
/// Multiplication assignment operator overload for Var
|
||||
|
||||
template <typename T>
|
||||
const Var operator / (const T& other) const
|
||||
@@ -332,13 +332,13 @@ public:
|
||||
|
||||
template <typename T>
|
||||
Var& operator /= (const T& other)
|
||||
/// Division asignment operator
|
||||
/// Division assignment operator
|
||||
{
|
||||
return *this = convert<T>() / other;
|
||||
}
|
||||
|
||||
Var& operator /= (const Var& other);
|
||||
/// Division asignment operator specialization for Var
|
||||
/// Division assignment operator specialization for Var
|
||||
|
||||
template <typename T>
|
||||
bool operator == (const T& other) const
|
||||
@@ -435,7 +435,7 @@ public:
|
||||
/// Logical AND operator operator overload for Var.
|
||||
|
||||
bool isArray() const;
|
||||
/// Returns true if Var is not empty.
|
||||
/// Returns true if Var is an array.
|
||||
|
||||
bool isVector() const;
|
||||
/// Returns true if Var represents a vector.
|
||||
@@ -477,8 +477,14 @@ public:
|
||||
const std::type_info& type() const;
|
||||
/// Returns the type information of the stored content.
|
||||
|
||||
//@ deprecated
|
||||
void empty();
|
||||
/// Empties Var.
|
||||
/// This function is deprecated and will be removed.
|
||||
/// Please use clear().
|
||||
|
||||
void clear();
|
||||
/// Empties Var.
|
||||
|
||||
bool isEmpty() const;
|
||||
/// Returns true if empty.
|
||||
@@ -500,6 +506,15 @@ public:
|
||||
bool isString() const;
|
||||
/// Returns true if stored value is std::string.
|
||||
|
||||
bool isDate() const;
|
||||
/// Returns true if stored value represents a date.
|
||||
|
||||
bool isTime() const;
|
||||
/// Returns true if stored value represents time or date/time.
|
||||
|
||||
bool isDateTime() const;
|
||||
/// Returns true if stored value represents a date/time.
|
||||
|
||||
std::size_t size() const;
|
||||
/// Returns the size of this Var.
|
||||
/// This function returns 0 when Var is empty, 1 for POD or the size (i.e. length)
|
||||
@@ -842,6 +857,27 @@ inline bool Var::isString() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Var::isDate() const
|
||||
{
|
||||
VarHolder* pHolder = content();
|
||||
return pHolder ? pHolder->isDate() : false;
|
||||
}
|
||||
|
||||
|
||||
inline bool Var::isTime() const
|
||||
{
|
||||
VarHolder* pHolder = content();
|
||||
return pHolder ? pHolder->isTime() : false;
|
||||
}
|
||||
|
||||
|
||||
inline bool Var::isDateTime() const
|
||||
{
|
||||
VarHolder* pHolder = content();
|
||||
return pHolder ? pHolder->isDateTime() : false;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t Var::size() const
|
||||
{
|
||||
VarHolder* pHolder = content();
|
||||
@@ -890,28 +926,28 @@ inline char operator / (const char& other, const Var& da)
|
||||
|
||||
|
||||
inline char operator += (char& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to char
|
||||
/// Addition assignment operator for adding Var to char
|
||||
{
|
||||
return other += da.convert<char>();
|
||||
}
|
||||
|
||||
|
||||
inline char operator -= (char& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from char
|
||||
/// Subtraction assignment operator for subtracting Var from char
|
||||
{
|
||||
return other -= da.convert<char>();
|
||||
}
|
||||
|
||||
|
||||
inline char operator *= (char& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with char
|
||||
/// Multiplication assignment operator for multiplying Var with char
|
||||
{
|
||||
return other *= da.convert<char>();
|
||||
}
|
||||
|
||||
|
||||
inline char operator /= (char& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with char
|
||||
/// Division assignment operator for dividing Var with char
|
||||
{
|
||||
return other /= da.convert<char>();
|
||||
}
|
||||
@@ -994,28 +1030,28 @@ inline Poco::Int8 operator / (const Poco::Int8& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::Int8 operator += (Poco::Int8& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::Int8
|
||||
/// Addition assignment operator for adding Var to Poco::Int8
|
||||
{
|
||||
return other += da.convert<Poco::Int8>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int8 operator -= (Poco::Int8& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::Int8
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::Int8
|
||||
{
|
||||
return other -= da.convert<Poco::Int8>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int8 operator *= (Poco::Int8& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::Int8
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::Int8
|
||||
{
|
||||
return other *= da.convert<Poco::Int8>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int8 operator /= (Poco::Int8& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::Int8
|
||||
/// Division assignment operator for dividing Var with Poco::Int8
|
||||
{
|
||||
return other /= da.convert<Poco::Int8>();
|
||||
}
|
||||
@@ -1098,28 +1134,28 @@ inline Poco::UInt8 operator / (const Poco::UInt8& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::UInt8 operator += (Poco::UInt8& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::UInt8
|
||||
/// Addition assignment operator for adding Var to Poco::UInt8
|
||||
{
|
||||
return other += da.convert<Poco::UInt8>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt8 operator -= (Poco::UInt8& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::UInt8
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::UInt8
|
||||
{
|
||||
return other -= da.convert<Poco::UInt8>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt8 operator *= (Poco::UInt8& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::UInt8
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::UInt8
|
||||
{
|
||||
return other *= da.convert<Poco::UInt8>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt8 operator /= (Poco::UInt8& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::UInt8
|
||||
/// Division assignment operator for dividing Var with Poco::UInt8
|
||||
{
|
||||
return other /= da.convert<Poco::UInt8>();
|
||||
}
|
||||
@@ -1202,28 +1238,28 @@ inline Poco::Int16 operator / (const Poco::Int16& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::Int16 operator += (Poco::Int16& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::Int16
|
||||
/// Addition assignment operator for adding Var to Poco::Int16
|
||||
{
|
||||
return other += da.convert<Poco::Int16>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int16 operator -= (Poco::Int16& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::Int16
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::Int16
|
||||
{
|
||||
return other -= da.convert<Poco::Int16>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int16 operator *= (Poco::Int16& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::Int16
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::Int16
|
||||
{
|
||||
return other *= da.convert<Poco::Int16>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int16 operator /= (Poco::Int16& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::Int16
|
||||
/// Division assignment operator for dividing Var with Poco::Int16
|
||||
{
|
||||
return other /= da.convert<Poco::Int16>();
|
||||
}
|
||||
@@ -1306,28 +1342,28 @@ inline Poco::UInt16 operator / (const Poco::UInt16& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::UInt16 operator += (Poco::UInt16& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::UInt16
|
||||
/// Addition assignment operator for adding Var to Poco::UInt16
|
||||
{
|
||||
return other += da.convert<Poco::UInt16>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt16 operator -= (Poco::UInt16& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::UInt16
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::UInt16
|
||||
{
|
||||
return other -= da.convert<Poco::UInt16>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt16 operator *= (Poco::UInt16& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::UInt16
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::UInt16
|
||||
{
|
||||
return other *= da.convert<Poco::UInt16>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt16 operator /= (Poco::UInt16& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::UInt16
|
||||
/// Division assignment operator for dividing Var with Poco::UInt16
|
||||
{
|
||||
return other /= da.convert<Poco::UInt16>();
|
||||
}
|
||||
@@ -1410,28 +1446,28 @@ inline Poco::Int32 operator / (const Poco::Int32& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::Int32 operator += (Poco::Int32& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::Int32
|
||||
/// Addition assignment operator for adding Var to Poco::Int32
|
||||
{
|
||||
return other += da.convert<Poco::Int32>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int32 operator -= (Poco::Int32& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::Int32
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::Int32
|
||||
{
|
||||
return other -= da.convert<Poco::Int32>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int32 operator *= (Poco::Int32& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::Int32
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::Int32
|
||||
{
|
||||
return other *= da.convert<Poco::Int32>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int32 operator /= (Poco::Int32& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::Int32
|
||||
/// Division assignment operator for dividing Var with Poco::Int32
|
||||
{
|
||||
return other /= da.convert<Poco::Int32>();
|
||||
}
|
||||
@@ -1514,28 +1550,28 @@ inline Poco::UInt32 operator / (const Poco::UInt32& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::UInt32 operator += (Poco::UInt32& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::UInt32
|
||||
/// Addition assignment operator for adding Var to Poco::UInt32
|
||||
{
|
||||
return other += da.convert<Poco::UInt32>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt32 operator -= (Poco::UInt32& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::UInt32
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::UInt32
|
||||
{
|
||||
return other -= da.convert<Poco::UInt32>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt32 operator *= (Poco::UInt32& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::UInt32
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::UInt32
|
||||
{
|
||||
return other *= da.convert<Poco::UInt32>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt32 operator /= (Poco::UInt32& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::UInt32
|
||||
/// Division assignment operator for dividing Var with Poco::UInt32
|
||||
{
|
||||
return other /= da.convert<Poco::UInt32>();
|
||||
}
|
||||
@@ -1618,28 +1654,28 @@ inline Poco::Int64 operator / (const Poco::Int64& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::Int64 operator += (Poco::Int64& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::Int64
|
||||
/// Addition assignment operator for adding Var to Poco::Int64
|
||||
{
|
||||
return other += da.convert<Poco::Int64>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int64 operator -= (Poco::Int64& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::Int64
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::Int64
|
||||
{
|
||||
return other -= da.convert<Poco::Int64>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int64 operator *= (Poco::Int64& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::Int64
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::Int64
|
||||
{
|
||||
return other *= da.convert<Poco::Int64>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Int64 operator /= (Poco::Int64& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::Int64
|
||||
/// Division assignment operator for dividing Var with Poco::Int64
|
||||
{
|
||||
return other /= da.convert<Poco::Int64>();
|
||||
}
|
||||
@@ -1722,28 +1758,28 @@ inline Poco::UInt64 operator / (const Poco::UInt64& other, const Var& da)
|
||||
|
||||
|
||||
inline Poco::UInt64 operator += (Poco::UInt64& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to Poco::UInt64
|
||||
/// Addition assignment operator for adding Var to Poco::UInt64
|
||||
{
|
||||
return other += da.convert<Poco::UInt64>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt64 operator -= (Poco::UInt64& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from Poco::UInt64
|
||||
/// Subtraction assignment operator for subtracting Var from Poco::UInt64
|
||||
{
|
||||
return other -= da.convert<Poco::UInt64>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt64 operator *= (Poco::UInt64& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with Poco::UInt64
|
||||
/// Multiplication assignment operator for multiplying Var with Poco::UInt64
|
||||
{
|
||||
return other *= da.convert<Poco::UInt64>();
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt64 operator /= (Poco::UInt64& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with Poco::UInt64
|
||||
/// Division assignment operator for dividing Var with Poco::UInt64
|
||||
{
|
||||
return other /= da.convert<Poco::UInt64>();
|
||||
}
|
||||
@@ -1826,28 +1862,28 @@ inline float operator / (const float& other, const Var& da)
|
||||
|
||||
|
||||
inline float operator += (float& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to float
|
||||
/// Addition assignment operator for adding Var to float
|
||||
{
|
||||
return other += da.convert<float>();
|
||||
}
|
||||
|
||||
|
||||
inline float operator -= (float& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from float
|
||||
/// Subtraction assignment operator for subtracting Var from float
|
||||
{
|
||||
return other -= da.convert<float>();
|
||||
}
|
||||
|
||||
|
||||
inline float operator *= (float& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with float
|
||||
/// Multiplication assignment operator for multiplying Var with float
|
||||
{
|
||||
return other *= da.convert<float>();
|
||||
}
|
||||
|
||||
|
||||
inline float operator /= (float& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with float
|
||||
/// Division assignment operator for dividing Var with float
|
||||
{
|
||||
return other /= da.convert<float>();
|
||||
}
|
||||
@@ -1930,28 +1966,28 @@ inline double operator / (const double& other, const Var& da)
|
||||
|
||||
|
||||
inline double operator += (double& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to double
|
||||
/// Addition assignment operator for adding Var to double
|
||||
{
|
||||
return other += da.convert<double>();
|
||||
}
|
||||
|
||||
|
||||
inline double operator -= (double& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from double
|
||||
/// Subtraction assignment operator for subtracting Var from double
|
||||
{
|
||||
return other -= da.convert<double>();
|
||||
}
|
||||
|
||||
|
||||
inline double operator *= (double& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with double
|
||||
/// Multiplication assignment operator for multiplying Var with double
|
||||
{
|
||||
return other *= da.convert<double>();
|
||||
}
|
||||
|
||||
|
||||
inline double operator /= (double& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with double
|
||||
/// Division assignment operator for dividing Var with double
|
||||
{
|
||||
return other /= da.convert<double>();
|
||||
}
|
||||
@@ -2101,28 +2137,28 @@ inline long operator / (const long& other, const Var& da)
|
||||
|
||||
|
||||
inline long operator += (long& other, const Var& da)
|
||||
/// Addition asignment operator for adding Var to long
|
||||
/// Addition assignment operator for adding Var to long
|
||||
{
|
||||
return other += da.convert<long>();
|
||||
}
|
||||
|
||||
|
||||
inline long operator -= (long& other, const Var& da)
|
||||
/// Subtraction asignment operator for subtracting Var from long
|
||||
/// Subtraction assignment operator for subtracting Var from long
|
||||
{
|
||||
return other -= da.convert<long>();
|
||||
}
|
||||
|
||||
|
||||
inline long operator *= (long& other, const Var& da)
|
||||
/// Multiplication asignment operator for multiplying Var with long
|
||||
/// Multiplication assignment operator for multiplying Var with long
|
||||
{
|
||||
return other *= da.convert<long>();
|
||||
}
|
||||
|
||||
|
||||
inline long operator /= (long& other, const Var& da)
|
||||
/// Division asignment operator for dividing Var with long
|
||||
/// Division assignment operator for dividing Var with long
|
||||
{
|
||||
return other /= da.convert<long>();
|
||||
}
|
||||
|
||||
@@ -90,7 +90,6 @@ void containerToJSON(C& cont, std::string& val)
|
||||
}
|
||||
for (; it != itEnd; ++it)
|
||||
{
|
||||
|
||||
val.append(", ");
|
||||
appendJSONValue(val, *it);
|
||||
}
|
||||
@@ -137,47 +136,47 @@ public:
|
||||
|
||||
virtual void convert(Int8& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(Int16& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(Int32& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(Int64& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(UInt8& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(UInt16& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(UInt32& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(UInt64& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(DateTime& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(LocalDateTime& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(Timestamp& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
|
||||
@@ -191,66 +190,78 @@ public:
|
||||
|
||||
virtual void convert(bool& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(float& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(double& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(char& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(std::string& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual void convert(Poco::UTF16String& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
virtual bool isArray() const;
|
||||
/// Returns true.
|
||||
|
||||
virtual bool isVector() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isList() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isDeque() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isStruct() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isInteger() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isSigned() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isNumeric() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isBoolean() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isString() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to suport the diagnostic.
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isDate() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isTime() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual bool isDateTime() const;
|
||||
/// Returns false. Must be properly overriden in a type
|
||||
/// specialization in order to support the diagnostic.
|
||||
|
||||
virtual std::size_t size() const;
|
||||
/// Returns 1 iff Var is not empty or this function overriden.
|
||||
@@ -267,7 +278,7 @@ protected:
|
||||
/// pre-allocated buffer inside the holder).
|
||||
///
|
||||
/// Called from clone() member function of the implementation when
|
||||
/// smal object optimization is enabled.
|
||||
/// small object optimization is enabled.
|
||||
{
|
||||
#ifdef POCO_NO_SOO
|
||||
(void)pVarHolder;
|
||||
@@ -318,8 +329,8 @@ protected:
|
||||
template <typename F, typename T>
|
||||
void convertToSmallerUnsigned(const F& from, T& to) const
|
||||
/// This function is meant for converting unsigned integral data types,
|
||||
/// from larger to smaller type. Since lower limit is always 0 for unigned types,
|
||||
/// only the upper limit is checked, thus saving some cycles compared to the signed
|
||||
/// from larger to smaller type. Since lower limit is always 0 for unsigned types,
|
||||
/// only the upper limit is checked, thus saving some cycles compared to the signed
|
||||
/// version of the function. If the value to be converted is smaller than
|
||||
/// the maximum value for the target type, the conversion is performed.
|
||||
{
|
||||
@@ -335,8 +346,8 @@ protected:
|
||||
template <typename F, typename T>
|
||||
void convertSignedToUnsigned(const F& from, T& to) const
|
||||
/// This function is meant for converting signed integral data types to
|
||||
/// unsigned data types. Negative values can not be converted and if one is
|
||||
/// encountered, RangeException is thrown.
|
||||
/// unsigned data types. Negative values can not be converted and if one
|
||||
/// is encountered, RangeException is thrown.
|
||||
/// If upper limit is within the target data type limits, the conversion is performed.
|
||||
{
|
||||
poco_static_assert (std::numeric_limits<F>::is_specialized);
|
||||
@@ -353,9 +364,9 @@ protected:
|
||||
template <typename F, typename T>
|
||||
void convertSignedFloatToUnsigned(const F& from, T& to) const
|
||||
/// This function is meant for converting floating point data types to
|
||||
/// unsigned integral data types. Negative values can not be converted and if one is
|
||||
/// encountered, RangeException is thrown.
|
||||
/// If uper limit is within the target data type limits, the conversion is performed.
|
||||
/// unsigned integral data types. Negative values can not be converted and if one
|
||||
/// is encountered, RangeException is thrown.
|
||||
/// If upper limit is within the target data type limits, the conversion is performed.
|
||||
{
|
||||
poco_static_assert (std::numeric_limits<F>::is_specialized);
|
||||
poco_static_assert (std::numeric_limits<T>::is_specialized);
|
||||
@@ -372,16 +383,16 @@ protected:
|
||||
template <typename F, typename T>
|
||||
void convertUnsignedToSigned(const F& from, T& to) const
|
||||
/// This function is meant for converting unsigned integral data types to
|
||||
/// unsigned data types. Negative values can not be converted and if one is
|
||||
/// encountered, RangeException is thrown.
|
||||
/// If upper limit is within the target data type limits, the converiosn is performed.
|
||||
/// signed integral data types. Negative values can not be converted and if one
|
||||
/// is encountered, RangeException is thrown.
|
||||
/// If upper limit is within the target data type limits, the conversion is performed.
|
||||
{
|
||||
poco_static_assert (std::numeric_limits<F>::is_specialized);
|
||||
poco_static_assert (std::numeric_limits<T>::is_specialized);
|
||||
poco_static_assert (!std::numeric_limits<F>::is_signed);
|
||||
poco_static_assert (std::numeric_limits<T>::is_signed);
|
||||
|
||||
checkUpperLimit<F,T>(from);
|
||||
checkUpperLimit<F,T>(from);
|
||||
to = static_cast<T>(from);
|
||||
}
|
||||
|
||||
@@ -395,7 +406,7 @@ private:
|
||||
throw RangeException("Value too large.");
|
||||
}
|
||||
else
|
||||
if (static_cast<T>(from) > std::numeric_limits<T>::max())
|
||||
if (from > std::numeric_limits<T>::max())
|
||||
{
|
||||
throw RangeException("Value too large.");
|
||||
}
|
||||
@@ -607,6 +618,24 @@ inline bool VarHolder::isString() const
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline bool VarHolder::isDate() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline bool VarHolder::isTime() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline bool VarHolder::isDateTime() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline std::size_t VarHolder::size() const
|
||||
{
|
||||
return 1u;
|
||||
@@ -3329,6 +3358,21 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isDate() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isTime() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isDateTime() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
@@ -3430,6 +3474,21 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isDate() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isTime() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isDateTime() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
@@ -3531,6 +3590,21 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isDate() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isTime() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isDateTime() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
|
||||
@@ -137,11 +137,10 @@ inline bool VarIterator::operator != (const VarIterator& other) const
|
||||
|
||||
namespace std
|
||||
{
|
||||
using std::swap;
|
||||
template<>
|
||||
inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1,
|
||||
Poco::Dynamic::VarIterator& s2)
|
||||
/// Full template specalization of std:::swap for VarIterator
|
||||
/// Full template specialization of std:::swap for VarIterator
|
||||
{
|
||||
s1.swap(s2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user