Go to the documentation of this file.
36 m_impl->m_ini.LoadFile(fileName.c_str());
65 m_impl->m_ini.LoadFile(fil_path.c_str());
102 if (0 >
m_impl->m_ini.SetValue(section.c_str(),
name.c_str(), str.c_str(), NULL))
113 const std::string& defaultStr,
bool failIfNotFound)
const
116 const char* defVal = failIfNotFound ? NULL : defaultStr.c_str();
118 const char* aux =
m_impl->m_ini.GetValue(
119 section.c_str(),
name.c_str(), defVal,
122 if (failIfNotFound && !aux)
126 "Value '%s' not found in section '%s' of file '%s' and "
127 "failIfNotFound=true.",
128 name.c_str(), section.c_str(),
m_file.c_str()));
135 if ((pos = ret.find(
"//")) != string::npos && pos > 0 &&
136 isspace(ret[pos - 1]))
137 ret = ret.substr(0, pos);
153 sections.resize(
names.size());
154 for (
n =
names.begin(),
s = sections.begin();
n !=
names.end(); ++
n, ++
s)
162 const string& section, std::vector<std::string>& keys)
const
169 keys.resize(
names.size());
virtual void getAllSections(std::vector< std::string > §ions) const override
Returns a list with all the section names.
mrpt::pimpl< Impl > m_impl
virtual ~CConfigFile()
Destructor.
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::list< Entry > TNamesDepend
set of dependent string pointers.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void discardSavingChanges()
Discard saving (current) changes to physical file upon destruction.
#define THROW_EXCEPTION(msg)
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...
GLuint const GLchar * name
std::string m_file
The name of the file.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void writeNow()
Dumps the changes to the physical configuration file now, not waiting until destruction.
std::vector< string > names
void writeString(const std::string §ion, const std::string &name, const std::string &str) override
A virtual method to write a generic string
This class allows loading and storing values and vectors of different types from "....
pimpl< T > make_impl(Args &&... args)
GLsizei const GLchar ** string
virtual void getAllKeys(const std::string §ion, std::vector< std::string > &keys) const override
Returs a list with all the keys into a section.
bool m_modified
If modified since load.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |