00001 /* 00002 $Id: file_outputprovider.h,v 1.5 2001/03/04 17:54:47 mbn Exp $ 00003 00004 ------------------------------------------------------------------------ 00005 ClanLib, the platform independent game SDK. 00006 00007 This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE 00008 version 2. See COPYING for details. 00009 00010 For a total list of contributers see CREDITS. 00011 00012 ------------------------------------------------------------------------ 00013 */ 00014 00016 00017 #ifndef header_file_outputprovider 00018 #define header_file_outputprovider 00019 00020 #include "outputsource.h" 00021 #include "../System/clanstring.h" 00022 #include "../../stl.h" 00023 #include <stdio.h> 00024 class CL_OutputSource_File : public CL_OutputSource 00025 //: Outputsource writing to memory. 00026 { 00027 public: 00028 CL_OutputSource_File(const char *); 00029 CL_OutputSource_File(); 00030 virtual ~CL_OutputSource_File(); 00031 00032 std::string get_data() const; 00033 //: Get the pointer to the internal data array in the memory source. 00034 //: Used to extract the data after usage. 00036 00037 virtual void set_system_mode(); 00038 //: Changes output data endianess to the local systems mode. 00039 00040 virtual void set_big_endian_mode(); 00041 //: Changes output data endianess to big endian mode. 00042 00043 virtual void set_little_endian_mode(); 00044 //: Changes output data endianess to little endian mode. This is the 00045 //: default setting. 00046 00047 virtual void write_int32(int data); 00048 //: Writes a signed 32 bit integer to output source. 00049 00050 virtual void write_uint32(unsigned int data); 00051 //: Writes a unsigned 32 bit integer to output source. 00052 00053 virtual void write_short16(short data); 00054 //: Writes a signed 16 bit integer (short) to output source. 00055 00056 virtual void write_ushort16(unsigned short data); 00057 //: Writes a unsigned 16 bit integer (short) to output source. 00058 00059 virtual void write_char8(char data); 00060 //: Writes a signed 8 bit integer (char) to output source. 00061 00062 virtual void write_uchar8(unsigned char data); 00063 //: Writes a unsigned 8 bit integer (char) to output source. 00064 00065 virtual void write_float32(float data); 00066 //: Writes a ieee format floating point to output source. 00067 00068 virtual void write_bool(bool data); 00069 //: Writes a bool to output source. 00070 00071 virtual int write(const void *data, int size); 00072 //: Writes larger amounts of data (no endian and 64 bit conversion): 00073 //: <br> 00077 00078 virtual void open(); 00079 //: Opens the output source. By default, it is open. 00080 00081 virtual void close(); 00082 //: Closes the output source. 00083 00084 virtual CL_OutputSource *clone(); 00085 //: Make a copy of the current OutputSource, standing at the same position. 00087 00088 virtual int tell(); 00089 //: Returns current position in output source. 00091 00092 virtual int size(); 00093 //: Returns the size of the output source 00095 00096 virtual void write_string(const char *string); 00097 //: Writes a string to the output source. 00098 virtual void write_string(CL_String &string); 00099 00100 private: 00101 unsigned int m_pos; 00102 CL_String filename; 00103 FILE *file; 00104 }; 00105 00106 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001