31 #include <boost/tokenizer.hpp>
34 #include "exceptions/WPropertyUnknown.h"
36 #include "WPropertyHelper.h"
38 #include "WPropertyGroup.h"
60 return boost::shared_ptr< WPropertyGroup >(
new WPropertyGroup( *
this ) );
89 template<
typename T >
90 T _addDefaultConstraints( T prop )
104 WPropSelection _addDefaultConstraints( WPropSelection prop )
119 WPropFilename _addDefaultConstraints( WPropFilename prop )
134 template<
typename T >
135 T addDefaultConstraints( T prop )
137 if( prop->getPurpose() == PV_PURPOSE_INFORMATION )
142 return _addDefaultConstraints( prop );
156 return set( v, std::vector< std::string >(), recommendedOnly );
159 bool WPropertyGroup::set( boost::shared_ptr< WPropertyGroup > value, std::vector< std::string > exclude,
bool recommendedOnly )
161 return setImpl( value,
"", exclude, recommendedOnly );
164 bool WPropertyGroup::setImpl( boost::shared_ptr< WPropertyGroup > value, std::string path, std::vector< std::string > exclude,
bool recommendedOnly )
185 completePath = ( *it )->getName();
189 if( std::find( exclude.begin(), exclude.end(), completePath ) != exclude.end() )
198 if( inputAsGroup && meAsGroup )
201 c += meAsGroup->setImpl( inputAsGroup, completePath, exclude, recommendedOnly );
203 else if( inputAsGroup || meAsGroup )
209 c += prop->set( *it, recommendedOnly );
215 return ( c == r->get().size() );
227 l->get().erase( std::remove( l->get().begin(), l->get().end(), prop ), l->get().end() );
233 WPropGroup p = WPropGroup(
new WPropertyGroup( name, description ) );
234 p->setHidden( hide );
254 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_BOOL >( name, description, initial, hide ) );
259 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_INT >( name, description, initial, hide ) );
264 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_DOUBLE >( name, description, initial, hide ) );
269 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_STRING >( name, description, initial, hide ) );
274 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_PATH >( name, description, initial, hide ) );
279 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_SELECTION >( name, description, initial, hide ) );
284 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, hide ) );
289 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, hide ) );
294 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_TRIGGER >( name, description, initial, hide ) );
305 boost::shared_ptr< WCondition > condition,
bool hide )
307 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_BOOL >( name, description, initial, condition, hide ) );
311 boost::shared_ptr< WCondition > condition,
bool hide )
313 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_INT >( name, description, initial, condition, hide ) );
317 boost::shared_ptr< WCondition > condition,
bool hide )
319 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_DOUBLE >( name, description, initial, condition, hide ) );
323 boost::shared_ptr< WCondition > condition,
bool hide )
325 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_STRING >( name, description, initial, condition, hide ) );
329 boost::shared_ptr< WCondition > condition,
bool hide )
331 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_PATH >( name, description, initial, condition, hide ) );
335 boost::shared_ptr< WCondition > condition,
bool hide )
337 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_SELECTION >( name, description, initial, condition, hide ) );
341 boost::shared_ptr< WCondition > condition,
bool hide )
343 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, condition, hide ) );
347 boost::shared_ptr< WCondition > condition,
bool hide )
349 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, condition, hide ) );
353 boost::shared_ptr< WCondition > condition,
bool hide )
355 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_TRIGGER >( name, description, initial, condition, hide ) );
368 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_BOOL >( name, description, initial, notifier, hide ) );
374 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_INT >( name, description, initial, notifier, hide ) );
380 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_DOUBLE >( name, description, initial, notifier, hide ) );
386 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_STRING >( name, description, initial, notifier, hide ) );
392 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_PATH >( name, description, initial, notifier, hide ) );
398 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_SELECTION >( name, description, initial, notifier, hide ) );
404 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, notifier, hide ) );
410 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, notifier, hide ) );
416 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_TRIGGER >( name, description, initial, notifier, hide ) );
428 boost::shared_ptr< WCondition > condition,
431 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_BOOL >( name, description, initial, condition, notifier, hide ) );
435 boost::shared_ptr< WCondition > condition,
438 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_INT >( name, description, initial, condition, notifier, hide ) );
442 boost::shared_ptr< WCondition > condition,
445 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_DOUBLE >( name, description, initial, condition, notifier, hide ) );
449 boost::shared_ptr< WCondition > condition,
452 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_STRING >( name, description, initial, condition, notifier, hide ) );
456 boost::shared_ptr< WCondition > condition,
459 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_PATH >( name, description, initial, condition, notifier, hide ) );
463 boost::shared_ptr< WCondition > condition,
466 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_SELECTION >( name, description, initial, condition, notifier, hide ) );
470 boost::shared_ptr< WCondition > condition,
473 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_POSITION >( name, description, initial, condition, notifier, hide ) );
477 boost::shared_ptr< WCondition > condition,
480 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_COLOR >( name, description, initial, condition, notifier, hide ) );
484 boost::shared_ptr< WCondition > condition,
487 return addDefaultConstraints( addProperty< WPVBaseTypes::PV_TRIGGER >( name, description, initial, condition, notifier, hide ) );
boost::shared_ptr< WSharedObjectTicketWrite< PropertyContainerType > > WriteTicket
Type for write tickets.
int32_t PV_INT
base type used for every WPVInt
boost::filesystem::path PV_PATH
base type used for every WPVFilename
virtual PROPERTY_TYPE getType() const
Gets the real type of this instance.
virtual ~WPropertyGroup()
destructor
virtual bool setImpl(boost::shared_ptr< WPropertyGroup > value, std::string path="", std::vector< std::string > exclude=std::vector< std::string >(), bool recommendedOnly=false)
This function implements the set functionality.
boost::function< void(boost::shared_ptr< WPropertyBase >)> PropertyChangeNotifierType
Signal signature emitted during set operations.
WPropertyGroup(std::string name="unnamed group", std::string description="an unnamed group of properties")
Constructor.
virtual void clear()
Removes all properties from the list.
This only is a 3d double vector.
PropertySharedContainerType m_properties
The set of proerties.
void removeProperty(boost::shared_ptr< WPropertyBase > prop)
Remove the specified property from the list.
double PV_DOUBLE
base type used for every WPVDouble
WriteTicket getWriteTicket(bool suppressNotify=false) const
Returns a ticket to get write access to the contained data.
boost::shared_ptr< WConditionSet > m_updateCondition
Condition notified whenever something changes.
virtual bool set(boost::shared_ptr< WPropertyBase > value, bool recommendedOnly=false)
Sets the value from the specified property to this one.
Class to manage properties of an object and to provide convenience methods for easy access and manipu...
std::string PV_STRING
base type used for every WPVString
This class represents a subset of a WItemSelection.
This is the base class and interface for property groups.
virtual boost::shared_ptr< WPropertyBase > clone()
This method clones a property and returns the clone.
void addTo(WPropSelection prop)
Add the PC_NOTEMPTY constraint to the property.
PV_TRIGGER
Enum denoting the possible trigger states.
bool PV_BOOL
base type used for every WPVBool
WColor PV_COLOR
base type used for every WPVColor
boost::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a boost::shared_ptr< WPropertyBase >
boost::shared_ptr< WPropertyGroup > SPtr
shared pointer to object of this type
PropType addProperty(PropType prop)
Insert the specified property into the list.
WPropGroup addPropertyGroup(std::string name, std::string description, bool hide=false)
Create and add a new property group.
static const std::string separator
The separator used to separate groups and subgroups.
virtual boost::shared_ptr< WPropertyBase > findProperty(std::string name) const
Searches the property with a given name.
void addTo(WPropSelection prop)
Add the PC_ISVALID constraint to the property.
virtual std::string getAsString()
Returns the current value as a string.
PropertyContainerType::const_iterator PropertyConstIterator
The const iterator type of the container.
virtual bool setAsString(std::string value)
This methods allows properties to be set by a string value.
boost::shared_ptr< WSharedObjectTicketRead< PropertyContainerType > > ReadTicket
Type for read tickets.