36     m_impl->m_ini.LoadFile(fileName.c_str());
    64     m_impl->m_ini.LoadFile(fil_path.c_str());
    90     catch (
const std::exception& e)
    97     const std::string& section, 
const std::string& name, 
const std::string& str)
   103     if (0 > 
m_impl->m_ini.SetValue(
   104                 section.c_str(), name.c_str(), str.c_str(), 
nullptr))
   114     const std::string& section, 
const std::string& name,
   115     const std::string& defaultStr, 
bool failIfNotFound)
 const   118     const char* defVal = failIfNotFound ? nullptr : defaultStr.c_str();
   120     const char* aux = 
m_impl->m_ini.GetValue(
   121         section.c_str(), name.c_str(), defVal,
   124     if (failIfNotFound && !aux)
   127             "Value '%s' not found in section '%s' of file '%s' and "   128             "failIfNotFound=true.",
   129             name.c_str(), section.c_str(), 
m_file.c_str()));
   134     std::string ret = aux;
   136     if ((pos = ret.find(
"//")) != string::npos && pos > 0 &&
   137         isspace(ret[pos - 1]))
   138         ret = ret.substr(0, pos);
   152     MRPT_CSimpleIni::TNamesDepend::iterator n;
   153     std::vector<std::string>::iterator s;
   154     sections.resize(
names.size());
   155     for (n = 
names.begin(), s = sections.begin(); n != 
names.end(); ++n, ++s)
   163     const string& section, std::vector<std::string>& keys)
 const   168     MRPT_CSimpleIni::TNamesDepend::iterator n;
   169     std::vector<std::string>::iterator s;
   170     keys.resize(
names.size());
   171     for (n = 
names.begin(), s = keys.begin(); n != 
names.end(); ++n, ++s)
 mrpt::pimpl< Impl > m_impl
 
#define THROW_EXCEPTION(msg)
 
~CConfigFile() override
Destructor. 
 
void writeString(const std::string §ion, const std::string &name, const std::string &str) override
A virtual method to write a generic string. 
 
std::string std::string format(std::string_view fmt, ARGS &&... args)
 
void getAllSections(std::vector< std::string > §ions) const override
Returns a list with all the section names. 
 
bool m_modified
If modified since load. 
 
This class allows loading and storing values and vectors of different types from ".ini" files easily. 
 
CConfigFile()
Constructor, does not open any file. 
 
std::string readString(const std::string §ion, const std::string &name, const std::string &defaultStr, bool failIfNotFound=false) const override
A virtual method to read a generic string. 
 
std::vector< string > names
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
void writeNow()
Dumps the changes to the physical configuration file now, not waiting until destruction. 
 
std::string m_file
The name of the file. 
 
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
 
pimpl< T > make_impl(Args &&... args)
 
void setFileName(const std::string &fil_path)
Associate this object with the given file, so future read/write operations will be applied to that fi...
 
void discardSavingChanges()
Discard saving (current) changes to physical file upon destruction. 
 
void getAllKeys(const std::string §ion, std::vector< std::string > &keys) const override
Returs a list with all the keys into a section. 
 
std::list< Entry > TNamesDepend
set of dependent string pointers. 
 
void clear() override
Empties the "config file".