fixed: in htmlfilter: <area> should be treated as single tag

changed: ConfParser is abble to recognize lists


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@623 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-07-21 17:24:16 +00:00
parent 93da32cfb3
commit e4683b9a05
7 changed files with 521 additions and 116 deletions

View File

@@ -72,7 +72,8 @@ bool Config::ReadConfig(bool errors_to_stdout_)
log << log2 << "Config: reading a config file" << logend;
ConfParser::Status status = conf_parser.Parse( data.config_file.c_str() );
conf_parser.SplitSingle(true);
ConfParser::Status status = conf_parser.Parse( data.config_file );
if( status == ConfParser::ok )
@@ -141,10 +142,6 @@ void Config::AssignValues()
data.session_file = Text("session_file");
data.compression = Bool("compression", true);
std::string p = Text("plugin");
data.plugin_file.push_back(p);
data.html_filter = Bool("html_filter", true);
data.locale_str = Text("locale", "en");
@@ -153,6 +150,8 @@ void Config::AssignValues()
data.title_separator = Text("title_separator", " / ");
ListText(data.plugin_file, "plugin");
}
@@ -173,9 +172,9 @@ std::string Config::Text(const char * name, const char * def)
std::string Config::Text(const std::string & name, const std::string & def)
{
ConfParser::Table::iterator i = conf_parser.table.find(name);
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
if( i == conf_parser.table.end() )
if( i == conf_parser.table_single.end() )
return def;
return i->second;
@@ -197,9 +196,9 @@ int Config::Int(const char * name, int def)
int Config::Int(const std::string & name, int def)
{
ConfParser::Table::iterator i = conf_parser.table.find(name);
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
if( i == conf_parser.table.end() || i->second.empty() )
if( i == conf_parser.table_single.end() || i->second.empty() )
return def;
long res = (i->second[0] == '0')? strtol(i->second.c_str() + 1, 0, 8) : strtol(i->second.c_str(), 0, 10);
@@ -222,9 +221,9 @@ bool Config::Bool(const char * name, bool def)
bool Config::Bool(const std::string & name, bool def)
{
ConfParser::Table::iterator i = conf_parser.table.find(name);
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
if( i == conf_parser.table.end() || i->second.empty() )
if( i == conf_parser.table_single.end() || i->second.empty() )
return def;
bool res = false;
@@ -239,6 +238,34 @@ return res;
}
// in lists we don't use default values
void Config::ListText(std::vector<std::string> & list, const char * name)
{
ListText(list, std::string(name));
}
void Config::ListText(std::vector<std::string> & list, const std::string & name)
{
list.clear();
ConfParser::TableSingle::iterator i = conf_parser.table_single.find(name);
if( i != conf_parser.table_single.end() )
{
list.push_back(i->second);
return;
}
ConfParser::Table::iterator z = conf_parser.table.find(name);
if( z != conf_parser.table.end() )
{
list = z->second;
return;
}
}
void Config::NoLastSlash(std::string & s)