mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-11 02:25:59 +01:00
trunk: File_UNIX, NumberParser/NumberFormatter from 1.4.3
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
#include <locale>
|
||||
#endif
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@@ -361,25 +360,25 @@ void NumberFormatter::appendHex(std::string& str, UInt64 value, int width)
|
||||
|
||||
void NumberFormatter::append(std::string& str, float value)
|
||||
{
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
#if !defined(POCO_NO_LOCALE)
|
||||
ostr.imbue(std::locale::classic());
|
||||
ostr.imbue(std::locale::classic());
|
||||
#endif
|
||||
ostr << std::setprecision(8) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
ostr << std::setprecision(8) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
}
|
||||
|
||||
|
||||
void NumberFormatter::append(std::string& str, double value)
|
||||
{
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
#if !defined(POCO_NO_LOCALE)
|
||||
ostr.imbue(std::locale::classic());
|
||||
ostr.imbue(std::locale::classic());
|
||||
#endif
|
||||
ostr << std::setprecision(16) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
ostr << std::setprecision(16) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
}
|
||||
|
||||
|
||||
@@ -387,13 +386,13 @@ void NumberFormatter::append(std::string& str, double value, int precision)
|
||||
{
|
||||
poco_assert (precision >= 0 && precision < 32);
|
||||
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
#if !defined(POCO_NO_LOCALE)
|
||||
ostr.imbue(std::locale::classic());
|
||||
ostr.imbue(std::locale::classic());
|
||||
#endif
|
||||
ostr << std::fixed << std::showpoint << std::setprecision(precision) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
ostr << std::fixed << std::showpoint << std::setprecision(precision) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
}
|
||||
|
||||
|
||||
@@ -401,13 +400,13 @@ void NumberFormatter::append(std::string& str, double value, int width, int prec
|
||||
{
|
||||
poco_assert (width > 0 && width < 64 && precision >= 0 && precision < width);
|
||||
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
char buffer[64];
|
||||
Poco::MemoryOutputStream ostr(buffer, sizeof(buffer));
|
||||
#if !defined(POCO_NO_LOCALE)
|
||||
ostr.imbue(std::locale::classic());
|
||||
ostr.imbue(std::locale::classic());
|
||||
#endif
|
||||
ostr << std::fixed << std::showpoint << std::setw(width) << std::setprecision(precision) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
ostr << std::fixed << std::showpoint << std::setw(width) << std::setprecision(precision) << value;
|
||||
str.append(buffer, static_cast<std::string::size_type>(ostr.charsWritten()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user