mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
added method & tests to the class NumberFormatter for bool values
This commit is contained in:
@@ -18,14 +18,14 @@
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
@@ -60,6 +60,13 @@ class Foundation_API NumberFormatter
|
||||
/// formatting.
|
||||
{
|
||||
public:
|
||||
enum BoolFormat
|
||||
{
|
||||
FMT_TRUE_FALSE,
|
||||
FMT_YES_NO,
|
||||
FMT_ON_OFF
|
||||
};
|
||||
|
||||
static std::string format(int value);
|
||||
/// Formats an integer value in decimal notation.
|
||||
|
||||
@@ -69,7 +76,7 @@ public:
|
||||
/// the specified width.
|
||||
|
||||
static std::string format0(int value, int width);
|
||||
/// Formats an integer value in decimal notation,
|
||||
/// Formats an integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field
|
||||
/// having at least the specified width.
|
||||
|
||||
@@ -92,8 +99,8 @@ public:
|
||||
/// specified width.
|
||||
|
||||
static std::string format0(unsigned int value, int width);
|
||||
/// Formats an unsigned int value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at
|
||||
/// Formats an unsigned int value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at
|
||||
/// least the specified width.
|
||||
|
||||
static std::string formatHex(unsigned value);
|
||||
@@ -109,11 +116,11 @@ public:
|
||||
|
||||
static std::string format(long value, int width);
|
||||
/// Formats a long value in decimal notation,
|
||||
/// right justified in a field having at least the
|
||||
/// right justified in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
static std::string format0(long value, int width);
|
||||
/// Formats a long value in decimal notation,
|
||||
/// Formats a long value in decimal notation,
|
||||
/// right justified and zero-padded in a field
|
||||
/// having at least the specified width.
|
||||
|
||||
@@ -123,7 +130,7 @@ public:
|
||||
|
||||
static std::string formatHex(long value, int width);
|
||||
/// Formats an unsigned long value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
@@ -132,11 +139,11 @@ public:
|
||||
|
||||
static std::string format(unsigned long value, int width);
|
||||
/// Formats an unsigned long value in decimal notation,
|
||||
/// right justified in a field having at least the specified
|
||||
/// right justified in a field having at least the specified
|
||||
/// width.
|
||||
|
||||
static std::string format0(unsigned long value, int width);
|
||||
/// Formats an unsigned long value in decimal notation,
|
||||
/// Formats an unsigned long value in decimal notation,
|
||||
/// right justified and zero-padded
|
||||
/// in a field having at least the specified width.
|
||||
|
||||
@@ -145,7 +152,7 @@ public:
|
||||
|
||||
static std::string formatHex(unsigned long value, int width);
|
||||
/// Formats an unsigned long value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// 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)
|
||||
@@ -158,8 +165,8 @@ public:
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static std::string format0(Int64 value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// 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(Int64 value);
|
||||
@@ -168,7 +175,7 @@ public:
|
||||
|
||||
static std::string formatHex(Int64 value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
@@ -180,8 +187,8 @@ public:
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static std::string format0(UInt64 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
|
||||
/// 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(UInt64 value);
|
||||
@@ -189,7 +196,7 @@ public:
|
||||
|
||||
static std::string formatHex(UInt64 value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// 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)
|
||||
@@ -216,6 +223,10 @@ public:
|
||||
/// sixteen (64-bit architectures) characters wide
|
||||
/// field in hexadecimal notation.
|
||||
|
||||
static std::string format(bool value, BoolFormat format = FMT_TRUE_FALSE);
|
||||
/// Formats a bool value in decimal/text notation,
|
||||
/// according to format parameter.
|
||||
|
||||
static void append(std::string& str, int value);
|
||||
/// Formats an integer value in decimal notation.
|
||||
|
||||
@@ -225,7 +236,7 @@ public:
|
||||
/// the specified width.
|
||||
|
||||
static void append0(std::string& str, int value, int width);
|
||||
/// Formats an integer value in decimal notation,
|
||||
/// Formats an integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field
|
||||
/// having at least the specified width.
|
||||
|
||||
@@ -248,8 +259,8 @@ public:
|
||||
/// specified width.
|
||||
|
||||
static void append0(std::string& str, unsigned int value, int width);
|
||||
/// Formats an unsigned int value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at
|
||||
/// Formats an unsigned int 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 value);
|
||||
@@ -265,11 +276,11 @@ public:
|
||||
|
||||
static void append(std::string& str, long value, int width);
|
||||
/// Formats a long value in decimal notation,
|
||||
/// right justified in a field having at least the
|
||||
/// right justified in a field having at least the
|
||||
/// specified width.
|
||||
|
||||
static void append0(std::string& str, long value, int width);
|
||||
/// Formats a long value in decimal notation,
|
||||
/// Formats a long value in decimal notation,
|
||||
/// right justified and zero-padded in a field
|
||||
/// having at least the specified width.
|
||||
|
||||
@@ -279,7 +290,7 @@ public:
|
||||
|
||||
static void appendHex(std::string& str, long value, int width);
|
||||
/// Formats an unsigned long value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// specified width.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
@@ -288,11 +299,11 @@ public:
|
||||
|
||||
static void append(std::string& str, unsigned long value, int width);
|
||||
/// Formats an unsigned long value in decimal notation,
|
||||
/// right justified in a field having at least the specified
|
||||
/// right justified in a field having at least the specified
|
||||
/// width.
|
||||
|
||||
static void append0(std::string& str, unsigned long value, int width);
|
||||
/// Formats an unsigned long value in decimal notation,
|
||||
/// Formats an unsigned long value in decimal notation,
|
||||
/// right justified and zero-padded
|
||||
/// in a field having at least the specified width.
|
||||
|
||||
@@ -301,7 +312,7 @@ public:
|
||||
|
||||
static void appendHex(std::string& str, unsigned long value, int width);
|
||||
/// Formats an unsigned long value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least the
|
||||
/// 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)
|
||||
@@ -314,8 +325,8 @@ public:
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static void append0(std::string& str, Int64 value, int width);
|
||||
/// Formats a 64-bit integer value in decimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// 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, Int64 value);
|
||||
@@ -324,7 +335,7 @@ public:
|
||||
|
||||
static void appendHex(std::string& str, Int64 value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// the specified width.
|
||||
/// The value is treated as unsigned.
|
||||
|
||||
@@ -336,8 +347,8 @@ public:
|
||||
/// right justified in a field having at least the specified width.
|
||||
|
||||
static void append0(std::string& str, UInt64 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
|
||||
/// 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, UInt64 value);
|
||||
@@ -345,7 +356,7 @@ public:
|
||||
|
||||
static void appendHex(std::string& str, UInt64 value, int width);
|
||||
/// Formats a 64-bit integer value in hexadecimal notation,
|
||||
/// right justified and zero-padded in a field having at least
|
||||
/// 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)
|
||||
|
||||
Reference in New Issue
Block a user