changed: ConfParser -- now we can have a tree (spaces can have more than one level)

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@768 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-09-26 05:40:26 +00:00
parent 60f0e62c23
commit 89efaa790f
10 changed files with 644 additions and 599 deletions

View File

@@ -31,6 +31,10 @@ void Config::ShowError()
switch( parser.status )
{
case ConfParser::no_space:
log << log2 << "Config: space not set" << logend;
break;
case ConfParser::ok:
log << log2 << "Config: syntax ok" << logend;
break;
@@ -70,8 +74,9 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
parser.SplitSingle(true);
parser.UTF8(true); // config is always read in UTF-8
ConfParser::Status status = parser.Parse( config_file );
parser.SetSpace(space);
ConfParser::Status status = parser.Parse(config_file);
if( status == ConfParser::ok )
{
@@ -184,7 +189,7 @@ void Config::AssignValues(bool stdout_is_closed)
html_filter_wrap_line = Int(L"html_filter_wrap_line", 110);
html_filter_tabs = Size(L"html_filter_tabs", 2);
html_filter_orphans = Bool(L"html_filter_orphans", true);
html_filter_orphans_mode_str = AText(L"html_filter_orphans_mode_str", L"nbsp");
html_filter_orphans_mode_str = Text(L"html_filter_orphans_mode_str", L"nbsp");
locale_dir = Text(L"locale_dir");
locale_dir_default = Text(L"locale_dir_default");
@@ -230,7 +235,7 @@ void Config::AssignValues(bool stdout_is_closed)
void Config::SetAdditionalVariables()
{
if( html_filter_orphans_mode_str == "160" )
if( html_filter_orphans_mode_str == L"160" )
html_filter_orphans_mode = HTMLFilter::orphan_160space;
else
html_filter_orphans_mode = HTMLFilter::orphan_nbsp;
@@ -297,111 +302,111 @@ void Config::CheckPasswd()
std::wstring & Config::Text(const wchar_t * name)
{
return parser.Text(name);
return space.Text(name);
}
std::wstring & Config::Text(const wchar_t * name, const wchar_t * def)
{
return parser.Text(name, def);
return space.Text(name, def);
}
std::wstring & Config::Text(const std::wstring & name, const wchar_t * def)
{
return parser.Text(name, def);
return space.Text(name, def);
}
std::string & Config::AText(const wchar_t * name)
{
return parser.AText(name);
return space.AText(name);
}
std::string & Config::AText(const wchar_t * name, const wchar_t * def)
std::string & Config::AText(const wchar_t * name, const char * def)
{
return parser.AText(name, def);
return space.AText(name, def);
}
std::string & Config::AText(const std::wstring & name, const wchar_t * def)
std::string & Config::AText(const std::wstring & name, const char * def)
{
return parser.AText(name, def);
return space.AText(name, def);
}
int Config::Int(const wchar_t * name)
{
return parser.Int(name);
return space.Int(name);
}
int Config::Int(const wchar_t * name, int def)
{
return parser.Int(name, def);
return space.Int(name, def);
}
int Config::Int(const std::wstring & name, int def)
{
return parser.Int(name, def);
return space.Int(name, def);
}
size_t Config::Size(const wchar_t * name)
{
return parser.Size(name);
return space.Size(name);
}
size_t Config::Size(const wchar_t * name, size_t def)
{
return parser.Size(name, def);
return space.Size(name, def);
}
size_t Config::Size(const std::wstring & name, size_t def)
{
return parser.Size(name, def);
return space.Size(name, def);
}
bool Config::Bool(const wchar_t * name)
{
return parser.Bool(name);
return space.Bool(name);
}
bool Config::Bool(const wchar_t * name, bool def)
{
return parser.Bool(name, def);
return space.Bool(name, def);
}
bool Config::Bool(const std::wstring & name, bool def)
{
return parser.Bool(name, def);
return space.Bool(name, def);
}
void Config::ListText(const wchar_t * name, std::vector<std::wstring> & list)
bool Config::ListText(const wchar_t * name, std::vector<std::wstring> & list)
{
parser.ListText(name, list);
return space.ListText(name, list);
}
void Config::ListText(const std::wstring & name, std::vector<std::wstring> & list)
bool Config::ListText(const std::wstring & name, std::vector<std::wstring> & list)
{
parser.ListText(name, list);
return space.ListText(name, list);
}
void Config::Print(std::ostream & out)
void Config::Print(std::wostream & out)
{
parser.Print(out);
space.Print(out);
}