Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Types | Private Attributes
jafar::kernel::KeyValueFile Class Reference

Read a file containing simple key value statements. More...


Detailed Description

Read a file containing simple key value statements.

Definition at line 20 of file keyValueFile.hpp.

#include <keyValueFile.hpp>

List of all members.

Public Member Functions

 KeyValueFile (std::string const &keyValueSeparator_=":", char commentPrefix_= '#')
void readFile (std::string const &filename)
 Parse file filename for key:value pairs.
void writeFile (std::string const &filename)
 Write file filename with key:value pairs.
bool hasKey (std::string const &key) const
template<class T >
void getItem (std::string const &key, T &value) const
 get the value of item key.
template<class T >
void getItem (std::string const &key, T &value, std::string default_value) const
 get the value of item key with default value if does not exist
template<class T >
void setItem (std::string const &key, const T &value)
 set the value of item key.

Private Types

typedef std::map< std::string,
std::string > 
KeyValueMap

Private Attributes

std::string keyValueSeparator
 Key value separators, default to ":".
char commentPrefix
KeyValueMap keyValue

Member Function Documentation

void jafar::kernel::KeyValueFile::writeFile ( std::string const &  filename)

Write file filename with key:value pairs.

The current date is added in comment at the top of the file.

Warning:
There is no control on the write process, the keys are written in lexical order.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:40 for Jafar by doxygen 1.7.6.1
LAAS-CNRS