Crazy Eddies GUI System
0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIProperty.h 00003 created: 21/2/2004 00004 author: Paul D Turner 00005 00006 purpose: Defines the Property class which forms part of a 00007 PropertySet 00008 *************************************************************************/ 00009 /*************************************************************************** 00010 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining 00013 * a copy of this software and associated documentation files (the 00014 * "Software"), to deal in the Software without restriction, including 00015 * without limitation the rights to use, copy, modify, merge, publish, 00016 * distribute, sublicense, and/or sell copies of the Software, and to 00017 * permit persons to whom the Software is furnished to do so, subject to 00018 * the following conditions: 00019 * 00020 * The above copyright notice and this permission notice shall be 00021 * included in all copies or substantial portions of the Software. 00022 * 00023 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00024 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00025 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00026 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00027 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00028 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00029 * OTHER DEALINGS IN THE SOFTWARE. 00030 ***************************************************************************/ 00031 #ifndef _CEGUIProperty_h_ 00032 #define _CEGUIProperty_h_ 00033 00034 #include "CEGUIBase.h" 00035 #include "CEGUIString.h" 00036 #include "CEGUIXMLSerializer.h" 00037 00038 // Start of CEGUI namespace section 00039 namespace CEGUI 00040 { 00041 00046 class CEGUIEXPORT PropertyReceiver 00047 { 00048 public: 00049 PropertyReceiver() {} 00050 virtual ~PropertyReceiver() {} 00051 }; 00052 00053 00061 class CEGUIEXPORT Property 00062 { 00063 public: 00081 Property(const String& name, const String& help, const String& defaultValue = "", bool writesXML = true) : 00082 d_name(name), 00083 d_help(help), 00084 d_default(defaultValue), 00085 d_writeXML(writesXML) 00086 { 00087 } 00088 00089 00094 virtual ~Property(void) {} 00095 00096 00104 const String& getHelp(void) const {return d_help;} 00105 00106 00114 const String& getName(void) const {return d_name;} 00115 00116 00127 virtual String get(const PropertyReceiver* receiver) const = 0; 00128 00129 00145 virtual void set(PropertyReceiver* receiver, const String& value) = 0; 00146 00147 00159 virtual bool isDefault(const PropertyReceiver* receiver) const; 00160 00161 00172 virtual String getDefault(const PropertyReceiver* receiver) const; 00173 00174 00183 virtual void writeXMLToStream(const PropertyReceiver* receiver, XMLSerializer& xml_stream) const; 00184 00185 protected: 00186 String d_name; 00187 String d_help; 00188 String d_default; 00189 bool d_writeXML; 00190 }; 00191 00192 } // End of CEGUI namespace section 00193 00194 #endif // end of guard _CEGUIProperty_h_