This file is indexed.

/usr/include/opencollada/GeneratedSaxParser/GeneratedSaxParserUtils.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.

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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
/*
    Copyright (c) 2008-2009 NetAllied Systems GmbH

    This file is part of GeneratedSaxParser.

    Licensed under the MIT Open Source License, 
    for details please see LICENSE file or the website
    http://www.opensource.org/licenses/mit-license.php
*/

#ifndef __GENERATEDSAXPARSER_UTILS_H__
#define __GENERATEDSAXPARSER_UTILS_H__

#include "COLLADABUURI.h"

#include "GeneratedSaxParserPrerequisites.h"
#include "GeneratedSaxParserTypes.h"

#include <utility>
#include <map>

namespace GeneratedSaxParser
{

    typedef std::pair<StringHash, StringHash> StringHashPair;

    class Utils
	{
	public:
	


		static StringHash calculateStringHash(const ParserChar* text, size_t textLength);

        static StringHash calculateStringHash( const ParserChar** text, const ParserChar* bufferEnd, bool& );

        static StringHash calculateStringHash( StringHash prefixHash, const char* separator, const ParserChar* text);

		static StringHash calculateStringHash(const ParserChar* text);

        static StringHashPair calculateStringHashWithNamespace( const ParserChar* text );

        static StringHash calculateStringHash(const ParserChar* text, bool& failed);

		static bool isWhiteSpace(ParserChar c)
		{
			return (c == ' ' || c == '\t' || c == '\r' || c == '\n');
		}

        /** Checks if all characters in buffer are whitspaces. */
        static bool isWhiteSpaceOnly(const ParserChar* buffer, size_t length);

        static bool isdigit(ParserChar c)
		{
			return (c >= '0' && c <= '9');
		}


        /**
         * Fills dest with src. Stops on 0 in src or at maxLen. dest will be null terminated.
         * @param dest Destination buffer (-> error message).
         * @param src Source buffer (-> content of error message).
         * @param maxLen Length of dest -1.
         */
        static void fillErrorMsg(ParserChar* dest, const ParserChar* src, size_t maxLen);


		/** Converts the first string representing a floating point number within a ParserChar buffer to a 
		FloatingPointType and advances the character pointer to the first position after the last interpreted 
		character. If buffer is set to bufferEnd, the end of the buffer was reached during conversion., i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		template<class FloatingPointType>
		static FloatingPointType toFloatingPoint(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);

		/** Converts the first string representing a floating point number within a ParserChar buffer to a float.
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		template<class FloatingPointType>
		static FloatingPointType toFloatingPoint(const ParserChar* buffer, bool& failed);

        /** Combination of the two above functions. Converts first string and advances the pointer.
        Buffer end is determined by null termination.
        @tparam FloatingPointType C++ type of parsing result, i.e. float or double.
        @param buffer Pointer to the first character in the buffer. Will be set to the first 
        character after the last interpreted.
        @param  failed False if conversion succeeded, true on failure.*/
        template<class FloatingPointType>
        static FloatingPointType toFloatingPoint(const ParserChar** buffer, bool& failed);

        /** Converts the first string representing a float within a ParserChar buffer to a float and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion. In this case 
		failed is always set to true.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static float toFloat(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);

		/** Converts the first string representing a float within a ParserChar buffer to a float.
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static float toFloat(const ParserChar* buffer, bool& failed);

        /** @see toFloatingPoint(const ParserChar** buffer, bool& failed). */
        static float toFloat(const ParserChar** buffer, bool& failed);

        /** Converts the first string representing a double within a ParserChar buffer to a double and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion. In this case 
		failed is always set to true.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static double toDouble(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);

		/** Converts the first string representing a double within a ParserChar buffer to a double.
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static double toDouble(const ParserChar* buffer, bool& failed);

        /** @see toFloatingPoint(const ParserChar** buffer, bool& failed). */
        static double toDouble(const ParserChar** buffer, bool& failed);


        /**
         * Extracts a string of a string list (char data).
         *
         * @param buffer Pointer to buffer containing part of a string list.
         * @param bufferEnd End of the buffer.
         * @param failed Out parameter indicating if a string was found.
         * @return Found string.
         */
        static ParserString toStringListItem(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);
        /** Extracts a string of a string list (attribute). */
        static ParserString toStringListItem(const ParserChar** buffer, bool& failed);


        /** Extracts an URI of a string list (char data). */
        static COLLADABU::URI toURI(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);
        /** Extracts an URI of a string list (attribute). */
        static COLLADABU::URI toURI(const ParserChar** buffer, bool& failed);


