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://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 #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 
00098         uchar * getCurrentPtr();
00099 
00102         const uchar* getCurrentPtr() const;
00103 
00113         size_t read(void* buffer, size_t size);
00114 
00117         DataChunk & seek( size_t pos );
00118 
00122         DataChunk & skip( long offset );
00123 
00139         size_t readUpTo(
00140             void* buffer, 
00141             size_t size, 
00142             const char* delim = "\n" );
00143 
00155         size_t skipUpTo( const char* delim );
00156 
00160         bool isEOF() const;
00161 
00173         String getLine( bool trimAfter = true );
00174 
00176         String getAsString(void) const;
00177     };
00178 
00179 } // namespace
00180 
00181 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:22 2004