00001 /* 00002 * $Id: StdioOutputFile.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_STDIO_OUTPUT_FILE_H__ 00015 #define __XVR2_STDIO_OUTPUT_FILE_H__ 00016 #include<xvr2/Buffer.h> 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 StdioOutputFile : public WriteableStream, public StdioInterface { 00026 public: 00027 StdioOutputFile(); 00028 StdioOutputFile(const String &fname, bool for_append = false); 00029 StdioOutputFile(FILE *__f); 00030 void open(const String &path); 00031 void open(const String &path, bool for_append = false); 00032 void close(); 00033 bool opened(); 00034 virtual ~StdioOutputFile(); 00035 00036 virtual StdioOutputFile &operator << (const Buffer &b); 00037 virtual StdioOutputFile &operator << (const String &s); 00038 virtual StdioOutputFile &write(void *data, UInt32 size); 00039 virtual StdioOutputFile &write(const Buffer &data); 00040 virtual StdioOutputFile &write(const String &s); 00041 00042 void seek(FileOffsetT _pos); 00043 void seekEnd(); 00044 void seekBegin(); 00045 void seekStep(FileOffsetT _step); 00046 00047 bool eof(); 00048 }; 00049 } 00050 00051 #endif /*STDIOOUTPUTFILE_H_*/ 00052