CrystalSpace

Public API Reference

csutil/filereadhelper.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001-2005 by Jorrit Tyberghein
00003               (C) 2001 by Martin Geisse
00004               (C) 2005 by Frank Richter
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #ifndef __CS_CSUTIL_FILEREADHELPER_H__
00022 #define __CS_CSUTIL_FILEREADHELPER_H__
00023 
00028 #include "csextern.h"
00029 #include "csutil/ref.h"
00030 #include "iutil/vfs.h"
00031 
00035 class CS_CRYSTALSPACE_EXPORT csFileReadHelper
00036 {
00037   csRef<iFile> file;
00038 public:
00043   csFileReadHelper (iFile* file) : file (file) {}
00044     
00046   iFile* GetFile() { return file; }
00047   
00049   void Skip (size_t num) { file->SetPos (file->GetPos() + num); }
00050   
00060   bool ReadInt8 (int8 &val);
00061   bool ReadUInt8 (uint8 &val);
00062   bool ReadInt16 (int16 &val);
00063   bool ReadUInt16 (uint16 &val);
00064   bool ReadInt32 (int32 &val);
00065   bool ReadUInt32 (uint32 &val);
00067 
00071 
00072   int GetChar ();
00074   int LookChar ();
00083   bool GetString (char* buf, size_t len, bool OmitNewline = true);
00087   int ReadTextInt ();
00091   float ReadTextFloat ();
00095   void SkipWhitespace ();
00097 };
00098 
00099 #endif // __CS_CSUTIL_FILEREADHELPER_H__

Generated for Crystal Space 1.2.1 by doxygen 1.5.3