|
Geogram Version 1.10.1
A programming library of geometric algorithms
|
A parsed argument list in a .csg file. More...
#include <geogram/mesh/mesh_CSG_utils.h>
Public Types | |
| typedef std::pair< std::string, Value > | Arg |
Public Member Functions | |
| ArgList () | |
| Constructs an empty ArgList. | |
| void | clear () |
| Removes all the arguments in this arglist. | |
| index_t | size () const |
| Gets the number of arguments. | |
| const std::string & | ith_arg_name (index_t i) const |
| Gets the name of an argument. | |
| const Value & | ith_arg_val (index_t i) const |
| Gets the value of an argument. | |
| bool | has_arg (const std::string &name, index_t pos_fallback=NO_INDEX, Value::Type type=Value::NONE) const |
| Tests whether this arglist has an argument. | |
| void | add_arg (const std::string &name, const Value &value) |
| const Value & | get_arg_value (const std::string &name, index_t pos_fallback=NO_INDEX) const |
| Gets an argument value. | |
| double | get_arg (const std::string &name, double default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type double. | |
| int | get_arg (const std::string &name, int default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type int. | |
| bool | get_arg (const std::string &name, bool default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type bool. | |
| vec2 | get_arg (const std::string &name, vec2 default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type vec2. | |
| vec3 | get_arg (const std::string &name, vec3 default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type vec3. | |
| vec4 | get_arg (const std::string &name, vec4 default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type vec4. | |
| mat4 | get_arg (const std::string &name, const mat4 &default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type mat4. | |
| std::string | get_arg (const std::string &name, const std::string &default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type string. | |
| std::string | get_arg (const std::string &name, const char *default_val, index_t pos_fallback=NO_INDEX) const |
| Gets an argument of type string. | |
Static Protected Member Functions | |
| static std::string | unnamed_arg_name (index_t i) |
| Gets the internal name used for an unnamed argument. | |
A parsed argument list in a .csg file.
Stores name-value pairs.
Definition at line 84 of file mesh_CSG_utils.h.
| typedef std::pair<std::string, Value> GEOCSG::ArgList::Arg |
Definition at line 86 of file mesh_CSG_utils.h.
|
inline |
Removes all the arguments in this arglist.
Definition at line 96 of file mesh_CSG_utils.h.
| bool GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| bool | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type bool.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
|
inline |
Gets an argument of type string.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value, as a const char* |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
Definition at line 317 of file mesh_CSG_utils.h.
| mat4 GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| const mat4 & | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type mat4.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| std::string GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| const std::string & | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type string.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| double GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| double | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type double.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| int GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| int | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type int.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| vec2 GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| vec2 | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type vec2.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| vec3 GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| vec3 | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type vec3.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| vec4 GEOCSG::ArgList::get_arg | ( | const std::string & | name, |
| vec4 | default_val, | ||
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument of type vec4.
| [in] | name | the name of the argument |
| [in] | default_val | default argument value |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| the | value of the argument if present in the argument list by name or by positional fallback |
p default_val otherwise
fires a std::logic_error exception if argument exists but has incorrect type
| const Value & GEOCSG::ArgList::get_arg_value | ( | const std::string & | name, |
| index_t | pos_fallback = NO_INDEX |
||
| ) | const |
Gets an argument value.
| [in] | name | the name of the argument |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
fires an assertion failure if name is not bound and pos_fallback is NO_INDEX or greater and equal to size()
| bool GEOCSG::ArgList::has_arg | ( | const std::string & | name, |
| index_t | pos_fallback = NO_INDEX, |
||
| Value::Type | type = Value::NONE |
||
| ) | const |
Tests whether this arglist has an argument.
| [in] | name | the name of the argument |
| [in] | pos_fallback | a position fallback to be used if the arglist has no argument with name, or NO_INDEX if no positional fallback is specified |
| [in] | type | required type for the argument, or NONE if any type matches |
| true | if an argument with name exists or pos_fallback is different from NO_INDEX and smaller than size() |
| false | otherwise |
|
inline |
Gets the name of an argument.
| [in] | i | the index of the argument, in 0..size()-1 |
i th argument Definition at line 113 of file mesh_CSG_utils.h.
Gets the value of an argument.
| [in] | i | the index of the argument, in 0..size()-1 |
Definition at line 123 of file mesh_CSG_utils.h.
|
inline |
Gets the number of arguments.
Definition at line 104 of file mesh_CSG_utils.h.
|
inlinestaticprotected |
Gets the internal name used for an unnamed argument.
| [in] | i | the index for the i-th unnamed argument |
Definition at line 330 of file mesh_CSG_utils.h.