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