Crazy Eddie's GUI System
0.8.7
|
31 #ifndef _CEGUITypedProperty_h_
32 #define _CEGUITypedProperty_h_
34 #include "CEGUI/Property.h"
35 #include "CEGUI/PropertyHelper.h"
36 #include "CEGUI/Exceptions.h"
49 class TypedProperty :
public Property
52 typedef PropertyHelper<T> Helper;
56 TypedProperty(
const String& name,
const String& help,
const String& origin =
"Unknown",
typename Helper::pass_type defaultValue = T(),
bool writesXML =
true):
57 Property(name, help, Helper::toString(defaultValue), writesXML, Helper::getDataTypeName(), origin)
60 virtual ~TypedProperty()
64 virtual String
get(
const PropertyReceiver* receiver)
const
66 return Helper::toString(
getNative(receiver));
70 virtual void set(PropertyReceiver* receiver,
const String& value)
72 setNative(receiver, Helper::fromString(value));
83 setNative_impl(receiver,value);
92 virtual typename Helper::safe_method_return_type
getNative(
const PropertyReceiver* receiver)
const{
94 return getNative_impl(receiver);
96 CEGUI_THROW(InvalidRequestException(String(
"Property ") +
d_origin +
":" +
d_name+
" is not readable!"));
99 virtual void setNative_impl(PropertyReceiver* receiver,
typename Helper::pass_type value) = 0;
100 virtual typename Helper::safe_method_return_type getNative_impl(
const PropertyReceiver* receiver)
const = 0;
105 #endif // end of guard _CEGUITypedProperty_h_
Exception class used when some impossible request was made of the system.
Definition: Exceptions.h:326
virtual Helper::safe_method_return_type getNative(const PropertyReceiver *receiver) const
native get method, returns the native type by copy
Definition: TypedProperty.h:142
virtual bool isReadable() const
Returns whether the property is readable.
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
String d_name
String that stores the Property name.
Definition: Property.h:267
virtual void setNative(PropertyReceiver *receiver, typename Helper::pass_type value)
native set method, sets the property given a native type
Definition: TypedProperty.h:130
virtual String get(const PropertyReceiver *receiver) const
Return the current value of the Property as a String.
Definition: TypedProperty.h:114
virtual bool isWritable() const
Returns whether the property is writable.
virtual void set(PropertyReceiver *receiver, const String &value)
Sets the value of the property.
Definition: TypedProperty.h:120
String class used within the GUI system.
Definition: String.h:83
Property(const String &name, const String &help, const String &defaultValue="", bool writesXML=true, const String &dataType="Unknown", const String &origin="Unknown")
Definition: Property.h:114
Dummy base class to ensure correct casting of receivers.
Definition: Property.h:68
String d_origin
Holds origin of this property.
Definition: Property.h:274