#include <TypeDef.hpp>
Public Types | |
using | Instantiator = Item *(*)() |
Public Member Functions | |
TypeDef () | |
TypeDef (const TypeDef &)=delete | |
PropertyDef & | addPropertyDef (string type, string name, string title) |
string | allowedIf () const |
string | base () const |
bool | concrete () const |
string | displayedIf () const |
string | insert () const |
Instantiator | instantiator () const |
string | name () const |
int | numSubProperties () const |
TypeDef & | operator= (const TypeDef &)=delete |
const std::list< PropertyDef > & | propertyDefs () const |
void | setAllowedIf (string allowedIf) |
void | setBase (string base) |
void | setConcrete () |
void | setDisplayedIf (string displayedIf) |
void | setInsert (string insert) |
void | setInstantiator (Instantiator instantiator) |
void | setName (string name) |
void | setSubPropertyIndex (int index) |
void | setSubPropertyIndexHere () |
void | setTitle (string title) |
int | subPropertyIndex () const |
string | title () const |
Private Attributes | |
string | _allowedIf |
string | _base |
bool | _concrete |
string | _displayedIf |
string | _insert |
Instantiator | _instantiator |
string | _name |
std::list< PropertyDef > | _propertyDefs |
int | _subPropertyIndex |
string | _title |
The TypeDef class represents a type definition in a SMILE schema. It is essentially a structure that offers setters and getters for its data members.
using TypeDef::Instantiator = Item* (*)() |
Type definition for a function that creates an instance of an Item subclass.
|
inline |
The default (and only) constructor trivially initializes the type definition to a blank state. All string fields are empty, there are no property definitions, and the type is considered to be abstract (i.e. not concrete). Use the setters to further initialize all relevant data members.
|
delete |
The copy constructor is deleted. TypeDef instances can't be copied or moved because of the PropertyDef instances they contain.
PropertyDef & TypeDef::addPropertyDef | ( | string | type, |
string | name, | ||
string | title | ||
) |
Add a new property definition to the list for this type with the given property type, name and title, and returns a reference to the newly constructed PropertyDef instance so that its further attributes can be initialized. Properties are stored in order of addition, which should correspond to the order of appearance in the schema definition. Ownership of the PropertyDef instance is passed to the receiving type definition.
|
inline |
Returns a Boolean expression that indicates whether items of the type are allowed. An empty string means always allowed.
|
inline |
Returns the name of the immediate base type, or the empty string for the root type.
|
inline |
Returns true if this is a concrete type, and false if this is an abstract type.
|
inline |
Returns a Boolean expression that indicates whether the type is displayed. An empty string means always displayed.
|
inline |
Returns a conditional value expression providing a list of extra names to be inserted in the global and/or local name set when an item of this type is added to the dataset, in addition to the names of the type and its ancestors. An empty string means that no extra names will be added.
|
inline |
Returns a pointer to the function that creates an instance of the Item subclass described by this type definition. This information is available only for concrete hardcoded classes. The function returns a null pointer when using ghost items or for hardcoded abstract classes).
|
inline |
Returns the name of the type.
|
inline |
Returns the number of properties defined for the type. Properties of base types are NOT counted towards this number.
The assignment operator is deleted. TypeDef instances can't be copied or moved because of the PropertyDef instances they contain.
|
inline |
Returns (a reference to a list of) the definitions of the type's properties, in order of appearance in the schema. Properties of base types are NOT included in the list.
|
inline |
Sets a Boolean expression that indicates whether items of the type are allowed. An empty string means always allowed.
|
inline |
Sets the name of the immediate base type (use the empty string for the root type).
|
inline |
Sets the flag indicating that this is a concrete type rather than an abstract type (which is the default).
|
inline |
Sets a Boolean expression that indicates whether items of the type are displayed. An empty string means always displayed.
|
inline |
Sets a conditional value expression providing a list of extra names to be inserted in the global and/or local name set when an item of this type is added to the dataset, in addition to the names of the type and its ancestors. An empty string means that no extra names will be added.
|
inline |
Sets a pointer to the function that creates an instance of the Item subclass described by this type definition. This information is set only for concrete hardcoded classes (i.e. not when using ghost items or for hardcoded abstract classes).
|
inline |
Sets the name of the type.
|
inline |
Sets the index in the property list where properties of subtypes should be listed. If the index is nonnegative, properties of subtypes must be listed just before the property with the specified index. If the index is negative, properties of subtypes must be listed after the properties of the base type. This is the default behavior if this function is never called.
|
inline |
Sets the index in the property list where properties of subtypes should be listed to the number of properties currently held by this type definition. This has the effect of listing properties of subtypes just before the next property added to the type definition (or at the end if no further properties are added).
|
inline |
Sets a description for the type that can be displayed to a user.
|
inline |
Returns the index in the property list where properties of subtypes should be listed. If the index is nonnegative, properties of subtypes must be listed just before the property with the specified index. If the index is negative, properties of subtypes must be listed after the properties of the base type (the default).
|
inline |
Returns a description for the type that can be displayed to a user.