00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _ID3LIB_WRITER_H_
00029 #define _ID3LIB_WRITER_H_
00030
00031 #include <id3/globals.h>
00032
00033 class ID3_CPP_EXPORT ID3_Writer
00034 {
00035 public:
00036 typedef uint32 size_type;
00037 typedef uint8 char_type;
00038 typedef uint32 pos_type;
00039 typedef int32 off_type;
00040 typedef int16 int_type;
00041 static const int_type END_OF_WRITER;
00042
00044 virtual void close() = 0;
00045
00047 virtual void flush() = 0;
00048
00050 virtual pos_type getBeg() { return static_cast<pos_type>(0); }
00051
00055 virtual pos_type getEnd() { return static_cast<pos_type>(-1); }
00056
00058 virtual pos_type getCur() = 0;
00059
00061 virtual size_type getSize() { return this->getCur() - this->getBeg(); }
00062
00064 virtual size_type getMaxSize() { return this->getEnd() - this->getBeg(); }
00065
00071 virtual int_type writeChar(char_type ch)
00072 {
00073 if (this->atEnd())
00074 {
00075 return END_OF_WRITER;
00076 }
00077 this->writeChars(&ch, 1);
00078 return ch;
00079 }
00080
00086 virtual size_type writeChars(const char_type buf[], size_type len) = 0;
00087 virtual size_type writeChars(const char buf[], size_type len)
00088 {
00089 return this->writeChars(reinterpret_cast<const char_type *>(buf), len);
00090 }
00091
00092 virtual bool atEnd()
00093 {
00094 return this->getCur() >= this->getEnd();
00095 }
00096 };
00097
00098 #endif