Add support for (unsigned) long long when long is 64bit

This commit is contained in:
Conor Burgess
2017-09-11 15:29:08 +01:00
parent 13a141332b
commit fe693de41d
6 changed files with 1211 additions and 22 deletions

View File

@@ -234,7 +234,102 @@ void NumberFormatter::appendHex(std::string& str, unsigned long value, int width
}
#if defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
#ifdef POCO_HAVE_INT64
#ifdef POCO_LONG_IS_64_BIT
void NumberFormatter::append(std::string& str, long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
intToStr(value, 10, result, sz);
str.append(result, sz);
}
void NumberFormatter::append(std::string& str, long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
intToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::append0(std::string& str, long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
intToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, sz);
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(static_cast<unsigned long long>(value), 0x10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::append(std::string& str, unsigned long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 10, result, sz);
str.append(result, sz);
}
void NumberFormatter::append(std::string& str, unsigned long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::append0(std::string& str, unsigned long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 10, result, sz, false, width, '0');
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, unsigned long long value)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 0x10, result, sz);
str.append(result, sz);
}
void NumberFormatter::appendHex(std::string& str, unsigned long long value, int width)
{
char result[NF_MAX_INT_STRING_LEN];
std::size_t sz = NF_MAX_INT_STRING_LEN;
uIntToStr(value, 0x10, result, sz, false, width, '0');
str.append(result, sz);
}
#else // ifndef POCO_LONG_IS_64_BIT
void NumberFormatter::append(std::string& str, Int64 value)
@@ -327,7 +422,9 @@ void NumberFormatter::appendHex(std::string& str, UInt64 value, int width)
}
#endif // defined(POCO_HAVE_INT64) && !defined(POCO_LONG_IS_64_BIT)
#endif // ifdef POCO_LONG_IS_64_BIT
#endif // ifdef POCO_HAVE_INT64
void NumberFormatter::append(std::string& str, float value)