00001 /* 00002 * $Id: StdioInputFile.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_STDIOINPUTFILE_H__ 00015 #define __XVR2_STDIOINPUTFILE_H__ 00016 00017 #include<xvr2/StreamInterface.h> 00018 #include<xvr2/StdioInterface.h> 00019 #include<xvr2/String.h> 00020 #include<cstdio> 00021 00022 namespace xvr2 { 00023 00025 class StdioInputFile : public ReadableStream, public StdioInterface { 00026 public: 00027 StdioInputFile(); 00028 StdioInputFile(const String &fname); 00029 StdioInputFile(FILE *__f); 00030 void open(const String &path); 00031 void close(); 00032 bool opened(); 00033 virtual ~StdioInputFile(); 00034 UInt32 read(void *data, UInt32 size); 00035 00036 UInt32 read(Buffer &data, UInt32 size); 00037 StdioInputFile &read(Buffer &b); 00038 StdioInputFile &readAll(Buffer &b); 00039 00040 void flush(); 00041 }; 00042 00043 } 00044 00045 #endif 00046