00001 /* 00002 $Id: outputsource_memory.h,v 1.4 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_outputsource_memory 00018 #define header_outputsource_memory 00019 00020 #include <string> 00021 #include "outputsource.h" 00022 00023 class CL_OutputSource_Memory : public CL_OutputSource 00024 //: Outputsource writing to memory. 00025 { 00026 public: 00027 CL_OutputSource_Memory(); 00028 virtual ~CL_OutputSource_Memory(); 00029 00030 std::string get_data() const; 00031 //: Get the pointer to the internal data array in the memory source. 00032 //: Used to extract the data after usage. 00034 00035 virtual void set_system_mode(); 00036 //: Changes output data endianess to the local systems mode. 00037 00038 virtual void set_big_endian_mode(); 00039 //: Changes output data endianess to big endian mode. 00040 00041 virtual void set_little_endian_mode(); 00042 //: Changes output data endianess to little endian mode. This is the 00043 //: default setting. 00044 00045 virtual void write_int32(int data); 00046 //: Writes a signed 32 bit integer to output source. 00047 00048 virtual void write_uint32(unsigned int data); 00049 //: Writes a unsigned 32 bit integer to output source. 00050 00051 virtual void write_short16(short data); 00052 //: Writes a signed 16 bit integer (short) to output source. 00053 00054 virtual void write_ushort16(unsigned short data); 00055 //: Writes a unsigned 16 bit integer (short) to output source. 00056 00057 virtual void write_char8(char data); 00058 //: Writes a signed 8 bit integer (char) to output source. 00059 00060 virtual void write_uchar8(unsigned char data); 00061 //: Writes a unsigned 8 bit integer (char) to output source. 00062 00063 virtual void write_float32(float data); 00064 //: Writes a ieee format floating point to output source. 00065 00066 virtual void write_bool(bool data); 00067 //: Writes a bool to output source. 00068 00069 virtual int write(const void *data, int size); 00070 //: Writes larger amounts of data (no endian and 64 bit conversion): 00071 //: <br> 00075 00076 virtual void open(); 00077 //: Opens the output source. By default, it is open. 00078 00079 virtual void close(); 00080 //: Closes the output source. 00081 00082 virtual CL_OutputSource *clone(); 00083 //: Make a copy of the current OutputSource, standing at the same position. 00085 00086 virtual int tell(); 00087 //: Returns current position in output source. 00089 00090 virtual int size(); 00091 //: Returns the size of the output source 00093 00094 virtual void write_string(const char *string); 00095 //: Writes a string to the output source. 00096 00097 private: 00098 std::string m_data; 00099 unsigned int m_pos; 00100 }; 00101 00102 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001