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
00091 PropertyMap properties() const;
00092
00099 void removeUnsupportedProperties(const StringList& properties);
00100
00110 PropertyMap setProperties(const PropertyMap &properties);
00116 virtual AudioProperties *audioProperties() const = 0;
00117
00128 virtual bool save() = 0;
00129
00133 ByteVector readBlock(ulong length);
00134
00144 void writeBlock(const ByteVector &data);
00145
00158 long find(const ByteVector &pattern,
00159 long fromOffset = 0,
00160 const ByteVector &before = ByteVector::null);
00161
00174 long rfind(const ByteVector &pattern,
00175 long fromOffset = 0,
00176 const ByteVector &before = ByteVector::null);
00177
00185 void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
00186
00194 void removeBlock(ulong start = 0, ulong length = 0);
00195
00199 bool readOnly() const;
00200
00205 bool isOpen() const;
00206
00210 bool isValid() const;
00211
00218 void seek(long offset, Position p = Beginning);
00219
00223 void clear();
00224
00228 long tell() const;
00229
00233 long length();
00234
00241 static bool isReadable(const char *file);
00242
00248 static bool isWritable(const char *name);
00249
00250 protected:
00258 File(FileName file);
00259
00269 File(IOStream *stream);
00270
00276 void setValid(bool valid);
00277
00281 void truncate(long length);
00282
00286 static uint bufferSize();
00287
00288 private:
00289 File(const File &);
00290 File &operator=(const File &);
00291
00292 class FilePrivate;
00293 FilePrivate *d;
00294 };
00295
00296 }
00297
00298 #endif