Crazy Eddies GUI System  0.7.2
CEGUIProperty.h
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  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _CEGUIProperty_h_
32 #define _CEGUIProperty_h_
33 
34 #include "CEGUIBase.h"
35 #include "CEGUIString.h"
36 #include "CEGUIXMLSerializer.h"
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
41 
46 class CEGUIEXPORT PropertyReceiver
47 {
48 public:
49  PropertyReceiver() {}
50  virtual ~PropertyReceiver() {}
51 };
52 
53 
61 class CEGUIEXPORT Property
62 {
63 public:
81  Property(const String& name, const String& help, const String& defaultValue = "", bool writesXML = true) :
82  d_name(name),
83  d_help(help),
84  d_default(defaultValue),
85  d_writeXML(writesXML)
86  {
87  }
88 
89 
94  virtual ~Property(void) {}
95 
96 
104  const String& getHelp(void) const {return d_help;}
105 
106 
114  const String& getName(void) const {return d_name;}
115 
116 
127  virtual String get(const PropertyReceiver* receiver) const = 0;
128 
129 
145  virtual void set(PropertyReceiver* receiver, const String& value) = 0;
146 
147 
159  virtual bool isDefault(const PropertyReceiver* receiver) const;
160 
161 
172  virtual String getDefault(const PropertyReceiver* receiver) const;
173 
174 
183  virtual void writeXMLToStream(const PropertyReceiver* receiver, XMLSerializer& xml_stream) const;
184 
185 protected:
189  bool d_writeXML;
190 };
191 
192 } // End of CEGUI namespace section
193 
194 #endif // end of guard _CEGUIProperty_h_