Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreDataChunk.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
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 #ifndef _DataChunk_H__
00026 #define _DataChunk_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 #include "OgreString.h"
00030 
00031 namespace Ogre {
00053     class _OgreExport DataChunk
00054     {
00055     protected:
00056         uchar* mData;
00057         uchar* mPos;
00058         uchar* mEnd;
00059         size_t mSize;
00060 
00061     public:
00064         DataChunk();
00065 
00068         DataChunk( void *pData, size_t size );
00069 
00074         virtual ~DataChunk() {}
00075 
00078         uchar * allocate( size_t size, const uchar * ptr = NULL );
00079 
00082         DataChunk & clear();
00083 
00086         size_t getSize() const; 
00087 
00090         uchar * getPtr();
00091 
00094         const uchar* getPtr() const;
00095 
00105         ulong read(void* buffer, unsigned long size);
00106 
00109         DataChunk & seek( size_t pos );
00110 
00114         DataChunk & skip( long offset );
00115 
00131         unsigned long readUpTo(
00132             void* buffer, 
00133             size_t size, 
00134             const char* delim = "\n" );
00135 
00147         unsigned long skipUpTo( const char* delim );
00148 
00152         bool isEOF();
00153 
00165         String getLine( bool trimAfter = true );
00166     };
00167 
00168 } // namespace
00169 
00170 #endif

Copyright © 2002 by The OGRE Team