trunk: File_UNIX, NumberParser/NumberFormatter from 1.4.3

This commit is contained in:
Marian Krivos
2012-02-05 07:53:05 +00:00
parent 1d101207f9
commit 59fe68edbe
4 changed files with 51 additions and 35 deletions

View File

@@ -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()));
}