ObjectType Class Reference

Symbol representing a class of objects that are to be parsed in the same way. More...

#include <objecttype.h>

List of all members.

Public Member Functions

 ObjectType ()
 Construct a type with the null type template.
 ObjectType (const ObjectTypeTemplate &typeTemplate)
 Construct a type with the type template given.
const ObjectTypeTemplatetypeTemplate () const
 Get the type template the type implements.
const VariantparameterValue (size_t index) const
 Get the value of a parameter by its index.
bool parameterSpecified (size_t index) const
 Check if a parameter is non-null.
void setParameter (size_t index, const Variant &value)
 Set the value of a parameter.
const std::string & name () const
 Get type name (by default template's name)
void setName (const std::string &name)
template<typename... Args>
void setParameters (Args...args)
 Set a value for the first parameters.
const ObjectTypeimportParameters (const ObjectType &other)
 Set the parameters not specified (i.e. with a null value) with the value of the other type's parameter with the same name.
bool isNull () const
 Check if the type template is null.
bool extendsDirectly (const ObjectType &other) const
 Check if the other type has the same type template and that the value for all of the parameters specified by the other type are the same.
const VariantelementType () const
 Used to know if the object should be displayed as an Array/Tuple and what type to display if so.
void setElementType (const ObjectType &type)
const VariantelementCount () const
 Used to know if the object should be displayed as a Tuple (if the elementType is also not NULL) and what value is to be displayed for count if so.
void setElementCount (long long count)
std::ostream & display (std::ostream &out) const
 Output a representation of the type into a stream.
int numberOfParameters () const
int numberOfDisplayableParameters () const
ObjectTypeoperator= (ObjectType other)

Friends

class AbstractTypeScope
void swap (ObjectType &a, ObjectType &b)

Detailed Description

Symbol representing a class of objects that are to be parsed in the same way.

The modules use the object's type and its inheritence model for types to generate parser.

A type is defined by a type template and values stored as variants specified for some of its parameters. The easiest way to construct a type is to use the type template's operator().


Constructor & Destructor Documentation

Construct a type with the null type template.

ObjectType::ObjectType ( const ObjectTypeTemplate typeTemplate)

Construct a type with the type template given.

The parameters are set to the null variant, and can be set to other values subsequently.


Member Function Documentation

std::ostream& ObjectType::display ( std::ostream &  out) const

Output a representation of the type into a stream.

Same effect as <<

Used to know if the object should be displayed as a Tuple (if the elementType is also not NULL) and what value is to be displayed for count if so.

const Variant& ObjectType::elementType ( ) const

Used to know if the object should be displayed as an Array/Tuple and what type to display if so.

bool ObjectType::extendsDirectly ( const ObjectType other) const

Check if the other type has the same type template and that the value for all of the parameters specified by the other type are the same.

The type can have however parameters specified that are not by the other.

This function define the basis of extension for two types with the same type template.

Set the parameters not specified (i.e. with a null value) with the value of the other type's parameter with the same name.

bool ObjectType::isNull ( ) const

Check if the type template is null.

const std::string& ObjectType::name ( ) const

Get type name (by default template's name)

ObjectType& ObjectType::operator= ( ObjectType  other)
bool ObjectType::parameterSpecified ( size_t  index) const

Check if a parameter is non-null.

const Variant& ObjectType::parameterValue ( size_t  index) const

Get the value of a parameter by its index.

Raise an exception if out of bound

void ObjectType::setElementCount ( long long  count)
void ObjectType::setElementType ( const ObjectType type)
void ObjectType::setName ( const std::string &  name)
void ObjectType::setParameter ( size_t  index,
const Variant value 
)

Set the value of a parameter.

Raise an exception if out of bound

template<typename... Args>
void ObjectType::setParameters ( Args...  args) [inline]

Set a value for the first parameters.

Get the type template the type implements.

Returns:

Friends And Related Function Documentation

friend class AbstractTypeScope [friend]
void swap ( ObjectType a,
ObjectType b 
) [friend]

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