Crazy Eddies GUI System: CEGUIProperty.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# CEGUIProperty.h

    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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00011     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00012
    00013     This library is free software; you can redistribute it and/or
    00014     modify it under the terms of the GNU Lesser General Public
    00015     License as published by the Free Software Foundation; either
    00016     version 2.1 of the License, or (at your option) any later version.
    00017
    00018     This library is distributed in the hope that it will be useful,
    00019     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00020     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00021     Lesser General Public License for more details.
    00022
    00023     You should have received a copy of the GNU Lesser General Public
    00024     License along with this library; if not, write to the Free Software
    00025     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00026 *************************************************************************/
    00027 #ifndef _CEGUIProperty_h_
    00028 #define _CEGUIProperty_h_
    00029
    00030 #include "CEGUIBase.h"
    00031 #include "CEGUIString.h"
    00032
    00033
    00034 // Start of CEGUI namespace section
    00035 namespace CEGUI
    00036 {
    00037
    00042 class CEGUIEXPORT PropertyReceiver
    00043 {
    00044 public:
    00045         PropertyReceiver() {}
    00046         virtual ~PropertyReceiver() {}
    00047 };
    00048
    00049
    00057 class CEGUIEXPORT Property
    00058 {
    00059 public:
    00077         Property(const String& name, const String& help, const String& defaultValue = "", bool writesXML = true) :
    00078           d_name(name),
    00079           d_help(help),
    00080           d_default(defaultValue),
    00081           d_writeXML(writesXML)
    00082         {
    00083         }
    00084
    00085
    00090         virtual ~Property(void) {}
    00091
    00092
    00100         const String& getHelp(void) const               {return d_help;}
    00101
    00102
    00110         const String& getName(void) const               {return d_name;}
    00111
    00112
    00123         virtual String  get(const PropertyReceiver* receiver) const = 0;
    00124
    00125
    00141         virtual void    set(PropertyReceiver* receiver, const String& value) = 0;
    00142
    00143
    00155         virtual bool    isDefault(const PropertyReceiver* receiver) const;
    00156
    00157
    00168         virtual String  getDefault(const PropertyReceiver* receiver) const;
    00169
    00170
    00179     void writeXMLToStream(const PropertyReceiver* receiver, OutStream& out_stream) const;
    00180
    00181 protected:
    00182         String  d_name;
    00183         String  d_help;
    00184         String  d_default;
    00185         bool    d_writeXML;
    00186 };
    00187
    00188 } // End of  CEGUI namespace section
    00189
    00190 #endif  // end of guard _CEGUIProperty_h_