This file is indexed.

/usr/include/OGRE/Property/OgreProperty.h is in libogre-1.9-dev 1.9.0+dfsg1-4.

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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2013 Torus Knot Software Ltd

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 OR COPYRIGHT HOLDERS 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 __OGRE_PROPERTY_H__
#define __OGRE_PROPERTY_H__

#include "OgrePropertyPrerequisites.h"
#include "OgreAny.h"
#include "OgreIteratorWrappers.h"
#include "OgreString.h"
#include "OgreException.h"
#include "OgreVector2.h"
#include "OgreVector3.h"
#include "OgreVector4.h"
#include "OgreColourValue.h"
#include "OgreQuaternion.h"
#include "OgreMatrix3.h"
#include "OgreMatrix4.h"

#include <boost/bind.hpp>
#include <boost/function.hpp>
/** \addtogroup Optional Components
*  @{
*/
/** \addtogroup Property
*  @{
*/

/** @file
	OGRE's property system allows you to associate values of arbitrary type with
	names, and have those values exposed via a self-describing interface. Unlike
	Ogre::StringInterface, the values are passed as their native types without
	needing conversion to or from strings; they are simply wrapped in an Ogre::Any
	and casts are performed to access them.
	@par
	Property values are actually not stored in this system; instead the property
	definitions reference getter & setter methods which provide the 'backing' for
	the property. This means you can directly expose features of your classes as properties
	without any duplication.
	@par
	There are two aspects to exposing a property on your class. One is exposing 
	the definition of the property (PropertyDef), which should be shared between 
	all instances and probably stored in a static PropertyDefMap somewhere. The second
	is the instance 'wiring' which ensures that a call to set a property calls 
	a method on this particular instance of the class; this is formed by a number of
	Property instances, contained in a PropertySet. Each Property has an explicit
	binding to getter and setter instance methods.
	@par
	So, here's an example of setting up properties on an instance:

	@code
	// Make sure the property definition is created 
	// propertyDefs is a variable of type PropertyDefMap, shared between instances
	PropertyDefMap::iterator defi = propertyDefs.find("name");
	if (defi == propertyDefs.end())
	{
		defi = propertyDefs.insert(PropertyDefMap::value_type("name", 
			PropertyDef("name", 
				"The name of the object.", PROP_STRING))).first;
	}
	// This has established the property definition, and its description.
	// Now, we need to 'wire' a property instance for this object instance
	// We assume the class is called 'Foo' and the instance is pointed to by a variable called 'inst'
	// 'props' is a PropertySet, specific to the instance
	props.addProperty(
		OGRE_NEW Property<String>(&(defi->second),
			boost::bind(&Foo::getName, inst), 
			boost::bind(&Foo::setName, inst, _1)));

	@endcode

*/

/** @} */
/** @} */
namespace Ogre
{
	/** \addtogroup Optional Components
	*  @{
	*/
	/** \addtogroup Property
	*  @{
	*/

	/// The type of a property
	enum PropertyType
	{
		PROP_SHORT = 0,
		PROP_UNSIGNED_SHORT = 1,
		PROP_INT = 2,
		PROP_UNSIGNED_INT = 3,
		PROP_LONG = 4, 
		PROP_UNSIGNED_LONG = 5,
		PROP_REAL = 6,
		PROP_STRING = 7,
		PROP_VECTOR2 = 8, 
		PROP_VECTOR3 = 9,
		PROP_VECTOR4 = 10, 
		PROP_COLOUR = 11,
		PROP_BOOL = 12,
		PROP_QUATERNION = 13, 
		PROP_MATRIX3 = 14,
		PROP_MATRIX4 = 15, 

		PROP_UNKNOWN = 999
	};

	/** Definition of a property of an object.
	@remarks
	This definition is shared between all instances of an object and therefore
	has no value. Property contains values.
	*/
	class _OgrePropertyExport PropertyDef : public PropertyAlloc
	{
	public:

