tfile.h
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_FILE_H
00027 #define TAGLIB_FILE_H
00028
00029 #include "taglib_export.h"
00030 #include "taglib.h"
00031 #include "tag.h"
00032 #include "tbytevector.h"
00033 #include "tiostream.h"
00034
00035 namespace TagLib {
00036
00037 class String;
00038 class Tag;
00039 class AudioProperties;
00040 class PropertyMap;
00041
00043
00050 class TAGLIB_EXPORT File
00051 {
00052 public:
00056 enum Position {
00058 Beginning,
00060 Current,
00062 End
00063 };
00064
00068 virtual ~File();
00069
00073 FileName name() const;
00074
00079 virtual Tag *tag() const = 0;
00080
00093 PropertyMap properties() const;
00094
00101 void removeUnsupportedProperties(const StringList& properties);
00102
00117 PropertyMap setProperties(const PropertyMap &properties);
00118
00124 virtual AudioProperties *audioProperties() const = 0;
00125
00136 virtual bool save() = 0;
00137
00141 ByteVector readBlock(unsigned long length);
00142
00152 void writeBlock(const ByteVector &data);
00153
00166 long find(const ByteVector &pattern,
00167 long fromOffset = 0,
00168 const ByteVector &before = ByteVector());
00169
00182 long rfind(const ByteVector &pattern,
00183 long fromOffset = 0,
00184 const ByteVector &before = ByteVector());
00185
00193 void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
00194
00202 void removeBlock(unsigned long start = 0, unsigned long length = 0);
00203
00207 bool readOnly() const;
00208
00213 bool isOpen() const;
00214
00218 bool isValid() const;
00219
00226 void seek(long offset, Position p = Beginning);
00227
00231 void clear();
00232
00236 long tell() const;
00237
00241 long length();
00242
00249 static bool isReadable(const char *file);
00250
00256 static bool isWritable(const char *name);
00257
00258 protected:
00266 File(FileName file);
00267
00277 File(IOStream *stream);
00278
00284 void setValid(bool valid);
00285
00289 void truncate(long length);
00290
00294 static unsigned int bufferSize();
00295
00296 private:
00297 File(const File &);
00298 File &operator=(const File &);
00299
00300 class FilePrivate;
00301 FilePrivate *d;
00302 };
00303
00304 }
00305
00306 #endif