22 #define THE_INI static_cast<MRPT_CSimpleIni*>(m_ini.get()) 35 THE_INI->Load( aux.c_str(), aux.size() );
47 THE_INI->Load( str.c_str(), str.size() );
72 THE_INI->Load(str.c_str(),str.size());
85 THE_INI->Load( aux.c_str(), aux.size() );
93 THE_INI->Load( str.c_str(), str.size() );
133 bool failIfNotFound)
const 136 const char *defVal = failIfNotFound ? NULL :defaultStr.c_str();
138 const char *aux =
static_cast<const MRPT_CSimpleIni*
>(m_ini.get())->GetValue(
144 if (failIfNotFound && !aux )
146 string tmpStr(
format(
"Value '%s' not found in section '%s' of memory configuration string list and failIfNotFound=true.",
name.c_str(),section.c_str() ) );
153 if ((pos=ret.find(
"//"))!=string::npos && pos>0 && isspace(ret[pos-1]))
154 ret = ret.substr(0,pos);
165 static_cast<const MRPT_CSimpleIni*
>(m_ini.get())->GetAllSections(names);
169 sections.resize(names.size());
170 for (
n=names.begin(),
s=sections.begin();
n!=names.end();++
n,++
s)
181 static_cast<const MRPT_CSimpleIni*
>(m_ini.get())->GetAllKeys(section.c_str(), names);
185 keys.resize(names.size());
186 for (
n = names.begin(),
s = keys.begin();
n!=names.end();++
n,++
s)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define THROW_EXCEPTION(msg)
std::string readString(const std::string §ion, const std::string &name, const std::string &defaultStr, bool failIfNotFound=false) const MRPT_OVERRIDE
A virtual method to read a generic string.
void getAllSections(vector_string §ions) const MRPT_OVERRIDE
Returns a list with all the section names.
std::string getContent() const
This class implements a config file-like interface over a memory-stored string list.
std::vector< std::string > vector_string
A type for passing a vector of strings.
A class for storing a list of text lines.
CSimpleIniTempl< char, SI_GenericNoCase< char >, MRPT_IniFileParser > MRPT_CSimpleIni
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLsizei const GLchar ** string
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
virtual ~CConfigFileMemory()
dtor
CConfigFileMemory & operator=(const CConfigFileMemory &o)
Copy operator.
std::list< Entry > TNamesDepend
set of dependent string pointers.
GLuint const GLchar * name
void_ptr_noncopy m_ini
The IniFile object.
void getAllKeys(const std::string §ion, vector_string &keys) const MRPT_OVERRIDE
Returs a list with all the keys into a section.
void writeString(const std::string §ion, const std::string &name, const std::string &str) MRPT_OVERRIDE
A virtual method to write a generic string.
void getText(std::string &outText) const
Returns the whole string list as a single string with ' ' characters for newlines.
CConfigFileMemory()
Empty constructor. Upon construction, call any of the "setContent" method.
void setContent(const utils::CStringList &stringList)
Changes the contents of the virtual "config file".