This file is indexed.

/usr/include/ETL/_value.h is in etl-dev 0.04.19-1.

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
/* ========================================================================
** Extended Template and Library
** Abstraction for a Generic Value Type
** $Id$
**
** Copyright (c) 2002 Adrian Bentley
** Copyright (c) 2010 Nikita Kitaev
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of
** the License, or (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
**
** === N O T E S ===========================================================
**
** This is an internal header file, included by other ETL headers.
** You should not attempt to use it directly.
**
** ========================================================================= */

/* === S T A R T =========================================================== */

#ifndef __ETL__VALUE_H
#define __ETL__VALUE_H

/* === H E A D E R S ======================================================= */
#include <algorithm>
#include <typeinfo>
#include <cassert>

/* === M A C R O S ========================================================= */

/* === T Y P E D E F S ===================================================== */

/* === C L A S S E S & S T R U C T S ======================================= */

/*!	\note 	This class may be specialized to support binary compatibility
			for desired objects (e.g. point3,vector3,float[3]).
			However it MUST be declared within scope that you are using the
			values....

	\warning	If you specialize this class for something that isn't binary
				compatible, then your values could easily report belonging to
				the wrong types.
*/
template < typename T >
class value_store_type
{
public:
	typedef	T						value_type;
};

_ETL_BEGIN_NAMESPACE

/*!	\class	value	_value.h	ETL/value
	\brief	Abstraction of the concept of a generic value

	Modified from ideas for the boost::any type.  Added binary compatibility
	structure
*/
class value
{
	struct contentholder
	{
		virtual ~contentholder() {}
		virtual contentholder *clone() const = 0;
		virtual const std::type_info &type() const = 0;
	};

	contentholder	*content;

public:	//constructor interface
	value()
		:content(0)
	{
	}

	value(const value &v)
		:content( v.content ? v.content->clone() : 0 )
	{
	}

	/* Copies the object passed to it
	*/
	template < typename T >
	value(const T &v)
		:content( new holder< typename value_store_type<T>::value_type >
						(reinterpret_cast<const typename value_store_type<T>::value_type &>(v)) )
	{
	}

public: //modifier interface

	value & swap(value & rhs)
	{
		std::swap(content, rhs.content);
		return *this;
	}

	template<typename ValueType>
	value & operator=(const ValueType & rhs)
	{
		value(rhs).swap(*this);
		return *this;
	}

	value & operator=(const value & rhs)
	{
		value(rhs).swap(*this);
		return *this;
	}

public: //query interface

	bool empty() const
	{
		return content == 0;
	}

	const std::type_info & type() const
	{
		return content ? content->type() : typeid(void);
	}

private: //implementation interface

	template < typename T >
	class holder : public contentholder
	{
	public: //representation
		T	obj;

	public: //constructor interface

		holder(const T &o)
			:obj(o)
		{
		}

		holder(const holder<T> &h)
			:obj(h.obj)
		{
		}

	public: //accessor interface
		virtual contentholder *clone() const
		{
			return new holder(*this);
		}

		virtual const std::type_info &type() const
		{
			return typeid(T);
		}

	public: //allocation interface
		void *operator new(size_t size)
		{
			assert(size == sizeof(holder<T>));

			//use pool allocation at some point
			return malloc(size);
		}

		void operator delete(void *p)
		{
			assert(p);
			//use pool allocation at some point
			return free(p);
		}
	};

	template < typename ValueType >
	friend ValueType *value_cast(value *v);
};

/*!	Is thrown for bad value_casts (when using a reference...)
*/
class bad_value_cast : public std::bad_cast
{
public:
	virtual const char * what() const throw()
	{
		return "etl::bad_value_cast: " "failed conversion using boost::value_cast";
	}
};

/*!	Returns a pointer to the desired value type if the value_type and the internal
	binary format agree (mediated by using the value_store_type class), otherwise
	it returns 0.

	\see value_store_type
*/
template < typename ValueType >
ValueType *value_cast(value *v)
{
	assert(v);

	return ( typeid(typename value_store_type<ValueType>::value_type) == v->type() )
			? &static_cast<value::holder<ValueType> *>(v->content)->obj
			: 0;
}

/*!	Same as above except tweaked to allow const cast (possibly for purposes involving
	type agreement... if const impacts a typeid call I do not know...)
*/
template < typename ValueType >
const ValueType * value_cast(const value *v)
{
	return value_cast<ValueType>(const_cast<value *>(v));
}

/*!	Extract a copy of the internal object and will throw a bad_value_cast exception
	if the types do not agree.

	\note	I'm not sure why boost::any didn't use a reference here... there must be a reason...

	\see bad_value_cast
*/
template < typename ValueType >
ValueType value_cast(const value &v)
{
	const ValueType * result = value_cast<ValueType>(&v);
	if(!result)
		throw bad_value_cast();
	return *result;
}

_ETL_END_NAMESPACE

/* === E N D =============================================================== */

#endif