25 #ifndef WPROPERTYBASE_H
26 #define WPROPERTYBASE_H
30 #include <boost/function.hpp>
31 #include <boost/signals2/signal.hpp>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/enable_shared_from_this.hpp>
36 #include "WProperties_Fwd.h"
37 #include "WCondition.h"
38 #include "WConditionSet.h"
44 class WPropertyBase:
public boost::enable_shared_from_this< WPropertyBase >
50 typedef boost::shared_ptr< WPropertyBase >
SPtr;
55 typedef boost::shared_ptr< const WPropertyBase >
ConstSPtr;
87 virtual boost::shared_ptr< WPropertyBase >
clone() = 0;
122 virtual PROPERTY_TYPE
getType()
const;
143 virtual void setPurpose( PROPERTY_PURPOSE purpose );
189 virtual bool set( boost::shared_ptr< WPropertyBase > value,
bool recommendedOnly =
false ) = 0;
298 template<
typename T >
356 template<
typename T >
362 #endif // WPROPERTYBASE_H
WPropTransferFunction toPropTransferFunction()
Helper converts this instance to its native type.
WPropMatrix4X4 toPropMatrix4X4()
Helper converts this instance to its native type.
WPropertyBase(std::string name, std::string description)
Create an empty named property.
boost::signals2::signal< void(boost::shared_ptr< WPropertyBase >)> PropertyChangeSignalType
Signal used for firing change signals.
virtual boost::shared_ptr< WCondition > getUpdateCondition() const
This method returns a condition which gets fired whenever the property changes somehow.
A named property class with a concrete type.
boost::shared_ptr< WPropertyVariable< T > > toPropertyVariable()
Helper converts this instance to an arbitrary type.
WPropSelection toPropSelection()
Helper converts this instance to its native type.
WPropColor toPropColor()
Helper converts this instance to its native type.
virtual ~WPropertyBase()
Destructor.
boost::shared_ptr< const WPropertyBase > ConstSPtr
Convenience typedef for a boost::shared_ptr< const WPropertyBase >
boost::function< void(boost::shared_ptr< WPropertyBase >)> PropertyChangeNotifierType
Signal signature emitted during set operations.
WPropTrigger toPropTrigger()
Helper converts this instance to its native type.
virtual void setPurpose(PROPERTY_PURPOSE purpose)
Sets the purpose of the property.
virtual PROPERTY_TYPE getType() const
Gets the real WPropertyVariable type of this instance.
PROPERTY_TYPE m_type
Type of the PropertyVariable instance.
WPropGroup toPropGroup()
Helper converts this instance to its native type.
WPropInt toPropInt()
Helper converts this instance to its native type.
boost::shared_ptr< WConditionSet > m_updateCondition
Condition notified whenever something changes.
boost::shared_ptr< WPropertyGroupBase > toPropGroupBase()
Convert the property to a WPropertyGroupBase.
virtual PROPERTY_PURPOSE getPurpose() const
Gets the purpose of a property.
std::string m_name
Name of the property.
virtual bool setAsString(std::string value)=0
This methods allows properties to be set by a string value.
virtual std::string getAsString()=0
Returns the current value as a string.
WPropDouble toPropDouble()
Helper converts this instance to its native type.
virtual bool set(boost::shared_ptr< WPropertyBase > value, bool recommendedOnly=false)=0
Sets the value from the specified property to this one.
bool m_hidden
Flag denoting whether the property is hidden or not.
PROPERTY_PURPOSE m_purpose
The purpose of this property.
WPropBool toPropBool()
Helper converts this instance to its native type.
std::string m_description
Description of the property.
void setHidden(bool hidden=true)
Sets the property hidden.
PropertyChangeSignalType signal_PropertyChange
Signal getting fired whenever the property changes.
Abstract base class for all properties.
virtual boost::shared_ptr< WPropertyBase > clone()=0
This method clones a property and returns the clone.
boost::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a boost::shared_ptr< WPropertyBase >
bool isHidden() const
Determines whether the property is hidden or not.
WPropFilename toPropFilename()
Helper converts this instance to its native type.
WPropInterval toPropInterval()
Helper converts this instance to its native type.
WPropPosition toPropPosition()
Helper converts this instance to its native type.
WPropString toPropString()
Helper converts this instance to its native type.
virtual void updateType()
Calculates the type of the property.
std::string getName() const
Gets the name of the class.
std::string getDescription() const
Gets the description of the property.