TagLib API Documentation
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
35namespace TagLib {
36
37 class Tag;
38
40
60 {
61 public:
62
64
71 {
72 public:
77 virtual ~FileTypeResolver() = 0;
78
81
91 virtual File *createFile(FileName fileName,
92 bool readAudioProperties = true,
94 audioPropertiesStyle = AudioProperties::Average) const = 0;
95 private:
96 class FileTypeResolverPrivate;
98 std::unique_ptr<FileTypeResolverPrivate> d;
99 };
100
102
140 {
141 public:
146 virtual ~StreamTypeResolver() override = 0; // virtual is needed by SWIG
147
150
163 bool readAudioProperties = true,
165 audioPropertiesStyle = AudioProperties::Average) const = 0;
166 private:
167 class StreamTypeResolverPrivate;
169 std::unique_ptr<StreamTypeResolverPrivate> d;
170 };
171
176
186 explicit FileRef(FileName fileName,
187 bool readAudioProperties = true,
189 audioPropertiesStyle = AudioProperties::Average);
190
203 explicit FileRef(IOStream* stream,
204 bool readAudioProperties = true,
206 audioPropertiesStyle = AudioProperties::Average);
207
212 explicit FileRef(File *file);
213
217 FileRef(const FileRef &ref);
218
223
235 Tag *tag() const;
236
249
256
269
280
307
313 bool setComplexProperties(const String &key, const List<VariantMap> &value);
314
320
336 File *file() const;
337
341 bool save();
342
356
361
379
383 bool isNull() const;
384
389
393 void swap(FileRef &ref) noexcept;
394
398 bool operator==(const FileRef &ref) const;
399
404 bool operator!=(const FileRef &ref) const;
405
406 private:
407 void parse(FileName fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
408 void parse(IOStream *stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
409
410 class FileRefPrivate;
412 std::shared_ptr<FileRefPrivate> d;
413 };
414
415} // namespace TagLib
416
417#endif
A simple, abstract interface to common audio properties.
Definition: audioproperties.h:46
ReadStyle
Definition: audioproperties.h:56
@ Average
Read more of the file and make better values guesses.
Definition: audioproperties.h:60
A class for pluggable file type resolution.
Definition: fileref.h:71
virtual File * createFile(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
FileTypeResolver & operator=(const FileTypeResolver &)=delete
FileTypeResolver(const FileTypeResolver &)=delete
A class for pluggable stream type resolution.
Definition: fileref.h:140
virtual File * createFileFromStream(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
StreamTypeResolver(const StreamTypeResolver &)=delete
virtual ~StreamTypeResolver() override=0
StreamTypeResolver & operator=(const StreamTypeResolver &)=delete
This class provides a simple abstraction for creating and handling files.
Definition: fileref.h:60
Tag * tag() const
PropertyMap properties() const
static StringList defaultFileExtensions()
static const FileTypeResolver * addFileTypeResolver(const FileTypeResolver *resolver)
FileRef(const FileRef &ref)
bool operator!=(const FileRef &ref) const
void swap(FileRef &ref) noexcept
FileRef(File *file)
List< VariantMap > complexProperties(const String &key) const
FileRef(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
bool setComplexProperties(const String &key, const List< VariantMap > &value)
void removeUnsupportedProperties(const StringList &properties)
static void clearFileTypeResolvers()
File * file() const
FileRef(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
AudioProperties * audioProperties() const
StringList complexPropertyKeys() const
bool isNull() const
PropertyMap setProperties(const PropertyMap &properties)
FileRef & operator=(const FileRef &ref)
bool operator==(const FileRef &ref) const
A file class with some useful methods for tag manipulation.
Definition: tfile.h:51
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:123
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
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