Class CConfigFileMemory
Defined in File CConfigFileMemory.h
Inheritance Relationships
Base Type
public mrpt::config::CConfigFileBase(Class CConfigFileBase)
Class Documentation
-
class CConfigFileMemory : public mrpt::config::CConfigFileBase
This class implements a config file-like interface over a memory-stored string list.
Use base class
CConfigFileBase’s methodsread_{int,float,double,string,...}()andwrite()to actually read and write values.It can also parse a YAML text block and expose its fields (up to the first level of hierarchy, as allowed by INI-like files). This can be used to port MRPT classes relying on INI files to using YAML files transparently. This feature required building MRPT with yaml-cpp, and is provided by CConfigFileMemory::setContentFromYAML().
See: config_file_format
Note
YAML support was introduced in MRPT 1.9.9
Public Functions
-
CConfigFileMemory()
Empty constructor. Upon construction, call any of the “setContent” method
-
CConfigFileMemory(const CConfigFileMemory&) = default
-
CConfigFileMemory &operator=(const CConfigFileMemory&) = default
-
CConfigFileMemory(CConfigFileMemory&&) = default
-
CConfigFileMemory &operator=(CConfigFileMemory&&) = default
-
CConfigFileMemory(const std::vector<std::string> &stringList)
Constructor and initialize from a list of strings
-
CConfigFileMemory(const std::string &str)
Constructor and initialize from string with the whole “config file”
-
~CConfigFileMemory() override
dtor
-
void setContent(const std::vector<std::string> &stringList)
Changes the contents of the virtual “config file”
-
void setContent(const std::string &str)
Changes the contents of the virtual “config file”
-
std::string getContent() const
Return the current contents of the virtual “config file”
-
virtual void clear() override
Empties the virtual “config file”
-
virtual void getAllSections(std::vector<std::string> §ions) const override
Returns a list with all the section names
-
virtual void getAllKeys(const std::string §ion, std::vector<std::string> &keys) const override
Returns a list with all the keys into a section
Protected Functions
-
virtual void writeString(const std::string §ion, const std::string &name, const std::string &str) override
A virtual method to write a generic string
-
virtual 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
-
CConfigFileMemory()