/usr/include/cegui-0.8.4/CEGUI/Property.h is in libcegui-mk2-dev 0.8.4+dfsg-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | /***********************************************************************
created: 21/2/2004
author: Paul D Turner
purpose: Defines the Property class which forms part of a
PropertySet
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIProperty_h_
#define _CEGUIProperty_h_
#include "CEGUI/Base.h"
#include "CEGUI/String.h"
#include "CEGUI/XMLSerializer.h"
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Dummy base class to ensure correct casting of receivers.
*/
class CEGUIEXPORT PropertyReceiver
{
public:
PropertyReceiver() {}
virtual ~PropertyReceiver() {}
};
/*!
\brief
An abstract class that defines the interface to access object properties by name.
Property objects allow (via a PropertySet) access to certain properties of objects
by using simple get/set functions and the name of the property to be accessed.
*/
class CEGUIEXPORT Property :
public AllocatedObject<Property>
{
public:
static const String XMLElementName;
static const String NameXMLAttributeName;
static const String ValueXMLAttributeName;
/*!
\brief
Creates a new Property object.
\param name
String containing the name of the new Property.
\param help
String containing a description of the Property and it's usage.
\param defaultValue
String holding the textual representation of the default value for this Property
\param writesXML
Specifies whether the writeXMLToStream method should do anything for this Property. This
enables selectivity in what properties within a PropertySet will get output as XML.
\param dataType
String representation of the data type this property is held in ("int", "UVector2", ...)
\param origin
String describing the origin class of this Property (Window, FrameWindow, ...)
*/
Property(const String& name, const String& help, const String& defaultValue = "", bool writesXML = true, const String& dataType = "Unknown", const String& origin = "Unknown") :
d_name(name),
d_help(help),
d_default(defaultValue),
d_writeXML(writesXML),
d_dataType(dataType),
d_origin(origin)
{}
/*!
\brief
Destructor for Property objects
*/
virtual ~Property(void) {}
/*!
\brief
Return a String that describes the purpose and usage of this Property.
\return
String that contains the help text
*/
const String& getHelp(void) const {return d_help;}
/*!
\brief
Return a the name of this Property
\return
String containing the name of the Property
*/
const String& getName(void) const {return d_name;}
/*!
\brief
Return string data type of this Property
\return
String containing the data type of the Property
*/
const String& getDataType(void) const {return d_dataType;}
/*!
\brief
Return string origin of this Property
\return
String containing the origin of the Property
*/
const String& getOrigin(void) const {return d_origin;}
/*!
\brief
Return the current value of the Property as a String
\param receiver
Pointer to the target object.
\return
String object containing a textual representation of the current value of the Property
*/
virtual String get(const PropertyReceiver* receiver) const = 0;
/*!
\brief
Sets the value of the property
\param receiver
Pointer to the target object.
\param value
A String object that contains a textual representation of the new value to assign to the Property.
\return
Nothing.
\exception InvalidRequestException Thrown when the Property was unable to interpret the content of \a value.
*/
virtual void set(PropertyReceiver* receiver, const String& value) = 0;
/*!
\brief
Returns whether the property is at it's default value.
\param receiver
Pointer to the target object.
\return
- true if the property has it's default value.
- false if the property has been modified from it's default value.
*/
virtual bool isDefault(const PropertyReceiver* receiver) const;
/*!
\brief
Returns the default value of the Property as a String.
\param receiver
Pointer to the target object.
\return
String object containing a textual representation of the default value for this property.
*/
virtual String getDefault(const PropertyReceiver* receiver) const;
/*!
\brief
Writes out an XML representation of this class to the given stream.
\note
This would normally have been implemented via XMLGenerator base class, but in this
case we require the target PropertyReceiver in order to obtain the property value.
*/
virtual void writeXMLToStream(const PropertyReceiver* receiver, XMLSerializer& xml_stream) const;
/*!
\brief
Returns whether the property is readable.
\return
- true if the property is readable.
- false if the property isn't readable.
*/
virtual bool isReadable() const;
/*!
\brief
Returns whether the property is writable.
\return
- true if the property is writable.
- false if the property isn't writable.
*/
virtual bool isWritable() const;
/*!
\brief
Returns whether the property writes to XML streams.
*/
virtual bool doesWriteXML() const;
//! function to allow initialisation of a PropertyReceiver.
virtual void initialisePropertyReceiver(PropertyReceiver* /*receiver*/) const {}
virtual Property* clone() const = 0;
protected:
String d_name; //!< String that stores the Property name.
String d_help; //!< String that stores the Property help text.
String d_default; //!< String that stores the Property default value string.
bool d_writeXML; //!< Specifies whether writeXMLToStream should do anything for this property.
// TODO: This is really ugly but PropertyDefinition forced me to do this to support operator=
String d_dataType; //!< Holds data type of this property
// TODO: This is really ugly but PropertyDefinition forced me to do this to support operator=
String d_origin; //!< Holds origin of this property
};
} // End of CEGUI namespace section
#endif // end of guard _CEGUIProperty_h_
|