Home | History | Annotate | Download | only in BulletFileLoader
      1 /*
      2 bParse
      3 Copyright (c) 2006-2009 Charlie C & Erwin Coumans  http://gamekit.googlecode.com
      4 
      5 This software is provided 'as-is', without any express or implied warranty.
      6 In no event will the authors be held liable for any damages arising from the use of this software.
      7 Permission is granted to anyone to use this software for any purpose,
      8 including commercial applications, and to alter it and redistribute it freely,
      9 subject to the following restrictions:
     10 
     11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
     12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
     13 3. This notice may not be removed or altered from any source distribution.
     14 */
     15 
     16 #ifndef __BCHUNK_H__
     17 #define __BCHUNK_H__
     18 
     19 #if defined (_WIN32) && ! defined (__MINGW32__)
     20 	#define long64 __int64
     21 #elif defined (__MINGW32__)
     22 	#include <stdint.h>
     23 	#define long64 int64_t
     24 #else
     25 	#define long64 long long
     26 #endif
     27 
     28 
     29 namespace bParse {
     30 
     31 
     32 	// ----------------------------------------------------- //
     33 	class bChunkPtr4
     34 	{
     35 	public:
     36 		bChunkPtr4(){}
     37 		int code;
     38 		int len;
     39 		union
     40 		{
     41 			int m_uniqueInt;
     42 		};
     43 		int dna_nr;
     44 		int nr;
     45 	};
     46 
     47 	// ----------------------------------------------------- //
     48 	class bChunkPtr8
     49 	{
     50 	public:
     51 		bChunkPtr8(){}
     52 		int code,  len;
     53 		union
     54 		{
     55 			long64 oldPrev;
     56 			int	m_uniqueInts[2];
     57 		};
     58 		int dna_nr, nr;
     59 	};
     60 
     61 	// ----------------------------------------------------- //
     62 	class bChunkInd
     63 	{
     64 	public:
     65 		bChunkInd(){}
     66 		int code, len;
     67 		void *oldPtr;
     68 		int dna_nr, nr;
     69 	};
     70 
     71 
     72 	// ----------------------------------------------------- //
     73 	class ChunkUtils
     74 	{
     75 	public:
     76 
     77 		// file chunk offset
     78 		static int getOffset(int flags);
     79 
     80 		// endian utils
     81 		static short swapShort(short sht);
     82 		static int swapInt(int inte);
     83 		static long64 swapLong64(long64 lng);
     84 
     85 	};
     86 
     87 
     88 	const int CHUNK_HEADER_LEN = ((sizeof(bChunkInd)));
     89 	const bool VOID_IS_8 = ((sizeof(void*)==8));
     90 }
     91 
     92 #endif//__BCHUNK_H__
     93