tue_config
|
#include <reader_writer.h>
Public Member Functions | |
bool | addArrayItem () |
addArrayItem create a new item in the array More... | |
void | addError (const std::string &msg) |
DataPointer | data () const |
data get the data from the current reading/writing point More... | |
bool | endArray () |
endArray go to parrent of current array, wrapping end() for readibility More... | |
bool | endArrayItem () |
endArrayItem go back to the array level More... | |
bool | endGroup () |
endGroup go to the parrent of current group, wrapping end() for readbility More... | |
const std::string & | error () const |
bool | hasArray (const std::string &name) |
hasArray check if current node has a child, which is an array, with the key 'name' More... | |
bool | hasError () const |
bool | hasGroup (const std::string &name) |
hasGroup check if current node has a child, which is a group, with the key 'name' More... | |
ReaderWriter | limitScope () const |
limitScope Limit the data to the current position. All parents and siblings incl. their child aren't accesible anymore. More... | |
bool | loadFromSDFFile (const std::string &filename) |
loadFromSDFFile loads a sdf file into a ReaderWriter class More... | |
bool | loadFromXMLFile (const std::string &filename) |
loadFromXMLFile loads a xml file into a ReaderWriter class More... | |
bool | loadFromYAMLFile (const std::string &filename, const ResolveConfig &resolve_config=ResolveConfig::defaultConfig()) |
loadFromYAMLFile loads a yaml file into a ReaderWriter class More... | |
bool | nextArrayItem () |
nextArrayItem go to the next item in the array, wrapping next() for readbility More... | |
bool | readArray (const std::string &name, const RequiredOrOptional opt=OPTIONAL) |
readArray read the child with key 'name', which should be an array More... | |
ReaderWriter () | |
ReaderWriter (DataPointer &cfg) | |
bool | readGroup (const std::string &name, const RequiredOrOptional opt=OPTIONAL) |
readGroup read the child with key 'name', which should be a group More... | |
void | setErrorContext (const std::string &context) |
setErrorContext More... | |
void | setShortErrorContext (const std::string &context) |
setShortErrorContext More... | |
void | setSource (const std::string &source) |
setSource set the source file of the data in this object More... | |
template<typename T > | |
void | setValue (const std::string &name, const T &value) |
setValue set child value with key 'name' and value 'value' More... | |
void | setValue (const std::string &name, std::string value) |
setValue<string> set child value with key 'name' and value 'value', value is stripped from leading and trailing whitespace More... | |
const std::string & | source () const |
source get the source file of the data in this object More... | |
bool | sync () |
sync re-read the source file if the file has changed since last reading time. More... | |
std::string | toYAMLString () const |
toYAMLString convert data (from current reading/writing point) to yaml string More... | |
template<typename T > | |
bool | value (const std::string &name, T &value, RequiredOrOptional opt=REQUIRED) |
value read value of child with key 'name' More... | |
bool | writeArray (const std::string &name) |
writeArray starts writing an array. Or start extending it, if it already exists. More... | |
bool | writeGroup (const std::string &name) |
writeGroup starts writing a group. Or start extending it, if it already exists. More... | |
virtual | ~ReaderWriter () |
Private Member Functions | |
bool | end () |
end go to parent node. More... | |
bool | hasChild (const std::string &name, NodeType type) const |
hasChild check if node has a child with key 'name' and type ARRAY or MAP More... | |
bool | next () |
next go to next item in an array More... | |
bool | read (const std::string &name, const NodeType type, RequiredOrOptional opt=OPTIONAL) |
read read child with key 'name' of type ARRAY or MAP More... | |
Private Attributes | |
boost::shared_ptr< Data > | cfg_ |
boost::shared_ptr< Error > | error_ |
boost::shared_ptr< std::string > | error_context_ |
std::string | filename_ |
NodeIdx | idx_ |
ResolveConfig | resolve_config_ |
NodeIdx | scope_ |
std::time_t | source_last_write_time_ |
Friends | |
std::ostream & | operator<< (std::ostream &out, const ReaderWriter &rw) |
operator << stream operator More... | |
Definition at line 26 of file reader_writer.h.
tue::config::ReaderWriter::ReaderWriter | ( | ) |
Definition at line 33 of file reader_writer.cpp.
tue::config::ReaderWriter::ReaderWriter | ( | DataPointer & | cfg | ) |
Definition at line 39 of file reader_writer.cpp.
|
virtual |
Definition at line 50 of file reader_writer.cpp.
bool tue::config::ReaderWriter::addArrayItem | ( | ) |
addArrayItem create a new item in the array
Definition at line 223 of file reader_writer.cpp.
void tue::config::ReaderWriter::addError | ( | const std::string & | msg | ) |
Definition at line 136 of file reader_writer.cpp.
|
inline |
data get the data from the current reading/writing point
Definition at line 249 of file reader_writer.h.
|
private |
end go to parent node.
Definition at line 78 of file reader_writer.cpp.
|
inline |
endArray go to parrent of current array, wrapping end() for readibility
Definition at line 98 of file reader_writer.h.
bool tue::config::ReaderWriter::endArrayItem | ( | ) |
endArrayItem go back to the array level
Definition at line 245 of file reader_writer.cpp.
|
inline |
endGroup go to the parrent of current group, wrapping end() for readbility
Definition at line 104 of file reader_writer.h.
|
inline |
Definition at line 208 of file reader_writer.h.
|
inline |
hasArray check if current node has a child, which is an array, with the key 'name'
name | key of the possible child array |
Definition at line 117 of file reader_writer.h.
|
private |
hasChild check if node has a child with key 'name' and type ARRAY or MAP
name | key of the child |
type | node type of the child, ARRAY or MAP |
Definition at line 122 of file reader_writer.cpp.
|
inline |
Definition at line 206 of file reader_writer.h.
|
inline |
hasGroup check if current node has a child, which is a group, with the key 'name'
name | key of the possible child group |
Definition at line 124 of file reader_writer.h.
ReaderWriter tue::config::ReaderWriter::limitScope | ( | ) | const |
limitScope Limit the data to the current position. All parents and siblings incl. their child aren't accesible anymore.
Definition at line 113 of file reader_writer.cpp.
bool tue::config::ReaderWriter::loadFromSDFFile | ( | const std::string & | filename | ) |
loadFromSDFFile loads a sdf file into a ReaderWriter class
filename | input file |
Definition at line 267 of file reader_writer.cpp.
bool tue::config::ReaderWriter::loadFromXMLFile | ( | const std::string & | filename | ) |
loadFromXMLFile loads a xml file into a ReaderWriter class
filename | input file |
Definition at line 286 of file reader_writer.cpp.
bool tue::config::ReaderWriter::loadFromYAMLFile | ( | const std::string & | filename, |
const ResolveConfig & | resolve_config = ResolveConfig::defaultConfig() |
||
) |
loadFromYAMLFile loads a yaml file into a ReaderWriter class
filename | input file |
Definition at line 305 of file reader_writer.cpp.
|
private |
next go to next item in an array
Definition at line 98 of file reader_writer.cpp.
|
inline |
nextArrayItem go to the next item in the array, wrapping next() for readbility
Definition at line 110 of file reader_writer.h.
|
private |
read read child with key 'name' of type ARRAY or MAP
name | key of the child |
type | node type of the child, ARRAY or MAP |
opt | RequiredOrOptional |
Definition at line 56 of file reader_writer.cpp.
|
inline |
readArray read the child with key 'name', which should be an array
name | key of the array |
opt | RequiredOrOptional |
Definition at line 84 of file reader_writer.h.
|
inline |
readGroup read the child with key 'name', which should be a group
name | key of the group |
opt | RequiredOrOptional |
Definition at line 92 of file reader_writer.h.
|
inline |
|
inline |
setShortErrorContext
context | context string |
Definition at line 261 of file reader_writer.h.
|
inline |
setSource set the source file of the data in this object
source | string of the source file |
Definition at line 193 of file reader_writer.h.
|
inline |
setValue set child value with key 'name' and value 'value'
name | name of the key |
value | value of the value |
Definition at line 155 of file reader_writer.h.
|
inline |
setValue<string> set child value with key 'name' and value 'value', value is stripped from leading and trailing whitespace
name | name of the key |
value | value of the value |
Definition at line 168 of file reader_writer.h.
|
inline |
source get the source file of the data in this object
Definition at line 130 of file reader_writer.h.
bool tue::config::ReaderWriter::sync | ( | ) |
sync re-read the source file if the file has changed since last reading time.
Definition at line 325 of file reader_writer.cpp.
std::string tue::config::ReaderWriter::toYAMLString | ( | ) | const |
toYAMLString convert data (from current reading/writing point) to yaml string
Definition at line 257 of file reader_writer.cpp.
|
inline |
value read value of child with key 'name'
name | name of the key |
value | object to write the value to |
opt | RequiredOrOptional |
Definition at line 47 of file reader_writer.h.
bool tue::config::ReaderWriter::writeArray | ( | const std::string & | name | ) |
writeArray starts writing an array. Or start extending it, if it already exists.
name | of the array |
Definition at line 202 of file reader_writer.cpp.
bool tue::config::ReaderWriter::writeGroup | ( | const std::string & | name | ) |
writeGroup starts writing a group. Or start extending it, if it already exists.
name | of the group |
Definition at line 181 of file reader_writer.cpp.
|
friend |
operator << stream operator
out | |
rw | ReaderWriter object |
Definition at line 361 of file reader_writer.cpp.
|
private |
Definition at line 301 of file reader_writer.h.
|
private |
Definition at line 303 of file reader_writer.h.
|
private |
Definition at line 305 of file reader_writer.h.
|
private |
Definition at line 310 of file reader_writer.h.
|
private |
Definition at line 297 of file reader_writer.h.
|
private |
Definition at line 314 of file reader_writer.h.
|
private |
Definition at line 299 of file reader_writer.h.
|
private |
Definition at line 312 of file reader_writer.h.