StdioInterface.h

Go to the documentation of this file.
00001 /*
00002  * $Id: StdioInterface.h 562 2007-12-02 08:04:16Z mindstorm2600 $
00003  *
00004  * X-VR2 
00005  * 
00006  * Copyright (C) Juan V. Guerrero 2007
00007  * 
00008  * Juan V. Guerrero <mindstorm2600@users.sourceforge.net>
00009  * 
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License Version 2. See the LICENSE file
00012  * at the top of the source tree.
00013  */
00014 #ifndef __XVR2_STDIOINTERFACE_H__
00015 #define __XVR2_STDIOINTERFACE_H__
00016 #include<xvr2/Object.h>
00017 #include<xvr2/String.h>
00018 #include<xvr2/SystemException.h>
00019 #include<xvr2/StreamInterface.h>
00020 #include<cstdio>
00021 
00022 namespace xvr2 {
00024         class StdioInterface : public virtual StreamInterface {
00025                 private:
00026                 protected:
00027                         FILE *_fptr;
00028                         void _close();
00029                         void _open(const String &fname, const String &mode);
00030                         bool _opened();
00031                         size_t _read(void *_data, size_t __bytes);
00032                         size_t _write(const void *_data, size_t __bytes);
00033                         void _seek(FileOffsetT _pos, UInt32 _from);
00034                         FileSizeT _fsize;
00035                 public:
00036                         StdioInterface(){
00037                                 _fptr = 0;
00038                                 _fsize = 0;
00039                         }
00040                         FILE *cFILE() const {
00041                                 return _fptr;
00042                         }
00043                         virtual FileSizeT size();
00044                         virtual FileOffsetT tell();
00045                         void seek(FileOffsetT _pos);
00046                         void seekBegin();
00047                         void seekEnd();
00048                         void seekStep(FileOffsetT step);
00049                         bool eof();
00050                         void flush();
00051         };
00052         
00054         class StdioInterfaceException : public SystemException {
00055                 private:
00056                 protected:
00057                 public:
00058                         StdioInterfaceException(int _code);
00059         };
00060 }
00061 
00062 #endif

Generated on Fri Jun 20 22:55:47 2008 for X-VR2 SDK by  doxygen 1.5.5