|
Graphite Version 3
An experimental 3D geometry processing program
|
Represents a list of name-value pairs. More...
#include <OGF/gom/types/arg_list.h>
Public Member Functions | |
| ArgList () | |
| ArgList constructor. | |
| ArgList (const ArgList &rhs) | |
| ArgList copy-constructor. | |
| ArgList & | operator= (const ArgList &rhs) |
| ArgList assignment operator. | |
| index_t | nb_args () const |
| Gets the number of arguments. | |
| bool | has_unnamed_args () const |
| Tests whether this ArgList has unnamed args. | |
| bool | has_arg (const std::string &name) const |
| Tests whether an argument of a given name exists in this ArgList. | |
| index_t | find_arg_index (const std::string &name) const |
| Finds argument index by name. | |
| void | delete_ith_arg (index_t index) |
| Deletes an argument by index. | |
| const std::string & | ith_arg_name (index_t i) const |
| Gets argument name by index. | |
| template<class T > | |
| T | ith_arg_value (index_t i) const |
| Gets argument value by index. | |
| const Any & | ith_arg_value (index_t i) const |
| Gets argument value by index, stored as an Any. | |
| Any & | ith_arg_value (index_t i) |
| Gets argument value by index, stored as an Any. | |
| const Any & | arg_value (const std::string &name) const |
| Gets argument value by name, stored as an Any. | |
| Any & | arg_value (const std::string &name) |
| Gets argument value by name, stored as an Any. | |
| MetaType * | ith_arg_type (index_t i) const |
| Gets the type of an argument by index. | |
| Any & | create_arg (const std::string &name) |
| Creates an uninitialized argument. | |
| Any & | create_unnamed_arg () |
| Creates an uninitialized unnamed argument. | |
| template<class T > | |
| void | create_arg (const std::string &name, const T &value) |
| Creates an argument. | |
| void | create_arg (const std::string &name, const char *value) |
| Creates an argument from a string litteral. | |
| void | create_arg (const std::string &name, const Any &value) |
| Creates an argument from an Any. | |
| template<class T > | |
| void | set_arg (const std::string &name, const T &value) |
| Sets an argument. | |
| void | set_arg (const std::string &name, const char *value) |
| Sets an argument from a string litteral. | |
| void | set_arg (const std::string &name, const Any &value) |
| Sets an argument from an Any. | |
| template<class T > | |
| void | set_ith_arg (index_t i, const T &value) |
| Sets an argument by index. | |
| void | set_ith_arg (index_t i, const char *value) |
| Sets an argument by index. | |
| std::string | get_arg (const std::string &name) const |
| Gets a string representation of an argument. | |
| template<class T > | |
| T | get_arg (const std::string &name) const |
| Gets an argument by name. | |
| MetaType * | get_arg_type (const std::string &name) const |
| Gets the type of an argument. | |
| void | clear () |
| Removes all the arguments from this ArgList. | |
| void | append (const ArgList &rhs, bool overwrite=true) |
| Appends all the arguments from an ArgList to this one. | |
| void | append_ith_arg (const ArgList &rhs, index_t i, bool overwrite=true) |
| Appends an argument from an ArgList to this one. | |
| void | serialize (std::ostream &out) const |
| void | arg_type_error (index_t i, const std::string &expected_typeid_name) const |
| Displays an error message for invalid argument type. | |
Static Public Member Functions | |
| template<class T > | |
| static bool | get_name (const Any &argval, T &name) |
| Converts a pointer to Object into a string using its name attribute if target type is a xxxName. | |
| static bool | get_object_name (const Any &object, Any &name) |
| Gets the name of an object. | |
Represents a list of name-value pairs.
Definition at line 65 of file arg_list.h.
|
inline |
ArgList constructor.
Definition at line 72 of file arg_list.h.
|
inline |
ArgList copy-constructor.
| [in] | rhs | a const reference to the ArgList to be copied |
Definition at line 81 of file arg_list.h.
| void OGF::ArgList::append | ( | const ArgList & | rhs, |
| bool | overwrite = true |
||
| ) |
Appends an argument from an ArgList to this one.
| [in] | rhs | a const reference to the ArgList to be appened |
| [in] | i | the index of the argument to append |
| [in] | overwrite | if true, the argument in rhs that have the same name as the argument in this ArgList overwrites the previous values, else the previous value remain unchanged |
i < rhs.nb_args() | void OGF::ArgList::arg_type_error | ( | index_t | i, |
| const std::string & | expected_typeid_name | ||
| ) | const |
Displays an error message for invalid argument type.
| [in] | i | the index of the concerned argument. |
| [in] | expected_typeid_name | the typeid name that corresponds to the expected type (that we did not have). |
|
inline |
Gets argument value by name, stored as an Any.
| [in] | name | the name of the argument |
i, wrapped in an Any. Definition at line 235 of file arg_list.h.
|
inline |
Gets argument value by name, stored as an Any.
| [in] | name | the name of the argument |
i, wrapped in an Any. Definition at line 222 of file arg_list.h.
|
inline |
Removes all the arguments from this ArgList.
Definition at line 440 of file arg_list.h.
|
inline |
Creates an uninitialized argument.
| [in] | name | a const reference to the name of the argument. |
Definition at line 259 of file arg_list.h.
|
inline |
Creates an argument from an Any.
| [in] | name | a const reference to the name of the argument |
| [in] | value | an Any with the value |
Definition at line 310 of file arg_list.h.
|
inline |
Creates an argument from a string litteral.
| [in] | name | a const reference to the name of the argument |
| [in] | value | a const pointer to a string |
Definition at line 298 of file arg_list.h.
|
inline |
Creates an argument.
| [in] | name | a const reference to the name of the argument |
| [in] | value | a const reference to the value of the argument |
| T | the type of the argument |
Definition at line 283 of file arg_list.h.
|
inline |
Creates an uninitialized unnamed argument.
Definition at line 271 of file arg_list.h.
|
inline |
Deletes an argument by index.
| [in] | index | the index of the argument to be deleted |
i < nb_args() Definition at line 147 of file arg_list.h.
| index_t OGF::ArgList::find_arg_index | ( | const std::string & | name | ) | const |
Finds argument index by name.
| [in] | name | a const reference to the name |
name if it exists or index_t(-1) if there is no such argument
|
inline |
Gets a string representation of an argument.
| [in] | name | the name of the argument |
Definition at line 396 of file arg_list.h.
|
inline |
Gets an argument by name.
If the stored argument is of type T, then it is retreived directly, else it is converted using a temporary string representation.
| [in] | name | the name of the argument |
| T | the type of the argument |
Definition at line 412 of file arg_list.h.
|
inline |
Gets the type of an argument.
| [in] | name | the name of the argument |
Definition at line 431 of file arg_list.h.
|
inlinestatic |
Converts a pointer to Object into a string using its name attribute if target type is a xxxName.
Used by the mechanism that lets one pass Object* to functions that take ObjectNames
| [in] | argval | the stored value |
| [out] | name | the name to be read |
| true | if argval is a pointer to Object that has a name attribute and name's type is a xxxName |
| false | otherwise |
Definition at line 492 of file arg_list.h.
Gets the name of an object.
Used by the mechanism that lets one pass Object* to functions that take ObjectNames
| [in] | object | an Any with a pointer to the object |
| [out] | name | an Any with the name of the object |
| true | if object has a pointer to an Object that has a name property |
| false | otherwise |
|
inline |
Tests whether an argument of a given name exists in this ArgList.
| [in] | name | a const reference to the name of the argument |
| true | if this ArgList has an argument with name name |
| false | otherwise |
Definition at line 129 of file arg_list.h.
|
inline |
Tests whether this ArgList has unnamed args.
| true | if this ArgList has unnamed args |
| false | otherwise |
Definition at line 108 of file arg_list.h.
|
inline |
Gets argument name by index.
| [in] | i | the index of the argument |
i i < nb_args() Definition at line 160 of file arg_list.h.
Gets the type of an argument by index.
| [in] | i | the index of the argument |
i < nb_args() Definition at line 248 of file arg_list.h.
Gets argument value by index, stored as an Any.
| [in] | i | the index of the argument |
i, wrapped in an Any. i < nb_args() Definition at line 209 of file arg_list.h.
|
inline |
Gets argument value by index.
If the stored argument is of type T, then it is retreived directly, else it is converted using a temporary string representation.
| [in] | i | the index of the argument |
i | T | the type of the argument to be retreived |
i < nb_args() Definition at line 176 of file arg_list.h.
Gets argument value by index, stored as an Any.
| [in] | i | the index of the argument |
i, wrapped in an Any. i < nb_args() Definition at line 196 of file arg_list.h.
|
inline |
Gets the number of arguments.
Definition at line 99 of file arg_list.h.
ArgList assignment operator.
| [in] | rhs | a const reference to the ArgList to be copied |
Definition at line 89 of file arg_list.h.
|
inline |
Sets an argument from an Any.
If the argument already exists, then its value is replaced with the new value, else a new argument is created.
| [in] | name | a const reference to the name of the argument |
| [in] | value | the value as an Any. |
Definition at line 359 of file arg_list.h.
|
inline |
Sets an argument from a string litteral.
If the argument already exists, then its value is replaced with the new value, else a new argument is created.
| [in] | name | a const reference to the name of the argument |
| [in] | value | a const pointer to a string |
Definition at line 346 of file arg_list.h.
|
inline |
Sets an argument.
If the argument already exists, then its value is replaced with the new value, else a new argument is created.
| [in] | name | a const reference to the name of the argument |
| [in] | value | a const reference to the value of the argument |
| T | the type of the argument |
Definition at line 327 of file arg_list.h.
|
inline |
Sets an argument by index.
The name of the argument is kept.
| [in] | i | the index of the argument |
| [in] | value | the value of the argument as a string litteral |
Definition at line 386 of file arg_list.h.
|
inline |
Sets an argument by index.
The name of the argument is kept.
| [in] | i | the index of the argument |
| [in] | value | a const reference to the value of the argument |
| T | the type of the argument |
Definition at line 375 of file arg_list.h.