This file is indexed.

/usr/include/xmms2/xmmsclient/xmmsclient++/list.h is in libxmmsclient++-dev 0.8+dfsg-18.1build3.

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
/*  XMMS2 - X Music Multiplexer System
 *  Copyright (C) 2003-2011 XMMS2 Team
 *
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Lesser General Public License for more details.
 */

#ifndef XMMSCLIENTPP_LIST_H
#define XMMSCLIENTPP_LIST_H

#include <xmmsclient/xmmsclient.h>
#include <boost/any.hpp>
#include <boost/shared_ptr.hpp>

#include <xmmsclient/xmmsclient++/dict.h>
#include <xmmsclient/xmmsclient++/typedefs.h>
#include <xmmsclient/xmmsclient++/exceptions.h>
#include <string>

#include <iostream>
#include <iterator>

namespace Xmms
{
	template< typename T >
	struct type_traits;

	template<>
	struct type_traits< int32_t >
	{
		typedef int32_t type;
		static int (*get_func)( const xmmsv_t*, int32_t* );
	};

	template<>
	struct type_traits< std::string >
	{
		typedef const char* type;
		static int (*get_func)( const xmmsv_t*, const char** );
	};

	template<>
	struct type_traits< Dict >
	{
	};

	namespace {
		template< typename T >
		T construct( xmmsv_t* elem )
		{
			typename type_traits< T >::type temp = 0;
			if( !type_traits< T >::get_func( elem, &temp ) ) {
				throw wrong_type_error( "Failed to retrieve a value"
				                        " from the list" );
			}
			return T( temp );
		}
		template<>
		Dict construct( xmmsv_t* elem )
		{
			return Dict( elem );
		}
	}

	template< typename T >
	class List;

	template< typename T >
	class List_const_iterator_
	{
		private:
			List_const_iterator_( xmmsv_t*, int );
			friend class List< T >;
		public:
			typedef ptrdiff_t difference_type;
			typedef std::bidirectional_iterator_tag iterator_category;
			typedef T value_type;
			typedef const value_type& reference;
			typedef const value_type* pointer;

			List_const_iterator_();
			List_const_iterator_( const List_const_iterator_& );
			List_const_iterator_& operator=( const List_const_iterator_& );
			~List_const_iterator_();
			const value_type& operator*() const;
			const value_type* operator->() const;
			List_const_iterator_& operator++();
			List_const_iterator_ operator++( int );
			List_const_iterator_& operator--();
			List_const_iterator_ operator--( int );
			bool equal( const List_const_iterator_& rh ) const;

		private:
			xmmsv_t* getElement() const
			{
				xmmsv_t *elem = NULL;
				xmmsv_list_iter_entry( it_, &elem );
				return elem;
			}

			xmmsv_t* list_;
			xmmsv_list_iter_t* it_;
	};

	/** @class List list.h "xmmsclient/xmmsclient++/list.h"
	 *  @brief This class acts as a wrapper for list type values.
	 *  This is actually a virtual class and is specialized with T being
	 *  - std::string
	 *  - int
	 *  - unsigned int
	 *  - Dict
	 *
	 *  If any other type is used, a compile-time error should occur.
	 */
	template< typename T >
	class List
	{

		public:

			typedef List_const_iterator_< T > const_iterator;

			typedef std::reverse_iterator< const_iterator > const_reverse_iterator;

			/** Constructor
			 */
			List( xmmsv_t* value ) :
				value_( 0 )
			{
				if( xmmsv_is_error( value ) ) {
					const char *buf;
					xmmsv_get_error( value, &buf );
					throw value_error( buf );
				}
				if( !xmmsv_is_type( value, XMMSV_TYPE_LIST ) ) {
					throw not_list_error( "Provided value is not a list" );
				}

				value_ = value;
				xmmsv_ref( value_ );
			}

			/** Copy-constructor.
			 */
			List( const List<T>& list ) :
				value_( list.value_ )
			{
				xmmsv_ref( value_ );
			}

			/** Copy assignment operator.
			 */
			List<T>& operator=( const List<T>& list )
			{
				value_ = list.value_;
				xmmsv_ref( value_ );
				return *this;
			}

