aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/src/NumberFormatter.cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/NumberFormatter.cpp
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/NumberFormatter.cpp')
-rw-r--r--contrib/libs/poco/Foundation/src/NumberFormatter.cpp984
1 files changed, 492 insertions, 492 deletions
diff --git a/contrib/libs/poco/Foundation/src/NumberFormatter.cpp b/contrib/libs/poco/Foundation/src/NumberFormatter.cpp
index 5c8126e9b0..c0850857ec 100644
--- a/contrib/libs/poco/Foundation/src/NumberFormatter.cpp
+++ b/contrib/libs/poco/Foundation/src/NumberFormatter.cpp
@@ -1,492 +1,492 @@
-//
-// NumberFormatter.cpp
-//
-// Library: Foundation
-// Package: Core
-// Module: NumberFormatter
-//
-// Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/NumberFormatter.h"
-#include "Poco/MemoryStream.h"
-#include <iomanip>
-#if !defined(POCO_NO_LOCALE)
-#include <locale>
-#endif
-#include <cstdio>
-
-
-#if defined(_MSC_VER) || defined(__MINGW32__)
- #define I64_FMT "I64"
-#elif defined(__APPLE__)
- #define I64_FMT "q"
-#else
- #define I64_FMT "ll"
-#endif
-
-
-namespace Poco {
-
-
-std::string NumberFormatter::format(bool value, BoolFormat format)
-{
- switch(format)
- {
- default:
- case FMT_TRUE_FALSE:
- if (value == true)
- return "true";
- return "false";
- case FMT_YES_NO:
- if (value == true)
- return "yes";
- return "no";
- case FMT_ON_OFF:
- if (value == true)
- return "on";
- return "off";
- }
-}
-
-
-void NumberFormatter::append(std::string& str, int 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, int 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);
- str.append(result, sz);
-}
-
-
-void NumberFormatter::append0(std::string& str, int 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, int value)
-{
- char result[NF_MAX_INT_STRING_LEN];
- std::size_t sz = NF_MAX_INT_STRING_LEN;
- uIntToStr(static_cast<unsigned int>(value), 0x10, result, sz);
- str.append(result, sz);
-}
-
-
-void NumberFormatter::appendHex(std::string& str, int value, int width)
-{
- char result[NF_MAX_INT_STRING_LEN];
- std::size_t sz = NF_MAX_INT_STRING_LEN;
- uIntToStr(static_cast<unsigned int>(value), 0x10, result, sz, false, width, '0');
- str.append(result, sz);
-}
-
-
-void NumberFormatter::append(std::string& str, unsigned 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 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);
- str.append(result, sz);
-}
-
-
-void NumberFormatter::append0(std::string& str, unsigned int 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 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 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);
-}
-
-
-void NumberFormatter::append(std::string& str, 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 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);
- str.append(result, sz);
-}
-
-
-void NumberFormatter::append0(std::string& str, 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 value)
-{
- char result[NF_MAX_INT_STRING_LEN];
- std::size_t sz = NF_MAX_INT_STRING_LEN;
- uIntToStr(static_cast<unsigned long>(value), 0x10, result, sz);
- str.append(result, sz);
-}
-
-
-void NumberFormatter::appendHex(std::string& str, 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>(value), 0x10, result, sz, false, width, '0');
- str.append(result, sz);
-}
-
-
-void NumberFormatter::append(std::string& str, unsigned 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 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 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 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 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);
-}
-
-
-#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)
-{
- 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, Int64 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, Int64 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, Int64 value)
-{
- char result[NF_MAX_INT_STRING_LEN];
- std::size_t sz = NF_MAX_INT_STRING_LEN;
- uIntToStr(static_cast<UInt64>(value), 0x10, result, sz);
- str.append(result, sz);
-}
-
-
-void NumberFormatter::appendHex(std::string& str, Int64 value, int width)
-{
- char result[NF_MAX_INT_STRING_LEN];
- std::size_t sz = NF_MAX_INT_STRING_LEN;
- uIntToStr(static_cast<UInt64>(value), 0x10, result, sz, false, width, '0');
- str.append(result, sz);
-}
-
-
-void NumberFormatter::append(std::string& str, UInt64 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, UInt64 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, UInt64 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, UInt64 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, UInt64 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);
-}
-
-
-#endif // ifdef POCO_LONG_IS_64_BIT
-
-#endif // ifdef POCO_HAVE_INT64
-
-
-void NumberFormatter::append(std::string& str, float value)
-{
- char buffer[NF_MAX_FLT_STRING_LEN];
- floatToStr(buffer, POCO_MAX_FLT_STRING_LEN, value);
- str.append(buffer);
-}
-
-
-void NumberFormatter::append(std::string& str, float value, int precision)
-{
- char buffer[NF_MAX_FLT_STRING_LEN];
- floatToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision);
- str.append(buffer);
-}
-
-
-void NumberFormatter::append(std::string& str, float value, int width, int precision)
-{
- std::string result;
- str.append(floatToFixedStr(result, value, precision, width));
-}
-
-
-void NumberFormatter::append(std::string& str, double value)
-{
- char buffer[NF_MAX_FLT_STRING_LEN];
- doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, value);
- str.append(buffer);
-}
-
-
-void NumberFormatter::append(std::string& str, double value, int precision)
-{
- char buffer[NF_MAX_FLT_STRING_LEN];
- doubleToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision);
- str.append(buffer);
-}
-
-
-void NumberFormatter::append(std::string& str, double value, int width, int precision)
-{
- std::string result;
- str.append(doubleToFixedStr(result, value, precision, width));
-}
-
-
-void NumberFormatter::append(std::string& str, const void* ptr)
-{
- char buffer[24];
-#if defined(POCO_PTR_IS_64_BIT)
- #if defined(POCO_LONG_IS_64_BIT)
- std::sprintf(buffer, "%016lX", (UIntPtr) ptr);
- #else
- std::sprintf(buffer, "%016" I64_FMT "X", (UIntPtr) ptr);
- #endif
-#else
- std::sprintf(buffer, "%08lX", (UIntPtr) ptr);
-#endif
- str.append(buffer);
-}
-
-
-} // namespace Poco
+//
+// NumberFormatter.cpp
+//
+// Library: Foundation
+// Package: Core
+// Module: NumberFormatter
+//
+// Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/NumberFormatter.h"
+#include "Poco/MemoryStream.h"
+#include <iomanip>
+#if !defined(POCO_NO_LOCALE)
+#include <locale>
+#endif
+#include <cstdio>
+
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ #define I64_FMT "I64"
+#elif defined(__APPLE__)
+ #define I64_FMT "q"
+#else
+ #define I64_FMT "ll"
+#endif
+
+
+namespace Poco {
+
+
+std::string NumberFormatter::format(bool value, BoolFormat format)
+{
+ switch(format)
+ {
+ default:
+ case FMT_TRUE_FALSE:
+ if (value == true)
+ return "true";
+ return "false";
+ case FMT_YES_NO:
+ if (value == true)
+ return "yes";
+ return "no";
+ case FMT_ON_OFF:
+ if (value == true)
+ return "on";
+ return "off";
+ }
+}
+
+
+void NumberFormatter::append(std::string& str, int 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, int 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);
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::append0(std::string& str, int 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, int value)
+{
+ char result[NF_MAX_INT_STRING_LEN];
+ std::size_t sz = NF_MAX_INT_STRING_LEN;
+ uIntToStr(static_cast<unsigned int>(value), 0x10, result, sz);
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::appendHex(std::string& str, int value, int width)
+{
+ char result[NF_MAX_INT_STRING_LEN];
+ std::size_t sz = NF_MAX_INT_STRING_LEN;
+ uIntToStr(static_cast<unsigned int>(value), 0x10, result, sz, false, width, '0');
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::append(std::string& str, unsigned 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 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);
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::append0(std::string& str, unsigned int 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 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 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);
+}
+
+
+void NumberFormatter::append(std::string& str, 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 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);
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::append0(std::string& str, 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 value)
+{
+ char result[NF_MAX_INT_STRING_LEN];
+ std::size_t sz = NF_MAX_INT_STRING_LEN;
+ uIntToStr(static_cast<unsigned long>(value), 0x10, result, sz);
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::appendHex(std::string& str, 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>(value), 0x10, result, sz, false, width, '0');
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::append(std::string& str, unsigned 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 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 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 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 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);
+}
+
+
+#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)
+{
+ 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, Int64 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, Int64 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, Int64 value)
+{
+ char result[NF_MAX_INT_STRING_LEN];
+ std::size_t sz = NF_MAX_INT_STRING_LEN;
+ uIntToStr(static_cast<UInt64>(value), 0x10, result, sz);
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::appendHex(std::string& str, Int64 value, int width)
+{
+ char result[NF_MAX_INT_STRING_LEN];
+ std::size_t sz = NF_MAX_INT_STRING_LEN;
+ uIntToStr(static_cast<UInt64>(value), 0x10, result, sz, false, width, '0');
+ str.append(result, sz);
+}
+
+
+void NumberFormatter::append(std::string& str, UInt64 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, UInt64 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, UInt64 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, UInt64 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, UInt64 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);
+}
+
+
+#endif // ifdef POCO_LONG_IS_64_BIT
+
+#endif // ifdef POCO_HAVE_INT64
+
+
+void NumberFormatter::append(std::string& str, float value)
+{
+ char buffer[NF_MAX_FLT_STRING_LEN];
+ floatToStr(buffer, POCO_MAX_FLT_STRING_LEN, value);
+ str.append(buffer);
+}
+
+
+void NumberFormatter::append(std::string& str, float value, int precision)
+{
+ char buffer[NF_MAX_FLT_STRING_LEN];
+ floatToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision);
+ str.append(buffer);
+}
+
+
+void NumberFormatter::append(std::string& str, float value, int width, int precision)
+{
+ std::string result;
+ str.append(floatToFixedStr(result, value, precision, width));
+}
+
+
+void NumberFormatter::append(std::string& str, double value)
+{
+ char buffer[NF_MAX_FLT_STRING_LEN];
+ doubleToStr(buffer, POCO_MAX_FLT_STRING_LEN, value);
+ str.append(buffer);
+}
+
+
+void NumberFormatter::append(std::string& str, double value, int precision)
+{
+ char buffer[NF_MAX_FLT_STRING_LEN];
+ doubleToFixedStr(buffer, POCO_MAX_FLT_STRING_LEN, value, precision);
+ str.append(buffer);
+}
+
+
+void NumberFormatter::append(std::string& str, double value, int width, int precision)
+{
+ std::string result;
+ str.append(doubleToFixedStr(result, value, precision, width));
+}
+
+
+void NumberFormatter::append(std::string& str, const void* ptr)
+{
+ char buffer[24];
+#if defined(POCO_PTR_IS_64_BIT)
+ #if defined(POCO_LONG_IS_64_BIT)
+ std::sprintf(buffer, "%016lX", (UIntPtr) ptr);
+ #else
+ std::sprintf(buffer, "%016" I64_FMT "X", (UIntPtr) ptr);
+ #endif
+#else
+ std::sprintf(buffer, "%08lX", (UIntPtr) ptr);
+#endif
+ str.append(buffer);
+}
+
+
+} // namespace Poco