Gorgon Game Engine
Parameter Class Reference

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 TypeGetType () 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...
 
Parameteroperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Parameter()

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().

Member Function Documentation

◆ AllowsNull()

bool AllowsNull ( ) const

If true, a null reference can be passed to this parameter.

◆ GetDefaultValue()

Data GetDefaultValue ( ) const

Returns the default value for this parameter.

References ASSERT.

◆ GetHelp()

std::string GetHelp ( ) const

Returns the help related with this parameter.

◆ GetName()

std::string GetName ( ) const

Returns the name of the parameter.

◆ GetType()

const Type& GetType ( ) const

Returns the type of the parameter.

◆ IsConstant()

bool IsConstant ( ) const

Checks if this parameter accepts a constant value.

◆ IsOptional()

bool IsOptional ( ) const

Checks if the parameter is optional.

◆ IsReference()

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.

◆ IsVariable()

bool IsVariable ( ) const

If true, this parameter is a variable and its name is given to the function as a string.

◆ operator=()

Parameter& operator= ( const Parameter p)

Copy assignment.

References Parameter::Options.

◆ operator==()

bool operator== ( const Parameter p) const

Compares two parameters, not very reliable, it does not check defaultvalue and options.

Member Data Documentation

◆ Options

OptionList Options

Allowed values for this parameter.


The documentation for this class was generated from the following files: