Go to the documentation of this file.
96 if (type_ == new_type)
111 data_.value =
new QVariant;
153 for (
int i = 0; i < num_children; i++)
180 node_->setType(new_type);
204 (*
node_->data_.map).remove(key);
213 Node::ChildMap::const_iterator iter =
node_->data_.map->find(key);
214 if (iter ==
node_->data_.map->end())
220 return Config(iter.value());
238 if (
mapGetValue(key, &v) && (v.type() == QVariant::Int || v.type() == QVariant::String))
241 int i = v.toInt(&
ok);
254 if (
mapGetValue(key, &v) && (
int(v.type()) ==
int(QMetaType::Float) || v.type() == QVariant::Double ||
255 v.type() == QVariant::String))
258 float f = v.toFloat(&
ok);
264 QString as_string = v.toString();
266 QLocale german(QLocale::German);
267 f = german.toFloat(as_string, &
ok);
280 if (
mapGetValue(key, &v) && (v.type() == QVariant::Bool || v.type() == QVariant::String))
282 *value_out = v.toBool();
291 if (
mapGetValue(key, &v) && v.type() == QVariant::String)
293 *value_out = v.toString();
301 if (
node_.get() ==
nullptr)
309 return node_.get() !=
nullptr;
316 *
node_->data_.value = value;
331 if (
isValid() &&
node_->type_ ==
List && i >= 0 && i < node_->data_.list->size())
378 iterator_valid_ =
false;
381 if (!iterator_valid_)
383 iterator_ =
node_->data_.map->begin();
384 iterator_valid_ =
true;
396 iterator_valid_ =
false;
399 if (!iterator_valid_)
405 return iterator_ !=
node_->data_.map->end();
413 iterator_valid_ =
false;
416 iterator_ =
node_->data_.map->begin();
417 iterator_valid_ =
true;
424 iterator_valid_ =
false;
427 return iterator_.key();
434 iterator_valid_ =
false;
437 return Config(iterator_.value());
bool isValid() const
Returns true if the internal Node reference is valid, false if not. Same as (getType() !...
bool isValid()
Return true if the iterator currently points to a valid entry, false if not.
Config()
Default constructor. Creates an empty config object.
QList< NodePtr > ChildList
void setType(Config::Type new_type)
void start()
Resets the iterator to the start of the map.
int listLength() const
Returns the length of the List in this Node, or 0 if this Node does not have type List.
MapIterator()
Private constructor enforces that MapIterators are only made by their friend the Config class.
QString currentKey()
Return the name of the current map entry.
Type
Possible types a Config Node can have are Map, List, Value, and Empty. Invalid means the Config objec...
Config mapGetChild(const QString &key) const
If the referenced Node is a Map and it has a child with the given key, return a reference to the chil...
void makeValid()
If the node pointer is NULL, this sets it to a new empty node.
Config mapMakeChild(const QString &key)
Create a child node stored with the given key, and return the child.
bool mapGetValue(const QString &key, QVariant *value_out) const
Convenience function for looking up a named value.
Config listAppendNew()
Ensure the referenced Node is of type List, append a new Empty Node to the end of the list,...
bool mapGetBool(const QString &key, bool *value_out) const
Convenience function for looking up a named boolean.
void copy(const Config &source)
Make this a deep copy of source.
Type getType() const
Return the Type of the referenced Node, or Invalid if this Config does not refer to a Node at all.
Config listChildAt(int i) const
Return the i'th child in the list, if the referenced Node has type List. Returns an Invalid Config if...
Config currentChild()
Return a Config reference to the current map entry.
void setType(Type new_type)
Set the type of this Config Node.
bool mapGetString(const QString &key, QString *value_out) const
Convenience function for looking up a named string.
boost::shared_ptr< Node > NodePtr
bool mapGetInt(const QString &key, int *value_out) const
Convenience function for looking up a named integer.
union rviz::Config::Node::@0 data_
void mapRemoveChild(const QString &key)
Remove child node with given key from the Map.
Iterator class for looping over all entries in a Map type Config Node.
bool mapGetFloat(const QString &key, float *value_out) const
Convenience function for looking up a named float.
MapIterator mapIterator() const
Return a new iterator for looping over key/value pairs.
void advance()
Advance iterator to next entry.
void setValue(const QVariant &value)
Ensures this is a valid Config object, sets the type to Value then sets the value.
Configuration data storage class.
void mapSetValue(const QString &key, const QVariant &value)
Set a named child to the given value.
static Config invalidConfig()
QVariant getValue() const
If this config object is valid and is a Value type, this returns its value. Otherwise it returns an i...
QMap< QString, NodePtr > ChildMap
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:02