Helper class used to access contents of fields. More...
#include <InstantIO/FieldAccessor.h>
Public Types | |
typedef void(ClassType::* | SetMethod )(const ValueType &) |
Defines the method that sets the field value. | |
typedef ValueType(ClassType::* | GetMethod )() const |
Defines the method that returns the field value. | |
Public Member Functions | |
FieldAccessor (SetMethod setMethod, GetMethod getMethod) | |
Creates a new FieldAccessor object. | |
FieldAccessor (const FieldAccessor< ClassType, ValueType > &other) | |
Creates a new FieldAccessor object that is an exact copy of another FieldAccessor object. | |
virtual | ~FieldAccessor () |
Destroys the FieldAccessor object. | |
virtual void | set (Node &node, const std::string &value) const |
Sets the value of the field. | |
virtual std::string | get (const Node &node) const |
Returns the value of the field. | |
virtual bool | sameValue (const Node &node, const std::string &value) const |
Checks if a field is set to given value. | |
virtual BasicFieldAccessor * | clone () const |
Creates a copy a FieldAccessor object. |
Helper class used to access contents of fields.
InstantIO::FieldAccessor< ClassType, ValueType >::FieldAccessor | ( | SetMethod | setMethod, | |
GetMethod | getMethod | |||
) | [inline] |
Creates a new FieldAccessor object.
setMethod | Pointer to the method that sets the field value. | |
getMethod | Pointer to the method that returns the field value. |
InstantIO::FieldAccessor< ClassType, ValueType >::FieldAccessor | ( | const FieldAccessor< ClassType, ValueType > & | other | ) | [inline] |
Creates a new FieldAccessor object that is an exact copy of another FieldAccessor object.
other | The other FieldAccessor object. |
virtual void InstantIO::FieldAccessor< ClassType, ValueType >::set | ( | Node & | node, | |
const std::string & | value | |||
) | const [inline, virtual] |
Sets the value of the field.
node | The Node that contains the field. | |
value | The new value of the field. |
Implements InstantIO::BasicFieldAccessor.
virtual std::string InstantIO::FieldAccessor< ClassType, ValueType >::get | ( | const Node & | node | ) | const [inline, virtual] |
Returns the value of the field.
node | The Node that contains the field. |
Implements InstantIO::BasicFieldAccessor.
virtual bool InstantIO::FieldAccessor< ClassType, ValueType >::sameValue | ( | const Node & | node, | |
const std::string & | value | |||
) | const [inline, virtual] |
Checks if a field is set to given value.
node | The Node that contains the field. | |
value | The value we compare the field with. |
Implements InstantIO::BasicFieldAccessor.
virtual BasicFieldAccessor* InstantIO::FieldAccessor< ClassType, ValueType >::clone | ( | ) | const [inline, virtual] |
Creates a copy a FieldAccessor object.
Implements InstantIO::BasicFieldAccessor.