TagLib API Documentation
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 "tbytevector.h"
30#include "tiostream.h"
31#include "taglib_export.h"
32#include "taglib.h"
33#include "tag.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 {
70 StripOthers
71 };
72
79 DoNotDuplicate
80 };
81
85 virtual ~File();
86
87 File(const File &) = delete;
88 File &operator=(const File &) = delete;
89
93 FileName name() const;
94
99 virtual Tag *tag() const = 0;
100
112 virtual PropertyMap properties() const;
113
119 virtual void removeUnsupportedProperties(const StringList& properties);
120
134 virtual PropertyMap setProperties(const PropertyMap &properties);
135
143
149 virtual List<VariantMap> complexProperties(const String &key) const;
150
156 virtual bool setComplexProperties(const String &key, const List<VariantMap> &value);
157
163 virtual AudioProperties *audioProperties() const = 0;
164
175 virtual bool save() = 0;
176
180 ByteVector readBlock(size_t length);
181
191 void writeBlock(const ByteVector &data);
192
205 offset_t find(const ByteVector &pattern,
206 offset_t fromOffset = 0,
207 const ByteVector &before = ByteVector());
208
221 offset_t rfind(const ByteVector &pattern,
222 offset_t fromOffset = 0,
223 const ByteVector &before = ByteVector());
224
232 void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0);
233
241 void removeBlock(offset_t start = 0, size_t length = 0);
242
246 bool readOnly() const;
247
252 bool isOpen() const;
253
257 bool isValid() const;
258
265 void seek(offset_t offset, Position p = Beginning);
266
270 void clear();
271
275 offset_t tell() const;
276
281
282 protected:
290 File(FileName fileName);
291
301 File(IOStream *stream);
302
308 void setValid(bool valid);
309
313 void truncate(offset_t length);
314
318 static unsigned int bufferSize();
319
320 private:
321 class FilePrivate;
323 std::unique_ptr<FilePrivate> d;
324 };
325
326} // namespace TagLib
327
328#endif
A simple, abstract interface to common audio properties.
Definition: audioproperties.h:46
A byte vector.
Definition: tbytevector.h:46
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
offset_t rfind(const ByteVector &pattern, offset_t fromOffset=0, const ByteVector &before=ByteVector())
StripTags
Definition: tfile.h:68
@ StripNone
Don't strip any tags.
Definition: tfile.h:69
bool isOpen() const
void writeBlock(const ByteVector &data)
virtual PropertyMap setProperties(const PropertyMap &properties)
File(IOStream *stream)
virtual PropertyMap properties() const
virtual List< VariantMap > complexProperties(const String &key) const
virtual AudioProperties * audioProperties() const =0
void insert(const ByteVector &data, offset_t start=0, size_t replace=0)
virtual bool setComplexProperties(const String &key, const List< VariantMap > &value)
bool readOnly() const
virtual StringList complexPropertyKeys() const
void truncate(offset_t length)
void removeBlock(offset_t start=0, size_t length=0)
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
virtual ~File()
FileName name() const
offset_t length()
File & operator=(const File &)=delete
void setValid(bool valid)
bool isValid() const
virtual bool save()=0
DuplicateTags
Definition: tfile.h:77
@ Duplicate
Synchronize values between different tag types.
Definition: tfile.h:78
void seek(offset_t offset, Position p=Beginning)
offset_t find(const ByteVector &pattern, offset_t fromOffset=0, const ByteVector &before=ByteVector())
File(FileName fileName)
offset_t tell() const
ByteVector readBlock(size_t length)
File(const File &)=delete
virtual void removeUnsupportedProperties(const StringList &properties)
static unsigned int bufferSize()
virtual Tag * tag() const =0
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:65
A generic, implicitly shared list.
Definition: tlist.h:54
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:122
A list of strings.
Definition: tstringlist.h:44
A wide string class suitable for unicode.
Definition: tstring.h:83
A simple, generic interface to common audio metadata fields.
Definition: tag.h:49
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
off_t offset_t
Definition: taglib.h:64
const char * FileName
Definition: tiostream.h:59
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55