fileref.h
Go to the documentation of this file.
/***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_FILEREF_H
#define TAGLIB_FILEREF_H
#include "tfile.h"
#include "tstringlist.h"
#include "taglib_export.h"
#include "audioproperties.h"
namespace TagLib {
class Tag;
class TAGLIB_EXPORT FileRef
{
public:
class TAGLIB_EXPORT FileTypeResolver
{
public:
FileTypeResolver();
virtual ~FileTypeResolver() = 0;
FileTypeResolver(const FileTypeResolver &) = delete;
FileTypeResolver &operator=(const FileTypeResolver &) = delete;
virtual File *createFile(FileName fileName,
bool readAudioProperties = true,
AudioProperties::ReadStyle
audioPropertiesStyle = AudioProperties::Average) const = 0;
private:
class FileTypeResolverPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FileTypeResolverPrivate> d;
};
class TAGLIB_EXPORT StreamTypeResolver : public FileTypeResolver
{
public:
StreamTypeResolver();
virtual ~StreamTypeResolver() override = 0; // virtual is needed by SWIG
StreamTypeResolver(const StreamTypeResolver &) = delete;
StreamTypeResolver &operator=(const StreamTypeResolver &) = delete;
virtual File *createFileFromStream(IOStream *stream,
bool readAudioProperties = true,
AudioProperties::ReadStyle
audioPropertiesStyle = AudioProperties::Average) const = 0;
private:
class StreamTypeResolverPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<StreamTypeResolverPrivate> d;
};
FileRef();
explicit FileRef(FileName fileName,
bool readAudioProperties = true,
AudioProperties::ReadStyle
audioPropertiesStyle = AudioProperties::Average);
explicit FileRef(IOStream* stream,
bool readAudioProperties = true,
AudioProperties::ReadStyle
audioPropertiesStyle = AudioProperties::Average);
explicit FileRef(File *file);
FileRef(const FileRef &ref);
~FileRef();
Tag *tag() const;
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList& properties);
PropertyMap setProperties(const PropertyMap &properties);
StringList complexPropertyKeys() const;
List<VariantMap> complexProperties(const String &key) const;
bool setComplexProperties(const String &key, const List<VariantMap> &value);
AudioProperties *audioProperties() const;
File *file() const;
bool save();
static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
static void clearFileTypeResolvers();
static StringList defaultFileExtensions();
bool isNull() const;
FileRef &operator=(const FileRef &ref);
void swap(FileRef &ref) noexcept;
bool operator==(const FileRef &ref) const;
bool operator!=(const FileRef &ref) const;
private:
void parse(FileName fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
void parse(IOStream *stream, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle);
class FileRefPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::shared_ptr<FileRefPrivate> d;
};
} // namespace TagLib
#endif
audioproperties.h
TagLib::AudioProperties
A simple, abstract interface to common audio properties.
Definition audioproperties.h:46
TagLib::AudioProperties::ReadStyle
ReadStyle
Definition audioproperties.h:56
TagLib::AudioProperties::Average
@ Average
Read more of the file and make better values guesses.
Definition audioproperties.h:60
TagLib::FileRef::FileTypeResolver
A class for pluggable file type resolution.
Definition fileref.h:71
TagLib::FileRef::FileTypeResolver::createFile
virtual File * createFile(FileName fileName, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
TagLib::FileRef::FileTypeResolver::FileTypeResolver
FileTypeResolver()
TagLib::FileRef::FileTypeResolver::~FileTypeResolver
virtual ~FileTypeResolver()=0
TagLib::FileRef::FileTypeResolver::operator=
FileTypeResolver & operator=(const FileTypeResolver &)=delete
TagLib::FileRef::FileTypeResolver::FileTypeResolver
FileTypeResolver(const FileTypeResolver &)=delete
TagLib::FileRef::StreamTypeResolver::StreamTypeResolver
StreamTypeResolver()
TagLib::FileRef::StreamTypeResolver::createFileFromStream
virtual File * createFileFromStream(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average) const =0
TagLib::FileRef::StreamTypeResolver::StreamTypeResolver
StreamTypeResolver(const StreamTypeResolver &)=delete
TagLib::FileRef::StreamTypeResolver::~StreamTypeResolver
virtual ~StreamTypeResolver() override=0
TagLib::FileRef::StreamTypeResolver::operator=
StreamTypeResolver & operator=(const StreamTypeResolver &)=delete
TagLib::FileRef::tag
Tag * tag() const
TagLib::FileRef::FileRef
FileRef()
TagLib::FileRef::~FileRef
~FileRef()
TagLib::FileRef::properties
PropertyMap properties() const
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::swap
void swap(FileRef &ref) noexcept
TagLib::FileRef::FileRef
FileRef(File *file)
TagLib::FileRef::complexProperties
List< VariantMap > complexProperties(const String &key) const
TagLib::FileRef::FileRef
FileRef(IOStream *stream, bool readAudioProperties=true, AudioProperties::ReadStyle audioPropertiesStyle=AudioProperties::Average)
TagLib::FileRef::save
bool save()
TagLib::FileRef::setComplexProperties
bool setComplexProperties(const String &key, const List< VariantMap > &value)
TagLib::FileRef::removeUnsupportedProperties
void removeUnsupportedProperties(const StringList &properties)
TagLib::FileRef::clearFileTypeResolvers
static void clearFileTypeResolvers()
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::complexPropertyKeys
StringList complexPropertyKeys() const
TagLib::FileRef::isNull
bool isNull() const
TagLib::FileRef::setProperties
PropertyMap setProperties(const PropertyMap &properties)
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:65
TagLib::List
A generic, implicitly shared list.
Definition tlist.h:54
TagLib::PropertyMap
A map for format-independent <key,values> tag representations.
Definition tpropertymap.h:123
TagLib::StringList
A list of strings.
Definition tstringlist.h:44
TagLib::String
A wide string class suitable for unicode.
Definition tstring.h:83
TagLib::Tag
A simple, generic interface to common audio metadata fields.
Definition tag.h:49
TagLib
A namespace for all TagLib related classes and functions.
Definition apefile.h:41
TagLib::FileName
const char * FileName
Definition tiostream.h:59
taglib_export.h
TAGLIB_EXPORT
#define TAGLIB_EXPORT
Definition taglib_export.h:40
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition taglib_export.h:55
tfile.h
tstringlist.h