Go to the documentation of this file.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 #ifndef TAGLIB_IOSTREAM_H
00027 #define TAGLIB_IOSTREAM_H
00028
00029 #include "taglib_export.h"
00030 #include "taglib.h"
00031 #include "tbytevector.h"
00032
00033 namespace TagLib {
00034
00035 #ifdef _WIN32
00036 class TAGLIB_EXPORT FileName
00037 {
00038 public:
00039 FileName(const wchar_t *name) : m_wname(name) {}
00040 FileName(const char *name) : m_name(name) {}
00041 operator const wchar_t *() const { return m_wname.c_str(); }
00042 operator const char *() const { return m_name.c_str(); }
00043 private:
00044 std::string m_name;
00045 std::wstring m_wname;
00046 };
00047 #else
00048 typedef const char *FileName;
00049 #endif
00050
00052
00053 class TAGLIB_EXPORT IOStream
00054 {
00055 public:
00059 enum Position {
00061 Beginning,
00063 Current,
00065 End
00066 };
00067
00068 IOStream();
00069
00073 virtual ~IOStream();
00074
00078 virtual FileName name() const = 0;
00079
00083 virtual ByteVector readBlock(ulong length) = 0;
00084
00094 virtual void writeBlock(const ByteVector &data) = 0;
00095
00103 virtual void insert(const ByteVector &data, ulong start = 0, ulong replace = 0) = 0;
00104
00112 virtual void removeBlock(ulong start = 0, ulong length = 0) = 0;
00113
00117 virtual bool readOnly() const = 0;
00118
00123 virtual bool isOpen() const = 0;
00124
00131 virtual void seek(long offset, Position p = Beginning) = 0;
00132
00136 virtual void clear();
00137
00141 virtual long tell() const = 0;
00142
00146 virtual long length() = 0;
00147
00151 virtual void truncate(long length) = 0;
00152
00153 private:
00154 IOStream(const IOStream &);
00155 IOStream &operator=(const IOStream &);
00156 };
00157
00158 }
00159
00160 #endif