| TagLib 1.13 |  |

fileref.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_FILEREF_H
27#define TAGLIB_FILEREF_H
28
29#include "tfile.h"
30#include "tstringlist.h"
31
32#include "taglib_export.h"
33#include "audioproperties.h"
34
35 namespace TagLib {
36
37 class Tag;
38
40
59 class TAGLIB_EXPORT FileRef
60 {
61 public:
62
64
92 class TAGLIB_EXPORT FileTypeResolver
93 {
94 TAGLIB_IGNORE_MISSING_DESTRUCTOR
95 public:
105 virtual File *createFile(FileName fileName,
106 bool readAudioProperties = true,
107 AudioProperties::ReadStyle
108 audioPropertiesStyle = AudioProperties::Average) const = 0;
109 };
110
111 class TAGLIB_EXPORT StreamTypeResolver : public FileTypeResolver
112 {
113 TAGLIB_IGNORE_MISSING_DESTRUCTOR
114 public:
115 virtual File *createFileFromStream(IOStream *stream,
116 bool readAudioProperties = true,
117 AudioProperties::ReadStyle
118 audioPropertiesStyle = AudioProperties::Average) const = 0;
119 };
120
124 FileRef();
125
135 explicit FileRef(FileName fileName,
136 bool readAudioProperties = true,
137 AudioProperties::ReadStyle
138 audioPropertiesStyle = AudioProperties::Average);
139
152 explicit FileRef(IOStream* stream,
153 bool readAudioProperties = true,
154 AudioProperties::ReadStyle
155 audioPropertiesStyle = AudioProperties::Average);
156
161 explicit FileRef(File *file);
162
166 FileRef(const FileRef &ref);
167
171 virtual ~FileRef();
172
184 Tag *tag() const;
185
190 AudioProperties *audioProperties() const;
191
207 File *file() const;
208
212 bool save();
213
226 static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
227
244 static StringList defaultFileExtensions();
245
249 bool isNull() const;
250
254 FileRef &operator=(const FileRef &ref);
255
259 void swap(FileRef &ref);
260
264 bool operator==(const FileRef &ref) const;
265
270 bool operator!=(const FileRef &ref) const;
271
283 static File *create(FileName fileName,
284 bool readAudioProperties = true,
285 AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
286
287 private:
288 void parse(FileName fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
289 void parse(IOStream *stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
290
291 class FileRefPrivate;
292 FileRefPrivate *d;
293 };
294
295} // namespace TagLib
296
297#endif
audioproperties.h
TagLib::AudioProperties
A simple, abstract interface to common audio properties.
Definition: audioproperties.h:43
TagLib::AudioProperties::ReadStyle
ReadStyle
Definition: audioproperties.h:53
TagLib::AudioProperties::Average
@ Average
Read more of the file and make better values guesses.
Definition: audioproperties.h:57
TagLib::FileRef::FileTypeResolver
A class for pluggable file type resolution.
Definition: fileref.h:93
TagLib::FileRef::FileTypeResolver::createFile
virtual File * createFile(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
TagLib::FileRef::StreamTypeResolver
Definition: fileref.h:112
TagLib::FileRef::StreamTypeResolver::createFileFromStream
virtual File * createFileFromStream(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
TagLib::FileRef
This class provides a simple abstraction for creating and handling files.
Definition: fileref.h:60
TagLib::FileRef::tag
Tag * tag() const
TagLib::FileRef::swap
void swap(FileRef &ref)
TagLib::FileRef::FileRef
FileRef()
TagLib::FileRef::defaultFileExtensions
static StringList defaultFileExtensions()
TagLib::FileRef::addFileTypeResolver
static const FileTypeResolver * addFileTypeResolver(const FileTypeResolver *resolver)
TagLib::FileRef::FileRef
FileRef(const FileRef &ref)
TagLib::FileRef::operator!=
bool operator!=(const FileRef &ref) const
TagLib::FileRef::create
static File * create(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
TagLib::FileRef::FileRef
FileRef(File *file)
TagLib::FileRef::FileRef
FileRef(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
TagLib::FileRef::save
bool save()
TagLib::FileRef::~FileRef
virtual ~FileRef()
TagLib::FileRef::file
File * file() const
TagLib::FileRef::FileRef
FileRef(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
TagLib::FileRef::audioProperties
AudioProperties * audioProperties() const
TagLib::FileRef::isNull
bool isNull() const
TagLib::FileRef::operator=
FileRef & operator=(const FileRef &ref)
TagLib::FileRef::operator==
bool operator==(const FileRef &ref) const
TagLib::File
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
TagLib::IOStream
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:63
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
TAGLIB_IGNORE_MISSING_DESTRUCTOR
#define TAGLIB_IGNORE_MISSING_DESTRUCTOR
Definition: taglib.h:38
taglib_export.h
TAGLIB_EXPORT
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
tfile.h
tstringlist.h