OpenLexocad  27.1
Core::DynamicProperty Class Reference

#include <DynamicProperty.h>

Classes

struct  PropData
 

Public Member Functions

 DynamicProperty ()
 
virtual ~DynamicProperty ()
 
void clear ()
 Remove all properties. More...
 
size_t size () const
 Get property count. More...
 
void save (const Property *prop, Base::AbstractWriter &writer, Base::PersistenceVersion &version)
 
Propertyrestore (PropertyContainer &pc, const char *PropName, const char *TypeName, Base::AbstractXMLReader &reader, Base::PersistenceVersion &version)
 
PropData getDynamicPropertyData (const Property *prop) const
 
Access properties
void getPropertyList (std::vector< Property * > &List) const
 Get all properties of the class (including parent) More...
 
void getPropertyMap (std::map< std::string, Property * > &Map) const
 Get all properties of the class (including parent) More...
 
PropertygetDynamicPropertyByName (const char *name) const
 Find a dynamic property by its name. More...
 
PropertyaddDynamicProperty (PropertyContainer &pc, const char *type, const char *name=0, const char *group=0, const char *doc=0, short attr=0, bool ro=false, bool hidden=false)
 
bool addProperty (Property *prop)
 
bool removeDynamicProperty (const char *name)
 
bool removeProperty (const Property *prop)
 Remove pre-existing property, which will not be deleted. More...
 
std::vector< std::string > getDynamicPropertyNames () const
 Get a list of all dynamic properties. More...
 
const char * getPropertyName (const Property *prop) const
 Get the name of a property. More...
 
Property attributes
short getPropertyType (const Property *prop) const
 Get the attributes of a property. More...
 
short getPropertyType (const char *name) const
 Get the attributes of a named property. More...
 
const char * getPropertyGroup (const Property *prop) const
 Get the group name of a property. More...
 
const char * getPropertyGroup (const char *name) const
 Get the group name of a named property. More...
 
const char * getPropertyDocumentation (const Property *prop) const
 Get the documentation of a property. More...
 
const char * getPropertyDocumentation (const char *name) const
 Get the documentation of a named property. More...
 

Detailed Description

This class implements an interface to add properties at run-time to an object derived from PropertyContainer. The additional properties are made persistent.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ DynamicProperty()

Core::DynamicProperty::DynamicProperty ( )

◆ ~DynamicProperty()

virtual Core::DynamicProperty::~DynamicProperty ( )
virtual

Member Function Documentation

◆ addDynamicProperty()

Property* Core::DynamicProperty::addDynamicProperty ( PropertyContainer pc,
const char *  type,
const char *  name = 0,
const char *  group = 0,
const char *  doc = 0,
short  attr = 0,
bool  ro = false,
bool  hidden = false 
)

Add a dynamic property of the type type and with the name name. Group gives the grouping name which appears in the property editor and doc shows the tooltip there. With attr, ro and hidden the behaviour of the property can be controlled. attr is an OR'ed value of the PropertyType enumeration. If no special attribute should be set Prop_None can be set (or leave the default of 0). For convenience the attributes for 'Read-Only' and 'Hidden' can also be controlled with the values ro or hidden. This means,

addDynamicProperty(..., ..., "Base","blah", Prop_ReadOnly | Prop_Hidden);

is equivalent to

addDynamicProperty(..., ..., "Base","blah", Prop_None, true, true);

◆ addProperty()

bool Core::DynamicProperty::addProperty ( Property prop)

Add a pre-existing property

The property is not treated as dynamic, and will not trigger signal.

Returns
Return false if there is a property exist with the same name.

◆ clear()

void Core::DynamicProperty::clear ( )

Remove all properties.

◆ getDynamicPropertyByName()

Property* Core::DynamicProperty::getDynamicPropertyByName ( const char *  name) const

Find a dynamic property by its name.

◆ getDynamicPropertyData()

PropData Core::DynamicProperty::getDynamicPropertyData ( const Property prop) const

◆ getDynamicPropertyNames()

std::vector<std::string> Core::DynamicProperty::getDynamicPropertyNames ( ) const

Get a list of all dynamic properties.

◆ getPropertyDocumentation() [1/2]

const char* Core::DynamicProperty::getPropertyDocumentation ( const Property prop) const

Get the documentation of a property.

◆ getPropertyDocumentation() [2/2]

const char* Core::DynamicProperty::getPropertyDocumentation ( const char *  name) const

Get the documentation of a named property.

◆ getPropertyGroup() [1/2]

const char* Core::DynamicProperty::getPropertyGroup ( const Property prop) const

Get the group name of a property.

◆ getPropertyGroup() [2/2]

const char* Core::DynamicProperty::getPropertyGroup ( const char *  name) const

Get the group name of a named property.

◆ getPropertyList()

void Core::DynamicProperty::getPropertyList ( std::vector< Property * > &  List) const

Get all properties of the class (including parent)

◆ getPropertyMap()

void Core::DynamicProperty::getPropertyMap ( std::map< std::string, Property * > &  Map) const

Get all properties of the class (including parent)

◆ getPropertyName()

const char* Core::DynamicProperty::getPropertyName ( const Property prop) const

Get the name of a property.

◆ getPropertyType() [1/2]

short Core::DynamicProperty::getPropertyType ( const Property prop) const

Get the attributes of a property.

◆ getPropertyType() [2/2]

short Core::DynamicProperty::getPropertyType ( const char *  name) const

Get the attributes of a named property.

◆ removeDynamicProperty()

bool Core::DynamicProperty::removeDynamicProperty ( const char *  name)

Removes a dynamic property by name. Returns true if the property is part of the container, otherwise false is returned.

◆ removeProperty()

bool Core::DynamicProperty::removeProperty ( const Property prop)

Remove pre-existing property, which will not be deleted.

◆ restore()

Property* Core::DynamicProperty::restore ( PropertyContainer pc,
const char *  PropName,
const char *  TypeName,
Base::AbstractXMLReader reader,
Base::PersistenceVersion version 
)

◆ save()

void Core::DynamicProperty::save ( const Property prop,
Base::AbstractWriter writer,
Base::PersistenceVersion version 
)

◆ size()

size_t Core::DynamicProperty::size ( ) const

Get property count.


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