$search
#include <config.h>
Classes | |
class | DirectoryCompare |
Public Types | |
typedef Map::iterator | Iterator |
typedef std::map< std::string, std::string, DirectoryCompare > | Map |
Public Member Functions | |
Iterator | begin () |
void | clear () |
Iterator | end () |
bool | get (const std::string &key, int *output, int default_value=0) |
bool | get (const std::string &key, float *output, float default_value=0) |
bool | get (const std::string &key, std::string *output, const std::string &default_value="") |
void | read (std::istream &input) |
bool | readFromFile (const std::string &filename) |
void | set (const std::string &key, int value) |
void | set (const std::string &key, float value) |
void | set (const std::string &key, const std::string &value) |
void | unset (const std::string &key) |
void | write (std::ostream &output) |
bool | writeToFile (const std::string &filename) |
Private Member Functions | |
std::string | escapeKey (const std::string &raw_key) |
const std::string | stripFirstSlash (const std::string &str) |
std::string | unescapeKey (const std::string &cooked_key) |
void | writeDirectory (std::ostream &output, const std::string &new_dir, const std::string &prev_dir) |
Private Attributes | |
Map | map_ |
Configuration data structure. Inspired by rviz's use of wxConfigBase. Current implementation uses a flat ordered map, but in the long run it may more sense to use a recursive data structure.
Definition at line 44 of file config.h.
typedef Map::iterator rviz::Config::Iterator |
typedef std::map<std::string, std::string, DirectoryCompare> rviz::Config::Map |
std::string rviz::Config::escapeKey | ( | const std::string & | raw_key | ) | [private] |
Escape ' ' and ':' characters with '\'.
Definition at line 201 of file config.cpp.
bool rviz::Config::get | ( | const std::string & | key, | |
int * | output, | |||
int | default_value = 0 | |||
) |
Definition at line 294 of file config.cpp.
bool rviz::Config::get | ( | const std::string & | key, | |
float * | output, | |||
float | default_value = 0 | |||
) |
Definition at line 277 of file config.cpp.
bool rviz::Config::get | ( | const std::string & | key, | |
std::string * | output, | |||
const std::string & | default_value = "" | |||
) |
Definition at line 265 of file config.cpp.
void rviz::Config::read | ( | std::istream & | input | ) |
Read settings from a stream. Invalid lines are ignored.
Definition at line 68 of file config.cpp.
bool rviz::Config::readFromFile | ( | const std::string & | filename | ) |
Definition at line 38 of file config.cpp.
void rviz::Config::set | ( | const std::string & | key, | |
int | value | |||
) |
Definition at line 258 of file config.cpp.
void rviz::Config::set | ( | const std::string & | key, | |
float | value | |||
) |
Definition at line 251 of file config.cpp.
void rviz::Config::set | ( | const std::string & | key, | |
const std::string & | value | |||
) | [inline] |
const std::string rviz::Config::stripFirstSlash | ( | const std::string & | str | ) | [private] |
If the first char of str is a '/', return everything but the first char in a new string. If it is not, return str.
Definition at line 311 of file config.cpp.
std::string rviz::Config::unescapeKey | ( | const std::string & | cooked_key | ) | [private] |
Un-escape ' ' and ':' characters with '\'.
Definition at line 224 of file config.cpp.
void rviz::Config::unset | ( | const std::string & | key | ) | [inline] |
void rviz::Config::write | ( | std::ostream & | output | ) |
Write settings to a stream.
Definition at line 110 of file config.cpp.
void rviz::Config::writeDirectory | ( | std::ostream & | output, | |
const std::string & | new_dir, | |||
const std::string & | prev_dir | |||
) | [private] |
Write a directory description of new_dir to output, given that we were previously "in" prev_dir.
Definition at line 165 of file config.cpp.
bool rviz::Config::writeToFile | ( | const std::string & | filename | ) |
Definition at line 53 of file config.cpp.
Map rviz::Config::map_ [private] |