        /** Converts the first string representing an integer within a ParserChar buffer to an int and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param IntegerType Type of the integer.
		@param signedInteger Indicates, if the integer type is signed or unsigned.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		template<class IntegerType, bool signedInteger>
		static IntegerType toInteger(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);

		/** Converts the first string representing an integer within a ParserChar buffer to an int. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		template<class IntegerType, bool signedInteger>
		static IntegerType toInteger(const ParserChar* buffer, bool& failed);

        /** Combination of the two above functions. Converts first string and advances the pointer.
        Buffer end is determined by null termination.
        @tparam IntegerType C++ type of parsing result, i.e. int, short, long, ... .
        @tparam signedInteger Indicates, if the integer type is signed or unsigned.
        @param buffer Pointer to the first character in the buffer. Will be set to the first 
        character after the last interpreted.
        @param  failed False if conversion succeeded, true on failure.*/
        template<class IntegerType, bool signedInteger>
        static IntegerType toInteger(const ParserChar** buffer, bool& failed);

		/** Converts the first string representing an integer within a ParserChar buffer to an char and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static sint8 toSint8(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);

		/** Converts the first string representing an integer within a ParserChar buffer to an char. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static sint8 toSint8(const ParserChar* buffer, bool& failed);

        static sint8 toSint8(const ParserChar** buffer, bool& failed);

        /** Converts the first string representing an unsigned integer within a ParserChar buffer to 
		an char and advances the character pointer to the first position after the last interpreted 
		character. If buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static uint8 toUint8(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);

		/** Converts the first string representing an unsigned integer within a ParserChar buffer to an 
		unsigned char. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static uint8 toUint8(const ParserChar* buffer, bool& failed);

        static uint8 toUint8(const ParserChar** buffer, bool& failed);

		/** Converts the first string representing an integer within a ParserChar buffer to an short and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static sint16 toSint16(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


		/** Converts the first string representing an integer within a ParserChar buffer to an short. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static sint16 toSint16(const ParserChar* buffer, bool& failed);

        static sint16 toSint16(const ParserChar** buffer, bool& failed);


		/** Converts the first string representing an unsigned integer within a ParserChar buffer to 
		an short and advances the character pointer to the first position after the last interpreted 
		character. If buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static uint16 toUint16(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


		/** Converts the first string representing an unsigned integer within a ParserChar buffer to an 
		unsigned short. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static uint16 toUint16(const ParserChar* buffer, bool& failed);

        static uint16 toUint16(const ParserChar** buffer, bool& failed);


		/** Converts the first string representing an integer within a ParserChar buffer to an int and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static sint32 toSint32(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


		/** Converts the first string representing an integer within a ParserChar buffer to an int. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static sint32 toSint32(const ParserChar* buffer, bool& failed);

        static sint32 toSint32(const ParserChar** buffer, bool& failed);


		/** Converts the first string representing an unsigned integer within a ParserChar buffer to 
		an int and advances the character pointer to the first position after the last interpreted 
		character. If buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static uint32 toUint32(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


		/** Converts the first string representing an unsigned integer within a ParserChar buffer to an 
		unsigned int. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static uint32 toUint32(const ParserChar* buffer, bool& failed);


        static uint32 toUint32(const ParserChar** buffer, bool& failed);

		/** Converts the first string representing an integer within a ParserChar buffer to an int and 
		advances the character pointer to the first position after the last interpreted character. If 
		buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static sint64 toSint64(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


		/** Converts the first string representing an integer within a ParserChar buffer to an int. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static sint64 toSint64(const ParserChar* buffer, bool& failed);

        static sint64 toSint64(const ParserChar** buffer, bool& failed);


		/** Converts the first string representing an unsigned integer within a ParserChar buffer to 
		an int and advances the character pointer to the first position after the last interpreted 
		character. If buffer is set to bufferEnd, the end of the buffer was reached during conversion, i.e. all characters 
		from buffer to bufferEnd are parsed. In this case failed is set to false if all these characters represent 
		a valid integer.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static uint64 toUint64(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


		/** Converts the first string representing an unsigned integer within a ParserChar buffer to an 
		unsigned int. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static uint64 toUint64(const ParserChar* buffer, bool& failed);

        static uint64 toUint64(const ParserChar** buffer, bool& failed);


		/** Converts the first string representing an enum of type @EnumType within a ParserChar buffer to an 
		enum. 
		@param EnumType The type of the enumeration
		@param BaseType The base type the enumeration was derived from as a restriction
		@param EnumMapCount The count of @a EnumType. Must follow last C++ enum value
        representing last value in XSD enumeration (__COUNT in generated code with default config).
		The first member must be set to 0.
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.
		@param enumMap Maps BaseType to EnumType.
		@param baseConversionFunctionPtr Function used to convert from ParserChar buffer to BaseType.*/
		template<class EnumType, class BaseType, EnumType EnumMapCount>
		static EnumType toEnum( const ParserChar* buffer, 
								bool& failed, 
								const std::pair<BaseType, EnumType>* enumMap,
								BaseType (*baseConversionFunctionPtr)(const ParserChar* buffer, bool& failed) );

        /** 
         * Converts a string representing one value to an enum. Recognizes end of 
         * string by a pointer. To be used to convert character data with variety atomic.
         */
        template<class EnumType, class BaseType, EnumType EnumMapCount>
        static EnumType toEnum( const ParserChar** buffer, 
            const ParserChar* bufferEnd,
            bool& failed, 
            const std::pair<BaseType, EnumType>* enumMap,
            BaseType (*baseConversionFunctionPtr)(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed) );


