1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 01:06:38 +02:00

Epic commit to replace most of the strings in Anope with a single Anope::string class, plus some other little fixes here and there. If you follow 1.9.x development and are testing things, THIS is one of those things that NEEDS testing.

This commit is contained in:
Naram Qashat
2010-07-25 21:58:20 -04:00
parent 15d7f0f6fe
commit ae38212c1c
232 changed files with 7424 additions and 8911 deletions
+15 -15
View File
@@ -25,42 +25,42 @@ ConfigReader::~ConfigReader()
delete this->data;
}
ConfigReader::ConfigReader(const std::string &filename) : data(new ConfigDataHash), errorlog(new std::ostringstream(std::stringstream::in | std::stringstream::out)), privatehash(true), error(CONF_NO_ERROR)
ConfigReader::ConfigReader(const Anope::string &filename) : data(new ConfigDataHash), errorlog(new std::ostringstream(std::stringstream::in | std::stringstream::out)), privatehash(true), error(CONF_NO_ERROR)
{
Config.ClearStack();
}
std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds)
Anope::string ConfigReader::ReadValue(const Anope::string &tag, const Anope::string &name, const Anope::string &default_value, int index, bool allow_linefeeds)
{
/* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */
ci::string result;
Anope::string result;
if (!Config.ConfValue(*this->data, ci::string(tag.c_str()), ci::string(name.c_str()), ci::string(default_value.c_str()), index, result, allow_linefeeds))
if (!Config.ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds))
this->error = CONF_VALUE_NOT_FOUND;
return result.c_str();
return result;
}
std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, int index, bool allow_linefeeds)
Anope::string ConfigReader::ReadValue(const Anope::string &tag, const Anope::string &name, int index, bool allow_linefeeds)
{
return ReadValue(tag, name, "", index, allow_linefeeds);
}
bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, const std::string &default_value, int index)
bool ConfigReader::ReadFlag(const Anope::string &tag, const Anope::string &name, const Anope::string &default_value, int index)
{
return Config.ConfValueBool(*this->data, ci::string(tag.c_str()), ci::string(name.c_str()), ci::string(default_value.c_str()), index);
return Config.ConfValueBool(*this->data, tag, name, default_value, index);
}
bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int index)
bool ConfigReader::ReadFlag(const Anope::string &tag, const Anope::string &name, int index)
{
return ReadFlag(tag, name, "", index);
}
int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive)
int ConfigReader::ReadInteger(const Anope::string &tag, const Anope::string &name, const Anope::string &default_value, int index, bool need_positive)
{
int result;
if (!Config.ConfValueInteger(*this->data, ci::string(tag.c_str()), ci::string(name.c_str()), ci::string(default_value.c_str()), index, result))
if (!Config.ConfValueInteger(*this->data, tag, name, default_value, index, result))
{
this->error = CONF_VALUE_NOT_FOUND;
return 0;
@@ -75,7 +75,7 @@ int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, c
return result;
}
int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, int index, bool need_positive)
int ConfigReader::ReadInteger(const Anope::string &tag, const Anope::string &name, int index, bool need_positive)
{
return ReadInteger(tag, name, "", index, need_positive);
}
@@ -92,14 +92,14 @@ void ConfigReader::DumpErrors(bool bail)
Config.ReportConfigError(this->errorlog->str(), bail);
}
int ConfigReader::Enumerate(const std::string &tag)
int ConfigReader::Enumerate(const Anope::string &tag)
{
return Config.ConfValueEnum(*this->data, tag);
}
int ConfigReader::EnumerateValues(const std::string &tag, int index)
int ConfigReader::EnumerateValues(const Anope::string &tag, int index)
{
return Config.ConfVarEnum(*this->data, ci::string(tag.c_str()), index);
return Config.ConfVarEnum(*this->data, tag, index);
}
bool ConfigReader::Verify()