tue_config
Public Member Functions | Private Member Functions | Private Attributes | List of all members
tue::config::Writer Class Reference

#include <writer.h>

Public Member Functions

bool addArrayItem ()
 addArrayItem create a new item in the array More...
 
DataConstPointer 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...
 
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...
 
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...
 
 Writer ()
 
 Writer (DataPointer &cfg)
 
virtual ~Writer ()
 

Private Member Functions

bool end ()
 end go to parent node. More...
 

Private Attributes

boost::shared_ptr< Datacfg_
 
NodeIdx idx_
 

Detailed Description

Definition at line 12 of file writer.h.

Constructor & Destructor Documentation

◆ Writer() [1/2]

tue::config::Writer::Writer ( )

Definition at line 16 of file writer.cpp.

◆ Writer() [2/2]

tue::config::Writer::Writer ( DataPointer cfg)

Definition at line 23 of file writer.cpp.

◆ ~Writer()

tue::config::Writer::~Writer ( )
virtual

Definition at line 34 of file writer.cpp.

Member Function Documentation

◆ addArrayItem()

bool tue::config::Writer::addArrayItem ( )

addArrayItem create a new item in the array

Returns
indicates succes, can fail if current node isn't in an array

Definition at line 82 of file writer.cpp.

◆ data()

DataConstPointer tue::config::Writer::data ( ) const
inline

data get the data from the current reading/writing point

Returns
DataConstPointer

Definition at line 93 of file writer.h.

◆ end()

bool tue::config::Writer::end ( )
private

end go to parent node.

Returns
indicates succes, can fail if current node doesn't have a parent

Definition at line 104 of file writer.cpp.

◆ endArray()

bool tue::config::Writer::endArray ( )
inline

endArray go to parrent of current array, wrapping end() for readibility

Returns
indicates succes, see end() for more information

Definition at line 75 of file writer.h.

◆ endArrayItem()

bool tue::config::Writer::endArrayItem ( )
inline

endArrayItem go back to the array level

Returns
indicates succes, can fail if current node ins't an array item

Definition at line 87 of file writer.h.

◆ endGroup()

bool tue::config::Writer::endGroup ( )
inline

endGroup go to the parrent of current group, wrapping end() for readbility

Returns
indicates succes, see end() for more information

Definition at line 81 of file writer.h.

◆ setValue() [1/2]

template<typename T >
void tue::config::Writer::setValue ( const std::string name,
const T &  value 
)
inline

setValue set child value with key 'name' and value 'value'

Parameters
namename of the key
valuevalue of the value

Definition at line 49 of file writer.h.

◆ setValue() [2/2]

void tue::config::Writer::setValue ( const std::string name,
std::string  value 
)
inline

setValue<string> set child value with key 'name' and value 'value', value is stripped from leading and trailing whitespace

Parameters
namename of the key
valuevalue of the value

Definition at line 62 of file writer.h.

◆ writeArray()

bool tue::config::Writer::writeArray ( const std::string name)

writeArray starts writing an array. Or start extending it, if it already exists.

Parameters
nameof the array
Returns
indicates succes

Definition at line 61 of file writer.cpp.

◆ writeGroup()

bool tue::config::Writer::writeGroup ( const std::string name)

writeGroup starts writing a group. Or start extending it, if it already exists.

Parameters
nameof the group
Returns
indicates succes

Definition at line 40 of file writer.cpp.

Member Data Documentation

◆ cfg_

boost::shared_ptr<Data> tue::config::Writer::cfg_
private

Definition at line 105 of file writer.h.

◆ idx_

NodeIdx tue::config::Writer::idx_
private

Definition at line 103 of file writer.h.


The documentation for this class was generated from the following files: