updated to the new Pikotools api (new Space struct)

This commit is contained in:
2021-04-09 17:50:58 +02:00
parent 00b980e74b
commit 35e10ed469
52 changed files with 795 additions and 736 deletions

View File

@@ -83,9 +83,9 @@ void Config::ShowError()
case PT::SpaceParser::syntax_error:
if( errors_to_stdout )
std::wcout << "Config: syntax error, line: " << parser.line << std::endl;
std::wcout << "Config: syntax error, line: " << parser.get_last_parsed_line() << std::endl;
log << log1 << "Config: syntax error, line: " << parser.line << logend;
log << log1 << "Config: syntax error, line: " << parser.get_last_parsed_line() << logend;
break;
}
}
@@ -108,7 +108,7 @@ bool Config::ReadConfig(bool errors_to_stdout_, bool stdout_is_closed)
log << log2 << "Config: reading a config file" << logend;
parser.SetSpace(space);
PT::SpaceParser::Status status = parser.Parse(config_file);
PT::SpaceParser::Status status = parser.ParseSpaceFile(config_file);
if( status == PT::SpaceParser::ok )
{
@@ -382,150 +382,112 @@ void Config::CheckPasswd()
std::wstring Config::Text(const wchar_t * name)
{
return space.Text(name);
return space.to_wstr(name);
}
std::wstring Config::Text(const wchar_t * name, const wchar_t * def)
{
return space.Text(name, def);
return space.to_wstr(name, def);
}
std::wstring Config::Text(const std::wstring & name, const wchar_t * def)
{
return space.Text(name, def);
}
std::wstring & Config::TextRef(const wchar_t * name)
{
return space.TextRef(name);
}
std::wstring & Config::TextRef(const wchar_t * name, const wchar_t * def)
{
return space.TextRef(name, def);
}
std::wstring & Config::TextRef(const std::wstring & name, const wchar_t * def)
{
return space.TextRef(name, def);
return space.to_wstr(name, def);
}
int Config::Int(const wchar_t * name)
{
return space.Int(name);
return space.to_int(name);
}
int Config::Int(const wchar_t * name, int def)
{
return space.Int(name, def);
return space.to_int(name, def);
}
int Config::Int(const std::wstring & name, int def)
{
return space.Int(name, def);
return space.to_int(name, def);
}
long Config::Long(const wchar_t * name)
{
return space.Long(name);
return space.to_long(name);
}
long Config::Long(const wchar_t * name, long def)
{
return space.Long(name, def);
return space.to_long(name, def);
}
long Config::Long(const std::wstring & name, long def)
{
return space.Long(name, def);
return space.to_long(name, def);
}
size_t Config::Size(const wchar_t * name)
{
return space.Size(name);
return space.to_ulong(name);
}
size_t Config::Size(const wchar_t * name, size_t def)
{
return space.Size(name, def);
return space.to_ulong(name, def);
}
size_t Config::Size(const std::wstring & name, size_t def)
{
return space.Size(name, def);
return space.to_ulong(name, def);
}
bool Config::Bool(const wchar_t * name)
{
return space.Bool(name);
return space.to_bool(name);
}
bool Config::Bool(const wchar_t * name, bool def)
{
return space.Bool(name, def);
return space.to_bool(name, def);
}
bool Config::Bool(const std::wstring & name, bool def)
{
return space.Bool(name, def);
return space.to_bool(name, def);
}
bool Config::ListText(const wchar_t * name, std::vector<std::wstring> & list)
{
return space.ListText(name, list);
return space.to_list(name, list);
}
bool Config::ListText(const std::wstring & name, std::vector<std::wstring> & list)
{
return space.ListText(name, list);
return space.to_list(name, list);
}
bool Config::HasValue(const wchar_t * name, const wchar_t * value)
{
return space.HasValue(name, value);
}
bool Config::HasValue(const wchar_t * name, const std::wstring & value)
{
return space.HasValue(name, value);
}
bool Config::HasValue(const std::wstring & name, const wchar_t * value)
{
return space.HasValue(name, value);
}
bool Config::HasValue(const std::wstring & name, const std::wstring & value)
{
return space.HasValue(name, value);
}
void Config::Print(std::wostream & out)
{
space.Serialize(out);
}
//void Config::Print(std::wostream & out)
//{
// space.serialize_to_space_stream(out);
//}