		/** Construct a property.
		@param name The name of the property
		@param desc A (potentially) long description of the property
		@param pType The type of the property
		*/
		PropertyDef(const String& name, const String& desc, PropertyType pType)
			: mName(name), mDesc(desc), mType(pType) {}

		/// Get the name of the property
		const String& getName() const { return mName; }

		/// Get the description of the property
		const String& getDescription() const { return mDesc; }

		/// Get the type of the property
		PropertyType getType() const { return mType; }

		/// Get a string name of a property type
		static const String& getTypeName(PropertyType theType);

		static PropertyType getTypeForValue(const short& val) { return PROP_SHORT; }
		static PropertyType getTypeForValue(const unsigned short& val) { return PROP_UNSIGNED_SHORT; }
		static PropertyType getTypeForValue(const int& val) { return PROP_INT; }
		static PropertyType getTypeForValue(const unsigned int& val) { return PROP_UNSIGNED_INT; }
		static PropertyType getTypeForValue(const long& val) { return PROP_LONG; }
		static PropertyType getTypeForValue(const unsigned long& val) { return PROP_UNSIGNED_LONG; }
		static PropertyType getTypeForValue(const Real& val) { return PROP_REAL; }
		static PropertyType getTypeForValue(const String& val) { return PROP_STRING; }
		static PropertyType getTypeForValue(const Vector2& val) { return PROP_VECTOR2; }
		static PropertyType getTypeForValue(const Vector3& val) { return PROP_VECTOR3; }
		static PropertyType getTypeForValue(const Vector4& val) { return PROP_VECTOR4; }
		static PropertyType getTypeForValue(const ColourValue& val) { return PROP_COLOUR; }
		static PropertyType getTypeForValue(const bool& val) { return PROP_BOOL; }
		static PropertyType getTypeForValue(const Quaternion& val) { return PROP_QUATERNION; }
		static PropertyType getTypeForValue(const Matrix3& val) { return PROP_MATRIX3; }
		static PropertyType getTypeForValue(const Matrix4& val) { return PROP_MATRIX4; }

	protected:
		// no default construction
		PropertyDef() {}

		String mName;
		String mDesc;
		PropertyType mType;

	};

	/// Map from property name to shared definition
	typedef map<String, PropertyDef>::type PropertyDefMap;

	/** Base interface for an instance of a property.
	*/
	class _OgrePropertyExport PropertyBase : public PropertyAlloc
	{
	public:
		/// Constructor
		PropertyBase(PropertyDef* def) : mDef(def) {}
		virtual ~PropertyBase() {}

		/// Get the name of the property
		const String& getName() const { return mDef->getName(); }

		/// Get the description of the property
		const String& getDescription() const { return mDef->getDescription(); }

		/// Get the type of the property
		PropertyType getType() const { return mDef->getType(); }

		/// Return the current value as an Any
		virtual Ogre::Any getValue() const = 0;

	protected:
		// disallow default construction
		PropertyBase() {}
		PropertyDef* mDef;

	};

	/** Property instance with passthrough calls to a given object. */
	template <typename T>
	class Property : public PropertyBase
	{
	public:
		typedef T value_type;
		typedef boost::function< T (void) > getter_func;
		typedef boost::function< void (T) > setter_func;

		/** Construct a property which is able to directly call a given 
		getter and setter on a specific object instance, via functors.
		*/
		Property(PropertyDef* def, getter_func getter, setter_func setter)
			: PropertyBase(def)
			, mGetter(getter)
			, mSetter(setter) 
		{
		}

		/** Set the property value.
		*/
		virtual void set(T val)
		{
			mSetter(val);
		}

		virtual T get() const
		{
			return mGetter();
		}

		Ogre::Any getValue() const
		{
			return Ogre::Any(get());
		}

	protected:
		// disallow default construction
		Property() {}
		~Property() {}

		getter_func mGetter;
		setter_func mSetter;
	};

