21 #define THE_INI m_impl->m_ini    34     THE_INI.Load(aux.c_str(), aux.size());
    41     THE_INI.Load(str.c_str(), str.size());
    57     THE_INI.Load(aux.c_str(), aux.size());
    62     THE_INI.Load(str.c_str(), str.size());
    72     const std::string& section, 
const std::string& name, 
const std::string& str)
    77         THE_INI.SetValue(section.c_str(), name.c_str(), str.c_str(), 
nullptr);
    78     if (ret < 0) 
THROW_EXCEPTION(
"Error changing value in INI-style file!");
    84     const std::string& section, 
const std::string& name,
    85     const std::string& defaultStr, 
bool failIfNotFound)
 const    88     const char* defVal = failIfNotFound ? nullptr : defaultStr.c_str();
    90     const char* aux = 
m_impl->m_ini.GetValue(
    91         section.c_str(), name.c_str(), defVal,
    94     if (failIfNotFound && !aux)
    97             "Value '%s' not found in section '%s' of memory configuration "    98             "string list and failIfNotFound=true.",
    99             name.c_str(), section.c_str()));
   104     std::string ret = aux;
   106     if ((pos = ret.find(
"//")) != string::npos && pos > 0 &&
   107         isspace(ret[pos - 1]))
   108         ret = ret.substr(0, pos);
   118     MRPT_CSimpleIni::TNamesDepend::iterator n;
   119     std::vector<std::string>::iterator s;
   120     sections.resize(
names.size());
   121     for (n = 
names.begin(), s = sections.begin(); n != 
names.end(); ++n, ++s)
   126     const string& section, std::vector<std::string>& keys)
 const   131     MRPT_CSimpleIni::TNamesDepend::iterator n;
   132     std::vector<std::string>::iterator s;
   133     keys.resize(
names.size());
   134     for (n = 
names.begin(), s = keys.begin(); n != 
names.end(); ++n, ++s)
 
This class implements a config file-like interface over a memory-stored string list. 
 
CConfigFileMemory()
Empty constructor. 
 
~CConfigFileMemory() override
dtor 
 
#define THROW_EXCEPTION(msg)
 
std::string std::string format(std::string_view fmt, ARGS &&... args)
 
void stringListAsString(const std::vector< std::string > &lst, std::string &out, const std::string &newline="\")
Convert a string list to one single string with new-lines. 
 
std::string getContent() const
 
void getAllKeys(const std::string §ion, std::vector< std::string > &keys) const override
Returs a list with all the keys into a section. 
 
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. 
 
void getAllSections(std::vector< std::string > §ions) const override
Returns a list with all the section names. 
 
std::vector< string > names
 
mrpt::pimpl< Impl > m_impl
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
void clear() override
Empties the virtual "config file". 
 
void setContent(const std::vector< std::string > &stringList)
Changes the contents of the virtual "config file". 
 
void writeString(const std::string §ion, const std::string &name, const std::string &str) override
A virtual method to write a generic string. 
 
pimpl< T > make_impl(Args &&... args)
 
std::list< Entry > TNamesDepend
set of dependent string pointers.