29 #ifndef _CEGUIPropertySet_h_
30 #define _CEGUIPropertySet_h_
32 #include "CEGUI/Base.h"
33 #include "CEGUI/String.h"
34 #include "CEGUI/IteratorBase.h"
35 #include "CEGUI/Property.h"
36 #include "CEGUI/PropertyHelper.h"
37 #include "CEGUI/TypedProperty.h"
40 #include "CEGUI/TplWindowProperty.h"
41 #include "CEGUI/Exceptions.h"
45 # pragma warning(push)
46 # pragma warning(disable : 4251)
107 class CEGUIEXPORT PropertySet :
public PropertyReceiver
121 virtual ~PropertySet(
void) {}
138 void addProperty(Property* property);
148 void removeProperty(
const String& name);
161 Property* getPropertyInstance(
const String& name)
const;
168 void clearProperties(
void);
181 bool isPropertyPresent(
const String& name)
const;
196 const String& getPropertyHelp(
const String& name)
const;
211 String getProperty(
const String& name)
const;
220 typename PropertyHelper<T>::return_type getProperty(
const String& name)
const
222 PropertyRegistry::const_iterator pos = d_properties.find(name);
224 if (pos == d_properties.end())
226 CEGUI_THROW(UnknownObjectException(
"There is no Property named '" + name +
"' available in the set."));
229 Property* baseProperty = pos->second;
230 TypedProperty<T>* typedProperty =
dynamic_cast<TypedProperty<T>*
>(baseProperty);
235 return typedProperty->getNative(
this);
240 return PropertyHelper<T>::fromString(baseProperty->get(
this));
257 void setProperty(
const String& name,
const String& value);
266 void setProperty(
const String& name,
typename PropertyHelper<T>::pass_type value)
268 PropertyRegistry::iterator pos = d_properties.find(name);
270 if (pos == d_properties.end())
275 Property* baseProperty = pos->second;
286 baseProperty->
set(
this, PropertyHelper<T>::toString(value));
301 bool isPropertyDefault(
const String& name)
const;
314 String getPropertyDefault(
const String& name)
const;
317 typedef std::map<String, Property*, StringFastLessCompare
319 PropertyRegistry d_properties;
352 #define CEGUI_DEFINE_PROPERTY(class_type, property_native_type, name, help, setter, getter, default_value)\
354 static ::CEGUI::TplWindowProperty<class_type, property_native_type> sProperty(\
355 name, help, propertyOrigin, setter, getter, default_value);\
357 this->addProperty(&sProperty);\
381 #define CEGUI_DEFINE_PROPERTY_NO_XML(class_type, property_native_type, name, help, setter, getter, default_value)\
383 static ::CEGUI::TplWindowProperty<class_type, property_native_type> sProperty(\
384 name, help, propertyOrigin, setter, getter, default_value, false);\
386 this->addProperty(&sProperty);\
391 #if defined(_MSC_VER)
392 # pragma warning(pop)
395 #endif // end of guard _CEGUIPropertySet_h_