mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +02:00
Add support for (unsigned) long long when long is 64bit
This commit is contained in:
@@ -187,6 +187,16 @@ public:
|
||||
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;
|
||||
@@ -511,6 +521,19 @@ 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
|
||||
@@ -724,6 +747,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -866,6 +903,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1006,6 +1057,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1144,6 +1209,20 @@ public:
|
||||
convertSignedToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1297,6 +1376,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1435,6 +1528,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1573,6 +1680,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1711,6 +1832,20 @@ public:
|
||||
val = _val;
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -1870,6 +2005,20 @@ public:
|
||||
val = static_cast<UInt64>(_val ? 1 : 0);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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;
|
||||
@@ -2006,6 +2155,20 @@ public:
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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() &&
|
||||
@@ -2145,6 +2308,20 @@ public:
|
||||
convertSignedFloatToUnsigned(_val, val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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() &&
|
||||
@@ -2290,6 +2467,20 @@ public:
|
||||
val = static_cast<UInt8>(_val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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');
|
||||
@@ -2434,6 +2625,20 @@ public:
|
||||
val = NumberParser::parseUnsigned64(_val);
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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())
|
||||
@@ -2612,6 +2817,20 @@ public:
|
||||
val = NumberParser::parseUnsigned64(toStdString());
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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");
|
||||
@@ -3014,6 +3233,305 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#else // if defined (POCO_LONG_IS_64_BIT)
|
||||
|
||||
|
||||
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 // 64bit
|
||||
|
||||
|
||||
@@ -3264,6 +3782,20 @@ public:
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -3365,6 +3897,20 @@ public:
|
||||
val = _val.timestamp().epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
@@ -3466,6 +4012,20 @@ public:
|
||||
val = _val.epochMicroseconds();
|
||||
}
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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);
|
||||
|
@@ -150,7 +150,59 @@ public:
|
||||
/// If prefix is true, "0x" prefix is prepended to the
|
||||
/// resulting string.
|
||||
|
||||
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
|
||||
#ifdef POCO_HAVE_INT64
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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_LONG_IS_64_BIT
|
||||
|
||||
static std::string format(Int64 value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
@@ -200,7 +252,9 @@ public:
|
||||
/// the specified width. If prefix is true, "0x" prefix is
|
||||
/// prepended to the resulting string.
|
||||
|
||||
#endif // defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
|
||||
#endif // ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
static std::string format(float value);
|
||||
/// Formats a float value in decimal floating-point notation,
|
||||
@@ -325,7 +379,53 @@ public:
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
|
||||
#ifdef POCO_HAVE_INT64
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
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_LONG_IS_64_BIT
|
||||
|
||||
static void append(std::string& str, Int64 value);
|
||||
/// Formats a 64-bit integer value in decimal notation.
|
||||
@@ -369,7 +469,9 @@ public:
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
|
||||
#endif // defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
|
||||
#endif // ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
static void append(std::string& str, float value);
|
||||
/// Formats a float value in decimal floating-point notation,
|
||||
@@ -570,7 +672,92 @@ inline std::string NumberFormatter::formatHex(unsigned long value, int width, bo
|
||||
}
|
||||
|
||||
|
||||
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
|
||||
#ifdef POCO_HAVE_INT64
|
||||
|
||||
#ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
|
||||
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,7 +840,9 @@ inline std::string NumberFormatter::formatHex(UInt64 value, int width, bool pref
|
||||
}
|
||||
|
||||
|
||||
#endif // defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
|
||||
#endif // ifdef POCO_LONG_IS_64_BIT
|
||||
|
||||
#endif // ifdef POCO_HAVE_INT64
|
||||
|
||||
|
||||
inline std::string NumberFormatter::format(float value)
|
||||
|
Reference in New Issue
Block a user