mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
fixed type overloads
This commit is contained in:
@@ -76,8 +76,8 @@ public:
|
||||
BinaryReader& operator >> (double& value);
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
BinaryReader& operator >> (Int64& value);
|
||||
BinaryReader& operator >> (UInt64& value);
|
||||
BinaryReader& operator >> (long long& value);
|
||||
BinaryReader& operator >> (unsigned long long& value);
|
||||
#endif
|
||||
|
||||
BinaryReader& operator >> (std::string& value);
|
||||
|
||||
@@ -81,8 +81,8 @@ public:
|
||||
BinaryWriter& operator << (double value);
|
||||
|
||||
#if defined(POCO_HAVE_INT64)
|
||||
BinaryWriter& operator << (Int64 value);
|
||||
BinaryWriter& operator << (UInt64 value);
|
||||
BinaryWriter& operator << (long long value);
|
||||
BinaryWriter& operator << (unsigned long long value);
|
||||
#endif
|
||||
|
||||
BinaryWriter& operator << (const std::string& value);
|
||||
|
||||
@@ -2123,6 +2123,9 @@ inline bool operator != (const char* other, const Var& da)
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
inline long operator + (const long& other, const Var& da)
|
||||
/// Addition operator for adding Var to long
|
||||
{
|
||||
@@ -2331,6 +2334,9 @@ inline bool operator >= (const unsigned long& other, const Var& da)
|
||||
}
|
||||
|
||||
|
||||
#endif // POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
} // namespace Dynamic
|
||||
|
||||
|
||||
|
||||
@@ -178,12 +178,26 @@ public:
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to support the conversion.
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long& val) const;
|
||||
/// Calls convert(Int32).
|
||||
|
||||
void convert(unsigned long& val) const;
|
||||
/// Calls convert(UInt32).
|
||||
|
||||
#else
|
||||
|
||||
virtual void convert(long long& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
|
||||
virtual void convert(unsigned long long & val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to suport the conversion.
|
||||
|
||||
#endif
|
||||
|
||||
virtual void convert(bool& val) const;
|
||||
/// Throws BadCastException. Must be overriden in a type
|
||||
/// specialization in order to support the conversion.
|
||||
@@ -505,6 +519,7 @@ inline void VarHolder::convert(Timestamp& /*val*/) const
|
||||
throw BadCastException("Can not convert to Timestamp");
|
||||
}
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
inline void VarHolder::convert(long& val) const
|
||||
{
|
||||
@@ -521,6 +536,20 @@ inline void VarHolder::convert(unsigned long& val) const
|
||||
val = tmp;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline void VarHolder::convert(long long& /*val*/) const
|
||||
{
|
||||
throw BadCastException("Can not convert to long long");
|
||||
}
|
||||
|
||||
|
||||
inline void VarHolder::convert(unsigned long long& /*val*/) const
|
||||
{
|
||||
throw BadCastException("Can not convert to unsigned long long");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline void VarHolder::convert(bool& /*val*/) const
|
||||
{
|
||||
@@ -759,6 +788,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -901,6 +944,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1041,6 +1098,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1179,6 +1250,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1332,6 +1417,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1470,6 +1569,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1608,6 +1721,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1746,6 +1873,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
@@ -1905,6 +2046,20 @@ public:
|
||||
val = static_cast<UInt64>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = static_cast<unsigned long long>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = _val;
|
||||
@@ -2041,6 +2196,20 @@ public:
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = !(_val <= std::numeric_limits<float>::min() &&
|
||||
@@ -2180,6 +2349,20 @@ public:
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = !(_val <= std::numeric_limits<double>::min() &&
|
||||
@@ -2325,6 +2508,20 @@ public:
|
||||
val = static_cast<UInt8>(_val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = static_cast<long long>(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = static_cast<unsigned long long>(_val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != '\0');
|
||||
@@ -2469,6 +2666,20 @@ public:
|
||||
val = NumberParser::parseUnsigned64(_val);
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = NumberParser::parse64(_val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = NumberParser::parseUnsigned64(_val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
if (_val.empty())
|
||||
@@ -2647,6 +2858,20 @@ public:
|
||||
val = NumberParser::parseUnsigned64(toStdString());
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = NumberParser::parse64(toStdString());
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = NumberParser::parseUnsigned64(toStdString());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
static const std::string VAL_FALSE("false");
|
||||
@@ -2770,6 +2995,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#ifndef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<long>: public VarHolder
|
||||
{
|
||||
@@ -3046,6 +3274,308 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#else // if defined (POCO_INT64_IS_LONG)
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<long long>: public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(long long val): _val(val)
|
||||
{
|
||||
}
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(long long);
|
||||
}
|
||||
|
||||
void convert(Int8& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int16& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int32& val) const
|
||||
{
|
||||
convertToSmaller(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int64& val) const
|
||||
{
|
||||
val = static_cast<Int64>(_val);
|
||||
}
|
||||
|
||||
void convert(UInt8& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt16& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt32& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt64& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
}
|
||||
|
||||
void convert(float& val) const
|
||||
{
|
||||
val = static_cast<float>(_val);
|
||||
}
|
||||
|
||||
void convert(double& val) const
|
||||
{
|
||||
val = static_cast<double>(_val);
|
||||
}
|
||||
|
||||
void convert(char& val) const
|
||||
{
|
||||
UInt8 tmp;
|
||||
convert(tmp);
|
||||
val = static_cast<char>(tmp);
|
||||
}
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = NumberFormatter::format(_val);
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
|
||||
const long long& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
|
||||
bool isArray() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isStruct() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isInteger() const
|
||||
{
|
||||
return std::numeric_limits<long long>::is_integer;
|
||||
}
|
||||
|
||||
bool isSigned() const
|
||||
{
|
||||
return std::numeric_limits<long long>::is_signed;
|
||||
}
|
||||
|
||||
bool isNumeric() const
|
||||
{
|
||||
return std::numeric_limits<long long>::is_specialized;
|
||||
}
|
||||
|
||||
bool isBoolean() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isString() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
VarHolderImpl& operator = (const VarHolderImpl&);
|
||||
|
||||
long long _val;
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
class VarHolderImpl<unsigned long long>: public VarHolder
|
||||
{
|
||||
public:
|
||||
VarHolderImpl(unsigned long long val): _val(val)
|
||||
{
|
||||
}
|
||||
|
||||
~VarHolderImpl()
|
||||
{
|
||||
}
|
||||
|
||||
const std::type_info& type() const
|
||||
{
|
||||
return typeid(unsigned long long);
|
||||
}
|
||||
|
||||
void convert(Int8& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int16& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int32& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(Int64& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt8& val) const
|
||||
{
|
||||
convertToSmallerUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt16& val) const
|
||||
{
|
||||
convertToSmallerUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt32& val) const
|
||||
{
|
||||
convertToSmallerUnsigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(UInt64& val) const
|
||||
{
|
||||
val = static_cast<UInt64>(_val);
|
||||
}
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
convertUnsignedToSigned(_val, val);
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val;
|
||||
}
|
||||
|
||||
void convert(bool& val) const
|
||||
{
|
||||
val = (_val != 0);
|
||||
}
|
||||
|
||||
void convert(float& val) const
|
||||
{
|
||||
val = static_cast<float>(_val);
|
||||
}
|
||||
|
||||
void convert(double& val) const
|
||||
{
|
||||
val = static_cast<double>(_val);
|
||||
}
|
||||
|
||||
void convert(char& val) const
|
||||
{
|
||||
UInt8 tmp;
|
||||
convert(tmp);
|
||||
val = static_cast<char>(tmp);
|
||||
}
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = NumberFormatter::format(_val);
|
||||
}
|
||||
|
||||
VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const
|
||||
{
|
||||
return cloneHolder(pVarHolder, _val);
|
||||
}
|
||||
|
||||
const unsigned long long& value() const
|
||||
{
|
||||
return _val;
|
||||
}
|
||||
|
||||
bool isArray() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isStruct() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isInteger() const
|
||||
{
|
||||
return std::numeric_limits<unsigned long long>::is_integer;
|
||||
}
|
||||
|
||||
bool isSigned() const
|
||||
{
|
||||
return std::numeric_limits<unsigned long long>::is_signed;
|
||||
}
|
||||
|
||||
bool isNumeric() const
|
||||
{
|
||||
return std::numeric_limits<unsigned long long>::is_specialized;
|
||||
}
|
||||
|
||||
bool isBoolean() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isString() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
VarHolderImpl();
|
||||
VarHolderImpl(const VarHolderImpl&);
|
||||
VarHolderImpl& operator = (const VarHolderImpl&);
|
||||
|
||||
unsigned long long _val;
|
||||
};
|
||||
|
||||
|
||||
#endif // POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
template <typename T>
|
||||
class VarHolderImpl<std::vector<T>>: public VarHolder
|
||||
{
|
||||
@@ -3293,6 +3823,20 @@ public:
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
|
||||
@@ -3409,6 +3953,20 @@ public:
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
|
||||
@@ -3525,6 +4083,20 @@ public:
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
void convert(long long& val) const
|
||||
{
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
void convert(unsigned long long& val) const
|
||||
{
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void convert(std::string& val) const
|
||||
{
|
||||
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
|
||||
|
||||
@@ -51,12 +51,18 @@ public:
|
||||
VarIterator(const VarIterator& other);
|
||||
/// Creates a copy of other VarIterator.
|
||||
|
||||
VarIterator(VarIterator&& other) noexcept;
|
||||
/// Moves another VarIterator.
|
||||
|
||||
~VarIterator();
|
||||
/// Destroys the VarIterator.
|
||||
|
||||
VarIterator& operator = (const VarIterator& other);
|
||||
/// Assigns the other VarIterator.
|
||||
|
||||
VarIterator& operator = (VarIterator&& other) noexcept;
|
||||
/// Assigns the other VarIterator.
|
||||
|
||||
bool operator == (const VarIterator& other) const;
|
||||
/// Equality operator.
|
||||
|
||||
@@ -138,8 +144,7 @@ inline bool VarIterator::operator != (const VarIterator& other) const
|
||||
namespace std
|
||||
{
|
||||
template<>
|
||||
inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1,
|
||||
Poco::Dynamic::VarIterator& s2)
|
||||
inline void swap<Poco::Dynamic::VarIterator>(Poco::Dynamic::VarIterator& s1, Poco::Dynamic::VarIterator& s2) noexcept
|
||||
/// Full template specialization of std:::swap for VarIterator
|
||||
{
|
||||
s1.swap(s2);
|
||||
|
||||
@@ -151,6 +151,57 @@ public:
|
||||
/// resulting string.
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
static std::string format(long long value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
|
||||
static std::string format(long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static std::string format0(long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
static std::string formatHex(long long value, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
static std::string formatHex(long long value, int width, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
/// The value is treated as unsigned.
|
||||
/// If prefix is true, "0x" prefix is prepended to the resulting string.
|
||||
|
||||
static std::string format(unsigned long long value);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation.
|
||||
|
||||
static std::string format(unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static std::string format0(unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
static std::string formatHex(unsigned long long value, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
|
||||
static std::string formatHex(unsigned long long value, int width, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width. If prefix is true, "0x" prefix is
|
||||
/// prepended to the resulting string.
|
||||
|
||||
#else // ifndef POCO_INT64_IS_LONG
|
||||
|
||||
static std::string format(Int64 value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
@@ -166,7 +217,7 @@ public:
|
||||
|
||||
static std::string formatHex(Int64 value, bool prefix = false);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
@@ -200,6 +251,7 @@ public:
|
||||
/// the specified width. If prefix is true, "0x" prefix is
|
||||
/// prepended to the resulting string.
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
static std::string format(float value);
|
||||
@@ -326,6 +378,51 @@ public:
|
||||
/// specified width.
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
static void append(std::string& str, long long value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
|
||||
static void append(std::string& str, long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static void append0(std::string& str, long long value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
static void appendHex(std::string& str, long long value);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
static void appendHex(std::string& str, long long value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
static void append(std::string& str, unsigned long long value);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation.
|
||||
|
||||
static void append(std::string& str, unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static void append0(std::string& str, unsigned long long value, int width);
|
||||
/// Formats an unsigned 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
static void appendHex(std::string& str, unsigned long long value);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation.
|
||||
|
||||
static void appendHex(std::string& str, unsigned long long value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
#else // ifndef POCO_INT64_IS_LONG
|
||||
|
||||
static void append(std::string& str, Int64 value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
@@ -369,6 +466,7 @@ public:
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
static void append(std::string& str, float value);
|
||||
@@ -571,6 +669,90 @@ inline std::string NumberFormatter::formatHex(unsigned long value, int width, bo
|
||||
|
||||
|
||||
#ifdef POCO_HAVE_INT64
|
||||
#ifdef POCO_INT64_IS_LONG
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(long long value)
|
||||
{
|
||||
std::string result;
|
||||
intToStr(value, 10, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
intToStr(value, 10, result, false, width, ' ');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format0(long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
intToStr(value, 10, result, false, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(long long value, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, prefix);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(long long value, int width, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, prefix, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(unsigned long long value)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 10, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(unsigned long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 10, result, false, width, ' ');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format0(unsigned long long value, int width)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 10, result, false, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(unsigned long long value, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 0x10, result, prefix);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
inline std::string NumberFormatter::formatHex(unsigned long long value, int width, bool prefix)
|
||||
{
|
||||
std::string result;
|
||||
uIntToStr(value, 0x10, result, prefix, width, '0');
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#else // ifndef POCO_LONG_IS_64_BIT
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(Int64 value)
|
||||
@@ -653,6 +835,7 @@ inline std::string NumberFormatter::formatHex(UInt64 value, int width, bool pref
|
||||
}
|
||||
|
||||
|
||||
#endif // ifdef POCO_INT64_IS_LONG
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
namespace Poco {
|
||||
|
||||
|
||||
using Int8 = std::int8_t;
|
||||
using UInt8 = std::uint8_t;
|
||||
using Int16 = std::int16_t;
|
||||
using UInt16 = std::uint16_t;
|
||||
using Int32 = std::int32_t;
|
||||
using UInt32 = std::uint32_t;
|
||||
using Int64 = std::int64_t;
|
||||
using UInt64 = std::uint64_t;
|
||||
using IntPtr = std::intptr_t;
|
||||
using Int8 = std::int8_t;
|
||||
using UInt8 = std::uint8_t;
|
||||
using Int16 = std::int16_t;
|
||||
using UInt16 = std::uint16_t;
|
||||
using Int32 = std::int32_t;
|
||||
using UInt32 = std::uint32_t;
|
||||
using Int64 = std::int64_t;
|
||||
using UInt64 = std::uint64_t;
|
||||
using IntPtr = std::intptr_t;
|
||||
using UIntPtr = std::uintptr_t;
|
||||
|
||||
|
||||
@@ -49,19 +49,12 @@ using UIntPtr = std::uintptr_t;
|
||||
#if defined(__LP64__)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
#define POCO_LONG_IS_64_BIT 1
|
||||
#if POCO_OS == POCO_OS_LINUX
|
||||
#define POCO_INT64_IS_LONG 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#define POCO_HAVE_INT64 1
|
||||
#elif defined(__DECCXX)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
#define POCO_LONG_IS_64_BIT 1
|
||||
#define POCO_HAVE_INT64 1
|
||||
#elif defined(__HP_aCC)
|
||||
#if defined(__LP64__)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
#define POCO_LONG_IS_64_BIT 1
|
||||
#endif
|
||||
#define POCO_HAVE_INT64 1
|
||||
#elif defined(__SUNPRO_CC)
|
||||
#if defined(__sparcv9)
|
||||
#define POCO_PTR_IS_64_BIT 1
|
||||
|
||||
Reference in New Issue
Block a user