![]() |
Gorgon Game Engine
|
This class represents a function parameter description. More...
Public Member Functions | |
template<class ... Params_> | |
Parameter (const std::string &name, const std::string &help, const Type *type, Data defaultvalue, OptionList options, Params_ ...tags) | |
Constructs a new parameter. More... | |
bool | AllowsNull () const |
If true, a null reference can be passed to this parameter. More... | |
Data | GetDefaultValue () const |
Returns the default value for this parameter. More... | |
std::string | GetHelp () const |
Returns the help related with this parameter. More... | |
std::string | GetName () const |
Returns the name of the parameter. More... | |
const Type & | GetType () const |
Returns the type of the parameter. More... | |
bool | IsConstant () const |
Checks if this parameter accepts a constant value. More... | |
bool | IsOptional () const |
Checks if the parameter is optional. More... | |
bool | IsReference () const |
Checks if the parameter is a reference. More... | |
bool | IsVariable () const |
If true, this parameter is a variable and its name is given to the function as a string. More... | |
Parameter & | operator= (const Parameter &p) |
Copy assignment. More... | |
bool | operator== (const Parameter &p) const |
Compares two parameters, not very reliable, it does not check defaultvalue and options. More... | |
Public Attributes | |
OptionList | Options |
Allowed values for this parameter. More... | |
This class represents a function parameter description.
Parameter is non-mutable after construction
A parameter can be controlled using tags. Parameters can have following tags:
OptionalTag: This parameter becomes an optional parameter. Optional parameters should either be at the beginning or end of the parameter list.
ReferenceTag: This parameter becomes bidirectional reference. That is, it needs to exist before the call to the function. The value of the parameter can be modified or left as is. Reference parameters are either passed as pointer or reference. A reference parameter can be Const as well.
ConstTag: This parameter is a constant and its value cannot be changed.
VariableTag: Marks this parameter as a variable. Useful to allow an undefined variable to be passed to the function.
AllowNullTag: Allows a parameter that requires a reference type to accept a Null value. Null values are dangerous when combined with references.
Parameter | ( | const std::string & | name, |
const std::string & | help, | ||
const Type * | type, | ||
Data | defaultvalue, | ||
OptionList | options, | ||
Params_ ... | tags | ||
) |
Constructs a new parameter.
All information regarding to a parameter should be specified in the constructor. After construction parameter is non-mutable. options, tags, and defaultvalue are optional
References ASSERT, Parameter::Options, and Gorgon::swap().
bool AllowsNull | ( | ) | const |
If true, a null reference can be passed to this parameter.
std::string GetHelp | ( | ) | const |
Returns the help related with this parameter.
std::string GetName | ( | ) | const |
Returns the name of the parameter.
const Type& GetType | ( | ) | const |
Returns the type of the parameter.
bool IsConstant | ( | ) | const |
Checks if this parameter accepts a constant value.
bool IsOptional | ( | ) | const |
Checks if the parameter is optional.
bool IsReference | ( | ) | const |
Checks if the parameter is a reference.
When a parameter is a reference, its passed as a reference or pointer. Therefore, this value can be changed. Literal values cannot be passed as references.
bool IsVariable | ( | ) | const |
If true, this parameter is a variable and its name is given to the function as a string.
Copy assignment.
References Parameter::Options.
bool operator== | ( | const Parameter & | p | ) | const |
Compares two parameters, not very reliable, it does not check defaultvalue and options.
OptionList Options |
Allowed values for this parameter.