TagLib  1.13
tfile.h
Go to the documentation of this file.
1/***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.org
4 ***************************************************************************/
5
6/***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19 * 02110-1301 USA *
20 * *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
25
26#ifndef TAGLIB_FILE_H
27#define TAGLIB_FILE_H
28
29#include "taglib_export.h"
30#include "taglib.h"
31#include "tag.h"
32#include "tbytevector.h"
33#include "tiostream.h"
34
35namespace TagLib {
36
37 class String;
38 class Tag;
39 class AudioProperties;
40 class PropertyMap;
41
43
51 {
52 public:
56 enum Position {
62 End
63 };
64
68 enum StripTags {
69 StripNone, //<! Don't strip any tags
70 StripOthers //<! Strip all tags not explicitly referenced in method call
71 };
72
78 Duplicate, //<! Synchronize values between different tag types
79 DoNotDuplicate //<! Do not synchronize values between different tag types
80 };
81
85 virtual ~File();
86
90 FileName name() const;
91
96 virtual Tag *tag() const = 0;
97
111
119
135
141 virtual AudioProperties *audioProperties() const = 0;
142
153 virtual bool save() = 0;
154
158 ByteVector readBlock(unsigned long length);
159
169 void writeBlock(const ByteVector &data);
170
183 long find(const ByteVector &pattern,
184 long fromOffset = 0,
185 const ByteVector &before = ByteVector());
186
199 long rfind(const ByteVector &pattern,
200 long fromOffset = 0,
201 const ByteVector &before = ByteVector());
202
210 void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
211
219 void removeBlock(unsigned long start = 0, unsigned long length = 0);
220
224 bool readOnly() const;
225
230 bool isOpen() const;
231
235 bool isValid() const;
236
243 void seek(long offset, Position p = Beginning);
244
248 void clear();
249
253 long tell() const;
254
258 long length();
259
266 TAGLIB_DEPRECATED static bool isReadable(const char *file);
267
273 TAGLIB_DEPRECATED static bool isWritable(const char *name);
274
275 protected:
284
294 File(IOStream *stream);
295
301 void setValid(bool valid);
302
306 void truncate(long length);
307
311 static unsigned int bufferSize();
312
313 private:
314 File(const File &);
315 File &operator=(const File &);
316
317 class FilePrivate;
318 FilePrivate *d;
319 };
320
321}
322
323#endif
A simple, abstract interface to common audio properties.
Definition: audioproperties.h:43
A byte vector.
Definition: tbytevector.h:46
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
StripTags
Definition: tfile.h:68
@ StripNone
Definition: tfile.h:69
long tell() const
void seek(long offset, Position p=Beginning)
bool isOpen() const
void writeBlock(const ByteVector &data)
File(IOStream *stream)
File(FileName file)
void removeBlock(unsigned long start=0, unsigned long length=0)
virtual AudioProperties * audioProperties() const =0
bool readOnly() const
PropertyMap properties() const
static TAGLIB_DEPRECATED bool isReadable(const char *file)
Position
Definition: tfile.h:56
@ Current
Seek from the current position in the file.
Definition: tfile.h:60
@ Beginning
Seek from the beginning of the file.
Definition: tfile.h:58
long find(const ByteVector &pattern, long fromOffset=0, const ByteVector &before=ByteVector())
virtual ~File()
FileName name() const
long rfind(const ByteVector &pattern, long fromOffset=0, const ByteVector &before=ByteVector())
void removeUnsupportedProperties(const StringList &properties)
ByteVector readBlock(unsigned long length)
void setValid(bool valid)
bool isValid() const
virtual bool save()=0
void insert(const ByteVector &data, unsigned long start=0, unsigned long replace=0)
DuplicateTags
Definition: tfile.h:77
@ Duplicate
Definition: tfile.h:78
static unsigned int bufferSize()
void truncate(long length)
PropertyMap setProperties(const PropertyMap &properties)
virtual Tag * tag() const =0
static TAGLIB_DEPRECATED bool isWritable(const char *name)
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:63
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:119
A list of strings.
Definition: tstringlist.h:46
Definition: tag.h:47
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
const char * FileName
Definition: tiostream.h:57
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
#define TAGLIB_EXPORT
Definition: taglib_export.h:40