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:
@@ -39,7 +39,7 @@ void TicketParser::SkipWhiteLines()
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadTextQuoted(std::string & text)
|
||||
void TicketParser::ReadTextQuoted(std::wstring & text)
|
||||
{
|
||||
pchar += 1;
|
||||
|
||||
@@ -57,7 +57,7 @@ void TicketParser::ReadTextQuoted(std::string & text)
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadTextSimple(std::string & text, bool comma_separator)
|
||||
void TicketParser::ReadTextSimple(std::wstring & text, bool comma_separator)
|
||||
{
|
||||
while( *pchar!=0 && *pchar!=10 && !IsWhite(*pchar) && *pchar!='(' && *pchar!=')' &&
|
||||
(!comma_separator || *pchar!=',' ) )
|
||||
@@ -68,7 +68,7 @@ void TicketParser::ReadTextSimple(std::string & text, bool comma_separator)
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadText(std::string & text, bool comma_separator)
|
||||
void TicketParser::ReadText(std::wstring & text, bool comma_separator)
|
||||
{
|
||||
SkipWhite();
|
||||
text.clear();
|
||||
@@ -96,10 +96,10 @@ void TicketParser::CheckId(int & id, bool & def)
|
||||
{
|
||||
ReadText(id_str, true);
|
||||
|
||||
if( id_str == "def" )
|
||||
if( id_str == L"def" )
|
||||
def = true;
|
||||
else
|
||||
id = atoi(id_str.c_str());
|
||||
id = Atoi(id_str);
|
||||
|
||||
if( *pchar == ',' )
|
||||
pchar += 1;
|
||||
@@ -118,10 +118,10 @@ bool TicketParser::ReadItemType()
|
||||
if( type.empty() )
|
||||
return false;
|
||||
|
||||
if( type == "integer" )
|
||||
if( type == L"integer" )
|
||||
item.type = TicketConf::TicketItem::TypeInteger;
|
||||
else
|
||||
if( type == "select" )
|
||||
if( type == L"select" )
|
||||
item.type = TicketConf::TicketItem::TypeSelect;
|
||||
else
|
||||
{
|
||||
@@ -165,10 +165,10 @@ void TicketParser::ReadItemInteger()
|
||||
ReadText(int_max);
|
||||
|
||||
if( !int_min.empty() )
|
||||
item.integer_min = atoi(int_min.c_str());
|
||||
item.integer_min = Atoi(int_min);
|
||||
|
||||
if( !int_max.empty() )
|
||||
item.integer_max = atoi(int_max.c_str());
|
||||
item.integer_max = Atoi(int_max);
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ void TicketParser::LogItem(TicketConf::TicketItem & item)
|
||||
}
|
||||
|
||||
|
||||
int TicketParser::Parse(const char * str, TicketConf & conf)
|
||||
int TicketParser::Parse(const wchar_t * str, TicketConf & conf)
|
||||
{
|
||||
pchar = str;
|
||||
pconf = &conf;
|
||||
@@ -302,7 +302,7 @@ return error;
|
||||
|
||||
|
||||
|
||||
int TicketParser::Parse(const std::string & str, TicketConf & conf)
|
||||
int TicketParser::Parse(const std::wstring & str, TicketConf & conf)
|
||||
{
|
||||
return Parse(str.c_str(), conf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user