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 (c) 2000-2005 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 #include "OgreDataStream.h" 00032 00033 namespace Ogre { 00034 00040 class _OgreExport Serializer 00041 { 00042 public: 00043 Serializer(); 00044 virtual ~Serializer(); 00045 00046 00047 protected: 00048 00049 uint32 mCurrentstreamLen; 00050 FILE* mpfFile; 00051 String mVersion; 00052 00053 // Internal methods 00054 virtual void writeFileHeader(void); 00055 virtual void writeChunkHeader(uint16 id, uint32 size); 00056 00057 void writeFloats(const float* const pfloat, size_t count); 00058 void writeFloats(const double* const pfloat, size_t count); 00059 void writeShorts(const uint16* const pShort, size_t count); 00060 void writeInts(const uint32* const pInt, size_t count); 00061 void writeBools(const bool* const pLong, size_t count); 00062 void writeObject(const Vector3& vec); 00063 void writeObject(const Quaternion& q); 00064 00065 void writeString(const String& string); 00066 void writeData(const void* const buf, size_t size, size_t count); 00067 00068 virtual void readFileHeader(DataStreamPtr& stream); 00069 virtual unsigned short readChunk(DataStreamPtr& stream); 00070 00071 void readBools(DataStreamPtr& stream, bool* pDest, size_t count); 00072 void readFloats(DataStreamPtr& stream, float* pDest, size_t count); 00073 void readFloats(DataStreamPtr& stream, double* pDest, size_t count); 00074 void readShorts(DataStreamPtr& stream, uint16* pDest, size_t count); 00075 void readInts(DataStreamPtr& stream, uint32* pDest, size_t count); 00076 void readObject(DataStreamPtr& stream, Vector3& pDest); 00077 void readObject(DataStreamPtr& stream, Quaternion& pDest); 00078 00079 String readString(DataStreamPtr& stream); 00080 String readString(DataStreamPtr& stream, size_t numChars); 00081 00082 virtual void flipToLittleEndian(void* pData, size_t size, size_t count = 1); 00083 virtual void flipFromLittleEndian(void* pData, size_t size, size_t count = 1); 00084 00085 virtual void flipEndian(void * pData, size_t size, size_t count); 00086 virtual void flipEndian(void * pData, size_t size); 00087 }; 00088 00089 } 00090 00091 00092 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:52 2006