added support for UTF-8

now the UTF-8 is a default charset


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-11-21 00:19:17 +00:00
parent f1f0fa34cb
commit 8e72a820dd
153 changed files with 4270 additions and 2784 deletions

View File

@@ -10,6 +10,7 @@
#include "log.h"
#include <ctime>
#include <string.h>
#include "ezc.h"
Log::Log()
@@ -64,6 +65,12 @@ void Log::PutDate(Manipulators m)
}
Log & Log::operator<<(const void * s)
{
buffer << s;
return *this;
}
Log & Log::operator<<(const char * s)
@@ -81,7 +88,6 @@ return *this;
Log & Log::operator<<(const std::string & s)
{
buffer << s;
return *this;
}
@@ -90,23 +96,47 @@ Log & Log::operator<<(const std::string & s)
Log & Log::operator<<(const std::string * s)
{
buffer << *s;
return *this;
}
Log & Log::operator<<(const void * s)
Log & Log::operator<<(const wchar_t * s)
{
if( !s )
return *this;
buffer << s;
return *this;
}
Log & Log::operator<<(const std::wstring & s)
{
buffer << s;
return *this;
}
Log & Log::operator<<(const std::wstring * s)
{
buffer << *s;
return *this;
}
Log & Log::operator<<(int s)
{
buffer << s;
return *this;
}
@@ -115,7 +145,6 @@ Log & Log::operator<<(int s)
Log & Log::operator<<(long s)
{
buffer << s;
return *this;
}
@@ -125,7 +154,6 @@ Log & Log::operator<<(long s)
Log & Log::operator<<(char s)
{
buffer << s;
return *this;
}
@@ -134,7 +162,6 @@ Log & Log::operator<<(char s)
Log & Log::operator<<(size_t s)
{
buffer << s;
return *this;
}
@@ -143,7 +170,6 @@ Log & Log::operator<<(size_t s)
Log & Log::operator<<(double s)
{
buffer << s;
return *this;
}
@@ -160,7 +186,7 @@ Log & Log::operator<<(Manipulators m)
case logsavenow:
SaveLog();
buffer.str( "" );
buffer.Clear();
item = 0;
lines = 0;
break;
@@ -171,7 +197,7 @@ Log & Log::operator<<(Manipulators m)
if( item >= item_save || lines > 3000 )
{
SaveLog();
buffer.str( "" );
buffer.Clear();
item = 0;
lines = 0;
}
@@ -205,18 +231,17 @@ void Log::SystemErr(int err)
}
void Log::SaveLog()
{
if( current_level > log_level )
return;
const std::string & source = buffer.str();
if( source.empty() )
if( buffer.Str().empty() )
return;
if( log_stdout )
std::cout << source;
Ezc::WideToUTF8(buffer.Str(), std::cout);
if( log_file.empty() )
return;
@@ -232,7 +257,7 @@ void Log::SaveLog()
return;
}
file << source;
Ezc::WideToUTF8(buffer.Str(), file);
file.flush();
}