#include <config_file.h>
Public Member Functions | |
| CVar () | |
| bool | operator== (const CVar &var) const |
| bool | operator!= (const CVar &var) const |
| void | add (const CVar &var) |
| uint | size () const |
Access to the variable content. | |
| int | asInt (int index=0) const |
| Get the content of the variable as an integer. | |
| double | asDouble (int index=0) const |
| Get the content of the variable as a double. | |
| float | asFloat (int index=0) const |
| Get the content of the variable as a float. | |
| std::string | asString (int index=0) const |
| Get the content of the variable as a STL string. | |
| bool | asBool (int index=0) const |
| Get the content of the variable as a boolean. | |
Set the variable content. | |
| void | setAsInt (int val, int index=0) |
| Set the content of the variable as an integer. | |
| void | setAsDouble (double val, int index=0) |
| Set the content of the variable as a double. | |
| void | setAsFloat (float val, int index=0) |
| Set the content of the variable as a float. | |
| void | setAsString (const std::string &val, int index=0) |
| Set the content of the variable as a STL string. | |
| void | forceAsInt (int val) |
| Force the content of the variable to be a single integer. | |
| void | forceAsDouble (double val) |
| Force the content of the variable to be a single double. | |
| void | forceAsString (const std::string &val) |
| Force the content of the variable to be a single string. | |
| void | setAsInt (const std::vector< int > &vals) |
| Set the content of the aray variable as an integer. | |
| void | setAsDouble (const std::vector< double > &vals) |
| Set the content of the aray variable as a double. | |
| void | setAsFloat (const std::vector< float > &vals) |
| Set the content of the aray variable as a float. | |
| void | setAsString (const std::vector< std::string > &vals) |
| Set the content of the aray variable as a string. | |
Internal use | |
|
| |
| enum | TVarType { T_UNKNOWN, T_INT, T_STRING, T_REAL, T_BOOL } |
| static const char * | TypeName [] = { "Integer", "String", "Float", "Boolean" } |
| std::string | Name |
| TVarType | Type |
| bool | Root |
| bool | Comp |
| bool | FromLocalFile |
| std::vector< int > | IntValues |
| std::vector< double > | RealValues |
| std::vector< std::string > | StrValues |
| int | SaveWrap |
| void(* | Callback )(CVar &var) |
CVar class.
Used by CConfigFile. A CVar is returned when you want to have a variable.
Example: see the CConfigFile example
Definition at line 130 of file config_file.h.
Definition at line 193 of file config_file.h.
| NLMISC::CConfigFile::CVar::CVar | ( | ) | [inline] |
Definition at line 134 of file config_file.h.
| void NLMISC::CConfigFile::CVar::add | ( | const CVar & | var | ) |
Definition at line 269 of file config_file.cpp.
References IntValues, RealValues, StrValues, T_INT, T_REAL, T_STRING, and Type.
Get the content of the variable as a boolean.
Definition at line 116 of file config_file.cpp.
References IntValues, Name, RealValues, StrValues, T_REAL, T_STRING, and Type.
Get the content of the variable as a float.
Definition at line 94 of file config_file.cpp.
References asDouble().
Referenced by NLLIGO::CLigoConfig::readConfigFile().
Get the content of the variable as an integer.
Definition at line 60 of file config_file.cpp.
References IntValues, Name, RealValues, StrValues, T_INT, T_REAL, T_STRING, and Type.
Referenced by NLNET::cbSimVar(), NLNET::cfcbAcceptInvalidCookie(), NLNET::cfcbTimeBeforeEraseCookie(), NLMISC::CWordsDictionary::init(), NLNET::IService::main(), NLLIGO::CLigoConfig::readConfigFile(), and NLLIGO::CLigoConfig::reloadIndexFile().
| std::string NLMISC::CConfigFile::CVar::asString | ( | int | index = 0 |
) | const |
Get the content of the variable as a STL string.
Definition at line 99 of file config_file.cpp.
References IntValues, Name, RealValues, StrValues, T_INT, T_REAL, T_STRING, NLMISC::toString(), and Type.
Referenced by NLNET::cbExecuteCommands(), NLNET::cbLogFilter(), NLMISC::cbVarChanged(), NLNET::cfcbDefaultUserPriv(), NLNET::cfcbListenAddress(), NLMISC::CWordsDictionary::init(), NLMISC::CCommandRegistry::initVariables(), NLNET::IService::main(), NLLIGO::CLigoConfig::readConfigFile(), NLLIGO::CLigoConfig::reloadIndexFile(), and NLMISC::CConfigFile::reparse().
| void NLMISC::CConfigFile::CVar::forceAsDouble | ( | double | val | ) |
Force the content of the variable to be a single double.
Definition at line 195 of file config_file.cpp.
References IntValues, RealValues, Root, StrValues, T_REAL, and Type.
| void NLMISC::CConfigFile::CVar::forceAsInt | ( | int | val | ) |
Force the content of the variable to be a single integer.
Definition at line 185 of file config_file.cpp.
References IntValues, RealValues, Root, StrValues, T_INT, and Type.
| void NLMISC::CConfigFile::CVar::forceAsString | ( | const std::string & | val | ) |
Force the content of the variable to be a single string.
Definition at line 205 of file config_file.cpp.
References IntValues, RealValues, Root, StrValues, T_STRING, and Type.
Definition at line 264 of file config_file.cpp.
Definition at line 249 of file config_file.cpp.
References IntValues, RealValues, StrValues, T_INT, T_REAL, T_STRING, and Type.
| void NLMISC::CConfigFile::CVar::setAsDouble | ( | const std::vector< double > & | vals | ) |
Set the content of the aray variable as a double.
Definition at line 222 of file config_file.cpp.
References Name, RealValues, Root, T_REAL, and Type.
Set the content of the variable as a double.
Definition at line 162 of file config_file.cpp.
References Name, RealValues, Root, T_REAL, and Type.
Referenced by setAsFloat().
| void NLMISC::CConfigFile::CVar::setAsFloat | ( | const std::vector< float > & | vals | ) |
Set the content of the aray variable as a float.
Definition at line 229 of file config_file.cpp.
References Name, RealValues, Root, T_REAL, and Type.
Set the content of the variable as a float.
Definition at line 171 of file config_file.cpp.
References setAsDouble().
| void NLMISC::CConfigFile::CVar::setAsInt | ( | const std::vector< int > & | vals | ) |
| void NLMISC::CConfigFile::CVar::setAsString | ( | const std::vector< std::string > & | vals | ) |
| void NLMISC::CConfigFile::CVar::setAsString | ( | const std::string & | val, | |
| int | index = 0 | |||
| ) |
| uint NLMISC::CConfigFile::CVar::size | ( | ) | const |
Definition at line 283 of file config_file.cpp.
References IntValues, RealValues, StrValues, T_INT, T_REAL, T_STRING, and Type.
Referenced by NLNET::cbExecuteCommands(), NLNET::cbLogFilter(), NLMISC::CWordsDictionary::init(), NLNET::IService::main(), and NLLIGO::CLigoConfig::reloadIndexFile().
| void(* NLMISC::CConfigFile::CVar::Callback)(CVar &var) |
Referenced by NLMISC::CConfigFile::setCallback().
Definition at line 198 of file config_file.h.
Referenced by NLMISC::CConfigFile::setCallback().
Definition at line 199 of file config_file.h.
| std::vector<int> NLMISC::CConfigFile::CVar::IntValues |
Definition at line 200 of file config_file.h.
Referenced by add(), asBool(), asDouble(), asInt(), asString(), forceAsDouble(), forceAsInt(), forceAsString(), operator==(), setAsInt(), and size().
| std::string NLMISC::CConfigFile::CVar::Name |
Definition at line 195 of file config_file.h.
Referenced by asBool(), asDouble(), asInt(), asString(), NLNET::cbLogFilter(), NLNET::cbSimVar(), NLMISC::cbVarChanged(), NLMISC::CConfigFile::insertVar(), setAsDouble(), setAsFloat(), setAsInt(), setAsString(), and NLMISC::CConfigFile::setCallback().
| std::vector<double> NLMISC::CConfigFile::CVar::RealValues |
Definition at line 201 of file config_file.h.
Referenced by add(), asBool(), asDouble(), asInt(), asString(), forceAsDouble(), forceAsInt(), forceAsString(), operator==(), setAsDouble(), setAsFloat(), and size().
Definition at line 197 of file config_file.h.
Referenced by forceAsDouble(), forceAsInt(), forceAsString(), NLMISC::CConfigFile::insertVar(), setAsDouble(), setAsFloat(), setAsInt(), and setAsString().
Definition at line 204 of file config_file.h.
| std::vector<std::string> NLMISC::CConfigFile::CVar::StrValues |
Definition at line 202 of file config_file.h.
Referenced by add(), asBool(), asDouble(), asInt(), asString(), forceAsDouble(), forceAsInt(), forceAsString(), operator==(), setAsString(), and size().
Definition at line 196 of file config_file.h.
Referenced by add(), asBool(), asDouble(), asInt(), asString(), forceAsDouble(), forceAsInt(), forceAsString(), operator==(), setAsDouble(), setAsFloat(), setAsInt(), setAsString(), NLMISC::CConfigFile::setCallback(), and size().
const char * NLMISC::CConfigFile::CVar::TypeName = { "Integer", "String", "Float", "Boolean" } [static] |
Definition at line 191 of file config_file.h.
Referenced by NLMISC::EBadType::EBadType().
1.6.1