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 #ifndef TAGLIB_FILE_H
00023 #define TAGLIB_FILE_H
00024
00025 #include "taglib.h"
00026 #include "tbytevector.h"
00027
00028 namespace TagLib {
00029
00030 class String;
00031 class Tag;
00032 class AudioProperties;
00033
00035
00042 class File
00043 {
00044 public:
00048 enum Position {
00050 Beginning,
00052 Current,
00054 End
00055 };
00056
00060 virtual ~File();
00061
00065 const char *name() const;
00066
00071 virtual Tag *tag() const = 0;
00072
00078 virtual AudioProperties *audioProperties() const = 0;
00079
00084 virtual bool save() = 0;
00085
00089 ByteVector readBlock(ulong length);
00090
00100 void writeBlock(const ByteVector &data);
00101
00114 long find(const ByteVector &pattern,
00115 long fromOffset = 0,
00116 const ByteVector &before = ByteVector::null);
00117
00130 long rfind(const ByteVector &pattern,
00131 long fromOffset = 0,
00132 const ByteVector &before = ByteVector::null);
00133
00141 void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
00142
00150 void removeBlock(ulong start = 0, ulong length = 0);
00151
00155 bool readOnly() const;
00156
00161 bool isOpen() const;
00162
00167 bool isValid() const;
00168
00175 void seek(long offset, Position p = Beginning);
00176
00180 void clear();
00181
00185 long tell() const;
00186
00190 long length();
00191
00196 static bool isReadable(const char *file);
00197
00201 static bool isWritable(const char *name);
00202
00203 protected:
00211 File(const char *file);
00212
00218 void setValid(bool valid);
00219
00223 void truncate(long length);
00224
00228 static uint bufferSize();
00229
00230 private:
00231 File(const File &);
00232 File &operator=(const File &);
00233
00234 class FilePrivate;
00235 FilePrivate *d;
00236 };
00237
00238 }
00239
00240 #endif