A wrapper around the XmlRpcValue including a parent pointer and convenience functions for the qt model interface. More...
#include <xmlRpcTreeItem.h>
Public Member Functions | |
XmlRpcTreeItem * | child (unsigned int i) |
unsigned int | childCount () const |
int | childIndexOf (const XmlRpcTreeItem *child) const |
QVariant | data (int row, int column) const |
return the data in the map | |
bool | isBool (int row, int column) const |
is the stored data a bool | |
XmlRpcTreeItem * | parent () |
int | row () const |
Figure out which row/nth child we are for the parent. | |
bool | setData (QVariant val) |
set data for this item | |
XmlRpcTreeItem (XmlRpc::XmlRpcValue *data, XmlRpcTreeItem *parent, const std::string &path, ros::NodeHandle *nh) | |
~XmlRpcTreeItem () | |
Protected Member Functions | |
void | addChild (const std::string &name, XmlRpc::XmlRpcValue *childData) |
Create a child from its data. | |
void | createChildren () |
Create all children based on data. | |
void | setParam () |
write this XmlRpcValue to parameter server (for array childs). | |
QVariant | xmlToVariant (XmlRpc::XmlRpcValue &val) const |
Convert a XmlRpcValue to QVariant - only leaf values are supported. | |
Protected Attributes | |
deque< XmlRpcTreeItem * > | _children |
XmlRpc::XmlRpcValue * | _data |
ros::NodeHandle * | _nh |
XmlRpcTreeItem * | _parent |
std::string | _path |
A wrapper around the XmlRpcValue including a parent pointer and convenience functions for the qt model interface.
There are two kinds of item: If the xmlrpcvalue is a map, this will be a real tree item with children. Otherwise it will be a leaf node only storing the value. The tree is build from the internal XmlRpcValue's maps.
Corresponding model indices should always refer to the parent item in its internal pointer.
A Model index consisting of an internal pointer (XmlRpcTreeItem) and index (row, col) refers to: The row'th child of the internal pointer. (col 0 = name, col 1 = value).
Definition at line 51 of file xmlRpcTreeItem.h.
XmlRpcTreeItem::XmlRpcTreeItem | ( | XmlRpc::XmlRpcValue * | data, |
XmlRpcTreeItem * | parent, | ||
const std::string & | path, | ||
ros::NodeHandle * | nh | ||
) |
[in] | path | the path in the parameter server to this item |
Definition at line 32 of file xmlRpcTreeItem.cpp.
Definition at line 41 of file xmlRpcTreeItem.cpp.
void XmlRpcTreeItem::addChild | ( | const std::string & | name, |
XmlRpc::XmlRpcValue * | childData | ||
) | [protected] |
Create a child from its data.
Definition at line 347 of file xmlRpcTreeItem.cpp.
XmlRpcTreeItem* XmlRpcTreeItem::child | ( | unsigned int | i | ) | [inline] |
Definition at line 64 of file xmlRpcTreeItem.h.
unsigned int XmlRpcTreeItem::childCount | ( | ) | const |
Children are either from the struct and thus real children or from the array and thus contained in the array in _data.
Definition at line 52 of file xmlRpcTreeItem.cpp.
int XmlRpcTreeItem::childIndexOf | ( | const XmlRpcTreeItem * | child | ) | const |
Definition at line 60 of file xmlRpcTreeItem.cpp.
void XmlRpcTreeItem::createChildren | ( | ) | [protected] |
Create all children based on data.
Definition at line 332 of file xmlRpcTreeItem.cpp.
QVariant XmlRpcTreeItem::data | ( | int | row, |
int | column | ||
) | const |
return the data in the map
Definition at line 137 of file xmlRpcTreeItem.cpp.
bool XmlRpcTreeItem::isBool | ( | int | row, |
int | column | ||
) | const |
is the stored data a bool
Definition at line 172 of file xmlRpcTreeItem.cpp.
XmlRpcTreeItem* XmlRpcTreeItem::parent | ( | ) | [inline] |
Definition at line 61 of file xmlRpcTreeItem.h.
int XmlRpcTreeItem::row | ( | ) | const |
Figure out which row/nth child we are for the parent.
Definition at line 72 of file xmlRpcTreeItem.cpp.
bool XmlRpcTreeItem::setData | ( | QVariant | val | ) |
set data for this item
Definition at line 204 of file xmlRpcTreeItem.cpp.
void XmlRpcTreeItem::setParam | ( | ) | [protected] |
write this XmlRpcValue to parameter server (for array childs).
Definition at line 323 of file xmlRpcTreeItem.cpp.
QVariant XmlRpcTreeItem::xmlToVariant | ( | XmlRpc::XmlRpcValue & | val | ) | const [protected] |
Convert a XmlRpcValue to QVariant - only leaf values are supported.
Definition at line 82 of file xmlRpcTreeItem.cpp.
deque<XmlRpcTreeItem*> XmlRpcTreeItem::_children [protected] |
Definition at line 104 of file xmlRpcTreeItem.h.
XmlRpc::XmlRpcValue* XmlRpcTreeItem::_data [protected] |
Definition at line 96 of file xmlRpcTreeItem.h.
ros::NodeHandle* XmlRpcTreeItem::_nh [protected] |
Definition at line 102 of file xmlRpcTreeItem.h.
XmlRpcTreeItem* XmlRpcTreeItem::_parent [protected] |
Definition at line 98 of file xmlRpcTreeItem.h.
std::string XmlRpcTreeItem::_path [protected] |
Definition at line 100 of file xmlRpcTreeItem.h.