00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef __Serializer_H__ 00027 #define __Serializer_H__ 00028 00029 #include "OgrePrerequisites.h" 00030 #include "OgreString.h" 00031 00032 namespace Ogre { 00033 00039 class _OgreExport Serializer 00040 { 00041 public: 00042 Serializer(); 00043 virtual ~Serializer(); 00044 00045 00046 protected: 00047 00048 unsigned long mCurrentChunkLen; 00049 FILE* mpfFile; 00050 String mVersion; 00051 00052 // Internal methods 00053 virtual void writeFileHeader(void); 00054 virtual void writeChunkHeader(unsigned short id, unsigned long size); 00055 00056 void writeReals(const Real* pReal, size_t count); 00057 void writeShorts(const unsigned short* pShort, size_t count); 00058 void writeInts(const unsigned int* pInt, size_t count); 00059 void writeLongs(const unsigned long* pLong, size_t count); 00060 void writeBools(const bool* pLong, size_t count); 00061 void writeObject(const Vector3& vec); 00062 void writeObject(const Quaternion& q); 00063 00064 void writeString(const String& string); 00065 void writeData(const void* buf, size_t size, size_t count); 00066 00067 virtual void readFileHeader(DataChunk& chunk); 00068 virtual unsigned short readChunk(DataChunk& chunk); 00069 00070 void readBools(DataChunk& chunk, bool* pDest, size_t count); 00071 void readReals(DataChunk& chunk, Real* pDest, size_t count); 00072 void readShorts(DataChunk& chunk, unsigned short* pDest, size_t count); 00073 void readInts(DataChunk& chunk, unsigned int* pDest, size_t count); 00074 void readLongs(DataChunk& chunk, unsigned long* pDest, size_t count); 00075 void readObject(DataChunk& chunk, Vector3* pDest); 00076 void readObject(DataChunk& chunk, Quaternion* pDest); 00077 00078 String readString(DataChunk& chunk); 00079 00080 void flipToLittleEndian(void* pData, size_t size, size_t count = 1); 00081 void flipFromLittleEndian(void* pData, size_t size, size_t count = 1); 00082 00083 void flipEndian(void * pData, size_t size, size_t count); 00084 void flipEndian(void * pData, size_t size); 00085 }; 00086 00087 } 00088 00089 00090 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:47 2004