71 if (m_modified && !m_file.empty())
103 if (0 > static_cast<MRPT_CSimpleIni*>(m_ini.get())->SetValue( section.c_str(),
name.c_str(),str.c_str(), NULL ))
117 bool failIfNotFound )
const 120 const char *defVal = failIfNotFound ? NULL :defaultStr.c_str();
122 const char *aux =
static_cast<const MRPT_CSimpleIni*
>(m_ini.get())->GetValue(
128 if (failIfNotFound && !aux )
130 string tmpStr(
format(
"Value '%s' not found in section '%s' of file '%s' and failIfNotFound=true.",
140 if ((pos=ret.find(
"//"))!=string::npos && pos>0 && isspace(ret[pos-1]))
141 ret = ret.substr(0,pos);
153 static_cast<const MRPT_CSimpleIni*
>(m_ini.get())->GetAllSections(names);
157 sections.resize(names.size());
158 for (
n=names.begin(),
s=sections.begin();
n!=names.end();++
n,++
s)
169 static_cast<const MRPT_CSimpleIni*
>(m_ini.get())->GetAllKeys(section.c_str(), names);
173 keys.resize(names.size());
174 for (
n = names.begin(),
s = keys.begin();
n!=names.end();++
n,++
s)
virtual void getAllKeys(const std::string §ion, vector_string &keys) const MRPT_OVERRIDE
Returs a list with all the keys into a section.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
void discardSavingChanges()
Discard saving (current) changes to physical file upon destruction.
#define THROW_EXCEPTION(msg)
void writeString(const std::string §ion, const std::string &name, const std::string &str) MRPT_OVERRIDE
A virtual method to write a generic string.
virtual ~CConfigFile()
Destructor.
std::vector< std::string > vector_string
A type for passing a vector of strings.
CSimpleIniTempl< char, SI_GenericNoCase< char >, MRPT_IniFileParser > MRPT_CSimpleIni
CConfigFile()
Constructor, does not open any file.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
GLsizei const GLchar ** string
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.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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...
std::list< Entry > TNamesDepend
set of dependent string pointers.
GLuint const GLchar * name
void writeNow()
Dumps the changes to the physical configuration file now, not waiting until destruction.
virtual void getAllSections(vector_string §ions) const MRPT_OVERRIDE
Returns a list with all the section names.