changed: rename cmslu to winix
changed: html templates are a part of winix now and the user can provide special html templates for its site added: locales added: html templates are using HtmlFilter now (locales) changed: now we have html templates for each language git-svn-id: svn://ttmath.org/publicrep/winix/trunk@560 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -19,13 +19,15 @@ ConfParser::ConfParser()
|
||||
|
||||
ConfParser::Status ConfParser::Parse(const char * file_name)
|
||||
{
|
||||
line = 1;
|
||||
table.clear();
|
||||
|
||||
file.clear();
|
||||
file.open( file_name );
|
||||
|
||||
if( !file )
|
||||
return cant_open_file;
|
||||
|
||||
line = 1;
|
||||
table.clear();
|
||||
ReadChar();
|
||||
status = ParseFile();
|
||||
|
||||
@@ -50,7 +52,8 @@ ConfParser::Status ConfParser::ParseFile()
|
||||
if( !ReadValue() )
|
||||
return syntax_error;
|
||||
|
||||
table.insert( std::make_pair(variable, value) );
|
||||
//table.insert( std::make_pair(variable, value) );
|
||||
table[variable] = value;
|
||||
}
|
||||
|
||||
if( lastc == commentary )
|
||||
@@ -81,7 +84,8 @@ return false;
|
||||
|
||||
bool ConfParser::IsValueSimpleChar(int c)
|
||||
{
|
||||
if( c==-1 || c=='\n' || IsWhite(c) || c==commentary )
|
||||
//if( c==-1 || c=='\n' || IsWhite(c) || c==commentary )
|
||||
if( c==-1 || c=='\n' || c==commentary )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -159,6 +163,7 @@ bool ConfParser::ReadValueSimple()
|
||||
ReadChar();
|
||||
}
|
||||
|
||||
Trim(value);
|
||||
SkipWhite();
|
||||
|
||||
return true;
|
||||
@@ -202,7 +207,34 @@ void ConfParser::SkipLine()
|
||||
|
||||
|
||||
|
||||
|
||||
void ConfParser::Trim(std::string & s)
|
||||
{
|
||||
std::string::size_type i;
|
||||
|
||||
if( s.empty() )
|
||||
return;
|
||||
|
||||
// looking for white characters at the end
|
||||
for(i=s.size()-1 ; i>0 && IsWhite(s[i]) ; --i);
|
||||
|
||||
if( i==0 && IsWhite(s[i]) )
|
||||
{
|
||||
// the whole string has white characters
|
||||
s.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// deleting white characters at the end
|
||||
if( i != s.size() - 1 )
|
||||
s.erase(i+1, std::string::npos);
|
||||
|
||||
// looking for white characters at the beginning
|
||||
for(i=0 ; i<s.size() && IsWhite(s[i]) ; ++i);
|
||||
|
||||
// deleting white characters at the beginning
|
||||
if( i != 0 )
|
||||
s.erase(0, i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user