			/** Destructor.
			 */
			~List()
			{
				xmmsv_unref( value_ );
			}

			const_iterator begin() const
			{
				return const_iterator( value_, 0 );
			}
			const_iterator end() const
			{
				return const_iterator( value_, xmmsv_list_get_size(value_) );
			}

			const_reverse_iterator rbegin() const
			{
				return const_reverse_iterator(end());
			}
			const_reverse_iterator rend() const
			{
				return const_reverse_iterator(begin());
			}

		/** @cond */
		private:
			xmmsv_t* value_;
		/** @endcond */

	};

	template< typename T >
	inline
	bool operator==( const List_const_iterator_< T >& lh, const List_const_iterator_< T >& rh )
	{
		return lh.equal( rh );
	}

	template< typename T >
	inline
	bool operator!=( const List_const_iterator_< T >& lh, const List_const_iterator_< T >& rh )
	{
		return !( lh == rh );
	}

	template< typename T >
	List_const_iterator_< T >::List_const_iterator_( xmmsv_t* list, int pos )
		: list_( list ), it_( 0 )
	{
		xmmsv_get_list_iter( list_, &it_ );
		xmmsv_list_iter_seek( it_, pos );
	}

	template< typename T >
	List_const_iterator_< T >::List_const_iterator_()
		: list_( 0 ), it_( 0 )
	{
	}

	template< typename T >
	List_const_iterator_< T >::List_const_iterator_( const List_const_iterator_& rh )
		: list_( rh.list_ ), it_( 0 )
	{
		if( list_ ) {
			xmmsv_t* rh_parent( xmmsv_list_iter_get_parent( rh.it_ ) );
			xmmsv_get_list_iter( rh_parent, &it_ );
			xmmsv_list_iter_seek( it_, xmmsv_list_iter_tell( rh.it_ ) );
		}
	}

	template< typename T >
	List_const_iterator_< T >&
	List_const_iterator_< T >::operator=( const List_const_iterator_& rh )
	{
		list_ = rh.list_;
		if ( it_ ) {
			xmmsv_list_iter_explicit_destroy( it_ );
		}

		if( list_ ) {
			xmmsv_t* rh_parent( xmmsv_list_iter_get_parent( rh.it_ ) );
			xmmsv_get_list_iter( rh_parent, &it_ );
			xmmsv_list_iter_seek( it_, xmmsv_list_iter_tell( rh.it_ ) );
		}
		else {
			it_ = 0;
		}

		return *this;
	}

	template< typename T >
	List_const_iterator_< T >::~List_const_iterator_()
	{
		if ( it_ ) {
			xmmsv_list_iter_explicit_destroy( it_ );
		}
	}

	template< typename T >
	const typename List_const_iterator_< T >::value_type&
	List_const_iterator_<T>::operator*() const
	{
		static value_type value;
		value = construct< T >( getElement() );
		return value;
	}

	template< typename T >
	const typename List_const_iterator_< T >::value_type*
	List_const_iterator_<T>::operator->() const
	{
		return &( operator*() );
	}

	template< typename T >
	List_const_iterator_< T >&
	List_const_iterator_< T >::operator++()
	{
		xmmsv_list_iter_next( it_ );
		return *this;
	}

	template< typename T >
	List_const_iterator_< T >
	List_const_iterator_< T >::operator++( int )
	{
		List_const_iterator_ tmp( *this );
		++*this;
		return tmp;
	}

	template< typename T >
	List_const_iterator_< T >&
	List_const_iterator_< T >::operator--()
	{
		xmmsv_list_iter_prev( it_ );
		return *this;
	}

	template< typename T >
	List_const_iterator_< T >
	List_const_iterator_< T >::operator--( int )
	{
		List_const_iterator_ tmp( *this );
		--*this;
		return tmp;
	}

	template< typename T >
	bool List_const_iterator_< T >::equal( const List_const_iterator_& rh ) const
	{
		if( list_ == rh.list_ ) {
			return xmmsv_list_iter_tell( it_ ) == xmmsv_list_iter_tell( rh.it_ );
		}
		return false;
	}
}

#endif // XMMSCLIENTPP_LIST_H