        /** Converts the first string representing a boolean within a ParserChar buffer to a bool. 
		@param buffer Pointer to the first character in the buffer. 
		@param failed False if conversion succeeded, true on failure.*/
		static bool toBool(const ParserChar* buffer, bool& failed);

		/** TODO Test this method. Converts the first string representing a bool within a ParserChar buffer to 
		a bool and advances the character pointer to the first position after the last interpreted 
		character. If buffer is set to bufferEnd, the end of the buffer was reached during conversion. 
		In this case failed is always set to true.
		@param buffer Pointer to the first character in the buffer. Will be set to the first 
		character after the last interpreted. 
		@param bufferEnd the first character after the last in the buffer
		@param failed False if conversion succeeded, true on failure.*/
		static bool toBool(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed);


        static bool toBool( const ParserChar** buffer, bool& failed  );


        /**
         * Checks if given floating point value is infinity.
         * @tparam T Type of floating point value.
         * @param value Value to check.
         * @return true if value is infinity.
         */
        template<typename T>
        static bool isInf(T value);

        /**
         * Checks if given floating point value is negative infinity.
         * @tparam T Type of floating point value.
         * @param value Value to check.
         * @return true if value is negative infinity.
         */
        template<typename T>
        static bool isNegativeInf(T value);

        /**
         * Checks if given floating point value is Not a Number.
         * @tparam T Type of floating point value.
         * @param value Value to check.
         * @return true if value is Not a Number.
         */
        template<typename T>
        static bool isNaN(T value);

        /**
         * Checks if given float value is infinity.
         * @param value Value to check.
         * @return true if value is infinity.
         */
        static bool isInf(float value);

        /**
         * Checks if given double value is infinity.
         * @param value Value to check.
         * @return true if value is infinity.
         */
        static bool isInf(double value);

        /**
         * Checks if given float value is negative infinity.
         * @param value Value to check.
         * @return true if value is negative infinity.
         */
        static bool isNegativeInf(float value);

        /**
         * Checks if given double value is negative infinity.
         * @param value Value to check.
         * @return true if value is negative infinity.
         */
        static bool isNegativeInf(double value);

        /**
         * Checks if given float value is Not a Number.
         * @param value Value to check.
         * @return true if value is Not a Number.
         */
        static bool isNaN(float value);

        /**
         * Checks if given double value is Not a Number.
         * @param value Value to check.
         * @return true if value is Not a Number.
         */
        static bool isNaN(double value);

    private:
        /** Disable default copy ctor. */
		Utils( const Utils& pre );
        /** Disable default assignment operator. */
		const Utils& operator= ( const Utils& pre );

	};

    //--------------------------------------------------------------------
    template<class EnumType, class BaseType, EnumType EnumMapCount>
	EnumType GeneratedSaxParser::Utils::toEnum( const ParserChar* buffer, 
											  bool& failed, 
											  const std::pair<BaseType, EnumType>* enumMap,
											  BaseType (*baseConversionFunctionPtr)(const ParserChar* buffer, bool& failed) )
	{
		// convert string to base type
		bool baseConversionFailed = false;
		BaseType baseValue = baseConversionFunctionPtr(buffer, failed);
		if ( baseConversionFailed )
		{
			failed = true;
			return EnumMapCount;
		}

		// convert base type to enum
		for ( size_t i = 0; i < EnumMapCount; ++i )
		{
			const std::pair<BaseType, EnumType>& enumPair = enumMap[i];
			if ( enumPair.first ==  baseValue )
			{
				failed = false;
				return enumPair.second;
			}
		}
		
		// no matching enum found
		failed = true;
		return EnumMapCount;
	}

    //--------------------------------------------------------------------
    template<class EnumType, class BaseType, EnumType EnumMapCount>
    EnumType GeneratedSaxParser::Utils::toEnum( const ParserChar** buffer, 
        const ParserChar* bufferEnd,
        bool& failed, 
        const std::pair<BaseType, EnumType>* enumMap,
        BaseType (*baseConversionFunctionPtr)(const ParserChar** buffer, const ParserChar* bufferEnd, bool& failed) )
    {
        // convert string to base type
        bool baseConversionFailed = false;
        BaseType baseValue = baseConversionFunctionPtr(buffer, bufferEnd, failed);
        if ( baseConversionFailed )
        {
            failed = true;
            return EnumMapCount;
        }

        // convert base type to enum
        for ( size_t i = 0; i < EnumMapCount; ++i )
        {
            const std::pair<BaseType, EnumType>& enumPair = enumMap[i];
            if ( enumPair.first ==  baseValue )
            {
                failed = false;
                return enumPair.second;
            }
        }

        // no matching enum found
        failed = true;
        return EnumMapCount;
    }


} // namespace COLLADASAXPARSER

#endif // __GENERATEDSAXPARSER_UTILS_H__