| 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
35 namespace TagLib {
36
37 class String;
38 class Tag;
39 class AudioProperties;
40 class PropertyMap;
41
43
50 class TAGLIB_EXPORT File
51 {
52 public:
56 enum Position {
58 Beginning,
60 Current,
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
77 enum DuplicateTags {
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
110 PropertyMap properties() const;
111
118 void removeUnsupportedProperties(const StringList& properties);
119
134 PropertyMap setProperties(const PropertyMap &properties);
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:
283 File(FileName file);
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
TagLib::AudioProperties
A simple, abstract interface to common audio properties.
Definition: audioproperties.h:43
TagLib::ByteVector
A byte vector.
Definition: tbytevector.h:46
TagLib::File
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
TagLib::File::StripTags
StripTags
Definition: tfile.h:68
TagLib::File::StripNone
@ StripNone
Definition: tfile.h:69
TagLib::File::tell
long tell() const
TagLib::File::seek
void seek(long offset, Position p=Beginning)
TagLib::File::isOpen
bool isOpen() const
TagLib::File::writeBlock
void writeBlock(const ByteVector &data)
TagLib::File::File
File(IOStream *stream)
TagLib::File::File
File(FileName file)
TagLib::File::removeBlock
void removeBlock(unsigned long start=0, unsigned long length=0)
TagLib::File::audioProperties
virtual AudioProperties * audioProperties() const =0
TagLib::File::readOnly
bool readOnly() const
TagLib::File::properties
PropertyMap properties() const
TagLib::File::length
long length()
TagLib::File::clear
void clear()
TagLib::File::isReadable
static TAGLIB_DEPRECATED bool isReadable(const char *file)
TagLib::File::Position
Position
Definition: tfile.h:56
TagLib::File::Current
@ Current
Seek from the current position in the file.
Definition: tfile.h:60
TagLib::File::Beginning
@ Beginning
Seek from the beginning of the file.
Definition: tfile.h:58
TagLib::File::find
long find(const ByteVector &pattern, long fromOffset=0, const ByteVector &before=ByteVector())
TagLib::File::~File
virtual ~File()
TagLib::File::name
FileName name() const
TagLib::File::rfind
long rfind(const ByteVector &pattern, long fromOffset=0, const ByteVector &before=ByteVector())
TagLib::File::removeUnsupportedProperties
void removeUnsupportedProperties(const StringList &properties)
TagLib::File::readBlock
ByteVector readBlock(unsigned long length)
TagLib::File::setValid
void setValid(bool valid)
TagLib::File::isValid
bool isValid() const
TagLib::File::save
virtual bool save()=0
TagLib::File::insert
void insert(const ByteVector &data, unsigned long start=0, unsigned long replace=0)
TagLib::File::DuplicateTags
DuplicateTags
Definition: tfile.h:77
TagLib::File::Duplicate
@ Duplicate
Definition: tfile.h:78
TagLib::File::bufferSize
static unsigned int bufferSize()
TagLib::File::truncate
void truncate(long length)
TagLib::File::setProperties
PropertyMap setProperties(const PropertyMap &properties)
TagLib::File::tag
virtual Tag * tag() const =0
TagLib::File::isWritable
static TAGLIB_DEPRECATED bool isWritable(const char *name)
TagLib::IOStream
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:63
TagLib::PropertyMap
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:119
TagLib::StringList
A list of strings.
Definition: tstringlist.h:46
TagLib::Tag
Definition: tag.h:47
TagLib
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
TagLib::FileName
const char * FileName
Definition: tiostream.h:57
tag.h
taglib.h
TAGLIB_DEPRECATED
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
taglib_export.h
TAGLIB_EXPORT
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
tbytevector.h
tiostream.h