	/** A simple structure designed just as a holder of property values between
	the instances of objects they might target. There is just enough information
	here to be able to interpret the results accurately but no more.
	*/
	struct PropertyValue
	{
		PropertyType propType;
		Ogre::Any val;
	};
	/// Defines a transferable map of properties using wrapped value types (Ogre::Any)
	typedef map<String, PropertyValue>::type PropertyValueMap;


	/** Defines a complete set of properties for a single object instance.
	*/
	class _OgrePropertyExport PropertySet : public PropertyAlloc
	{
	public:
		PropertySet();
		~PropertySet();

		/** Adds a property to this set. 
		@remarks
		The PropertySet is responsible for deleting this object.
		*/
		void addProperty(PropertyBase* prop);

		/** Gets the property object for a given property name. 
		@remarks
		Note that this property will need to be cast to a templated property
		compatible with the type you will be setting. You might find the 
		overloaded set and get<type> methods quicker if 
		you already know the type.
		*/
		PropertyBase* getProperty(const String& name) const;

		/** Reports whether this property set contains a named property. */
		bool hasProperty(const String& name) const;

        /** Removes the named property from the property set. */
        void removeProperty(const String& name);

		typedef map<String, PropertyBase*>::type PropertyMap;
		typedef Ogre::MapIterator<PropertyMap> PropertyIterator;
		/// Get an iterator over the available properties
		PropertyIterator getPropertyIterator();

		/** Gets an independently usable collection of property values from the
		current state.
		*/
		PropertyValueMap getValueMap() const;

		/** Sets the current state from a given value map.
		*/
		void setValueMap(const PropertyValueMap& values);

		/** Get a named property value. 
		*/
		template<typename T>
		void getValue(const String& name, T& value) const
		{
			getPropertyImpl(name, value, PropertyDef::getTypeForValue(value));
		}

		/** Set a named property value (via pointer to avoid copy). 
		*/
		template<typename T>
		void setValue(const String& name, const T* value)
		{
			setPropertyImpl(name, *value, PropertyDef::getTypeForValue(*value));
		}
		/** Set a named property value. 
		*/
		template<typename T>
		void setValue(const String& name, T value)
		{
			setPropertyImpl(name, value, PropertyDef::getTypeForValue(value));
		}
		/** Special-case char*, convert to String automatically. 
		*/
		void setValue(const String& name, const char* pChar)
		{
			String v(pChar);
			setPropertyImpl(name, v, PROP_STRING);
		}


	protected:
		PropertyMap mPropertyMap;

		/// Set a named property value, internal implementation (type match required)
		template <typename T>
		void setPropertyImpl(const String& name, const T& val, PropertyType typeCheck)
		{
			PropertyBase* baseProp = getProperty(name);
			if (baseProp->getType() != typeCheck)
			{
				StringUtil::StrStreamType msg;
				msg << "Property error: type passed in: '" << PropertyDef::getTypeName(typeCheck)
					<< "', type of property: '" << PropertyDef::getTypeName(baseProp->getType()) << "'";
				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, msg.str(), "PropertySet::setPropertyImpl");
			}
			static_cast<Property<T>*>(baseProp)->set(val);
		}

		/// Get a named property value, internal implementation (type match required)
		template <typename T>
		void getPropertyImpl(const String& name, T& refVal, PropertyType typeCheck) const
		{
			PropertyBase* baseProp = getProperty(name);
			if (baseProp->getType() != typeCheck)
			{
				StringUtil::StrStreamType msg;
				msg << "Property error: type requested: '" << PropertyDef::getTypeName(typeCheck)
					<< "', type of property: '" << PropertyDef::getTypeName(baseProp->getType()) << "'";
				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, msg.str(), "PropertySet::getPropertyImpl");
			}
			refVal = static_cast<Property<T>*>(baseProp)->get();
		}

	};

	/** @} */
	/** @} */

}

#endif