MRPT logo

mrpt::utils::CConfigFile Class Reference

This class allows loading and storing values and vectors of different types from ".ini" files easily. More...

#include <mrpt/utils/CConfigFile.h>

Inheritance diagram for mrpt::utils::CConfigFile:

mrpt::utils::CConfigFileBase

List of all members.

Public Member Functions

 CConfigFile (const std::string &fileName)
 Constructor.
virtual ~CConfigFile ()
 Destructor.
virtual void getAllSections (vector_string &sections) const
 Returns a list with all the section names.

Protected Member Functions

void writeString (const std::string &section, const std::string &name, const std::string &str)
 A virtual method to write a generic string.
std::string readString (const std::string &section, const std::string &name, const std::string &defaultStr, bool failIfNotFound=false) const
 A virtual method to read a generic string.

Private Attributes

std::string m_file
 The name of the file.
void_ptr_noncopy m_ini
 The interface to the file:.
bool m_modified
 If modified since load.


Detailed Description

This class allows loading and storing values and vectors of different types from ".ini" files easily.

The contents of the file will be modified by "write" operations in memory, and will be saved back to the file at the destructor, and only if at least one write operation has been applied.

Definition at line 47 of file CConfigFile.h.


Constructor & Destructor Documentation

mrpt::utils::CConfigFile::CConfigFile ( const std::string &  fileName  ) 

Constructor.

virtual mrpt::utils::CConfigFile::~CConfigFile (  )  [virtual]

Destructor.


Member Function Documentation

virtual void mrpt::utils::CConfigFile::getAllSections ( vector_string sections  )  const [virtual]

Returns a list with all the section names.

Implements mrpt::utils::CConfigFileBase.

std::string mrpt::utils::CConfigFile::readString ( const std::string &  section,
const std::string &  name,
const std::string &  defaultStr,
bool  failIfNotFound = false 
) const [protected, virtual]

A virtual method to read a generic string.

Exceptions:
std::exception If the key name is not found and "failIfNotFound" is true. Otherwise the "defaultValue" is returned.

Implements mrpt::utils::CConfigFileBase.

void mrpt::utils::CConfigFile::writeString ( const std::string &  section,
const std::string &  name,
const std::string &  str 
) [protected, virtual]

A virtual method to write a generic string.

Implements mrpt::utils::CConfigFileBase.


Member Data Documentation

std::string mrpt::utils::CConfigFile::m_file [private]

The name of the file.

Definition at line 52 of file CConfigFile.h.

The interface to the file:.

Definition at line 56 of file CConfigFile.h.

If modified since load.

Definition at line 60 of file CConfigFile.h.




Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:18:33 EST 2009