source: OGRE/trunk/ogrenew/Dependencies/include/CEGUI/CEGUIProperty.h @ 657

Revision 657, 4.5 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/************************************************************************
2        filename:       CEGUIProperty.h
3        created:        21/2/2004
4        author:         Paul D Turner
5       
6        purpose:        Defines the Property class which forms part of a
7                                PropertySet
8*************************************************************************/
9/*************************************************************************
10    Crazy Eddie's GUI System (http://www.cegui.org.uk)
11    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
12
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2.1 of the License, or (at your option) any later version.
17
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    Lesser General Public License for more details.
22
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26*************************************************************************/
27#ifndef _CEGUIProperty_h_
28#define _CEGUIProperty_h_
29
30#include "CEGUIBase.h"
31#include "CEGUIString.h"
32
33
34// Start of CEGUI namespace section
35namespace CEGUI
36{
37
38/*!
39\brief
40        Dummy base class to ensure correct casting of receivers.
41*/
42class CEGUIEXPORT PropertyReceiver
43{
44public:
45        PropertyReceiver() {}
46        virtual ~PropertyReceiver() {}
47};
48
49
50/*!
51\brief
52        An abstract class that defines the interface to access object properties by name.
53
54        Property objects allow (via a PropertySet) access to certain properties of objects
55        by using simple get/set functions and the name of the property to be accessed.
56*/
57class CEGUIEXPORT Property
58{
59public:
60        /*!
61        \brief
62                Creates a new Property object.
63
64        \param name
65                String containing the name of the new Property.
66
67        \param help
68                String containing a description of the Property and it's usage.
69               
70        \param defaultValue
71                String holding the textual representation of the default value for this Property
72        */
73        Property(const String& name, const String& help, const String& defaultValue = "") :
74          d_name(name),
75          d_help(help),
76          d_default(defaultValue)
77        {
78        }
79
80
81        /*!
82        \brief
83                Destructor for Property objects
84        */
85        virtual ~Property(void) {}
86
87
88        /*!
89        \brief
90                Return a String that describes the purpose and usage of this Property.
91
92        \return
93                String that contains the help text
94        */
95        const String& getHelp(void) const               {return d_help;}
96
97
98        /*!
99        \brief
100                Return a the name of this Property
101
102        \return
103                String containing the name of the Property
104        */
105        const String& getName(void) const               {return d_name;}
106
107
108        /*!
109        \brief
110                Return the current value of the Property as a String
111
112        \param receiver
113                Pointer to the target object.
114
115        \return
116                String object containing a textual representation of the current value of the Property
117        */
118        virtual String  get(const PropertyReceiver* receiver) const = 0;
119
120
121        /*!
122        \brief
123                Sets the value of the property
124
125        \param receiver
126                Pointer to the target object.
127
128        \param value
129                A String object that contains a textual representation of the new value to assign to the Property.
130
131        \return
132                Nothing.
133
134        \exception InvalidRequestException      Thrown when the Property was unable to interpret the content of \a value.
135        */
136        virtual void    set(PropertyReceiver* receiver, const String& value) = 0;
137
138
139        /*!
140        \brief
141                Returns whether the property is at it's default value.
142
143        \param receiver
144                Pointer to the target object.
145
146        \return
147                - true if the property has it's default value.
148                - false if the property has been modified from it's default value.
149        */
150        virtual bool    isDefault(const PropertyReceiver* receiver) const;
151
152
153        /*!
154        \brief
155                Returns the default value of the Property as a String.
156
157        \param receiver
158                Pointer to the target object.
159
160        \return
161                String object containing a textual representation of the default value for this property.
162        */
163        virtual String  getDefault(const PropertyReceiver* receiver) const;
164
165protected:
166        String  d_name;         //!< String that stores the Property name.
167        String  d_help;         //!< String that stores the Property help text.
168        String  d_default;      //!< String that stores the Property default value string.
169};
170
171} // End of  CEGUI namespace section
172
173#endif  // end of guard _CEGUIProperty_h_
Note: See TracBrowser for help on using the repository browser.