tfile.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_FILE_H
#define TAGLIB_FILE_H
#include "tbytevector.h"
#include "tiostream.h"
#include "taglib_export.h"
#include "taglib.h"
#include "tag.h"
namespace TagLib {
class String;
class Tag;
class AudioProperties;
class PropertyMap;
class TAGLIB_EXPORT File
{
public:
enum Position {
Beginning,
Current,
End
};
enum StripTags {
StripNone,
StripOthers
};
enum DuplicateTags {
Duplicate,
DoNotDuplicate
};
virtual ~File();
File(const File &) = delete;
File &operator=(const File &) = delete;
FileName name() const;
virtual Tag *tag() const = 0;
virtual PropertyMap properties() const;
virtual void removeUnsupportedProperties(const StringList& properties);
virtual PropertyMap setProperties(const PropertyMap &properties);
virtual StringList complexPropertyKeys() const;
virtual List<VariantMap> complexProperties(const String &key) const;
virtual bool setComplexProperties(const String &key, const List<VariantMap> &value);
virtual AudioProperties *audioProperties() const = 0;
virtual bool save() = 0;
ByteVector readBlock(size_t length);
void writeBlock(const ByteVector &data);
offset_t find(const ByteVector &pattern,
offset_t fromOffset = 0,
const ByteVector &before = ByteVector());
offset_t rfind(const ByteVector &pattern,
offset_t fromOffset = 0,
const ByteVector &before = ByteVector());
void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0);
void removeBlock(offset_t start = 0, size_t length = 0);
bool readOnly() const;
bool isOpen() const;
bool isValid() const;
void seek(offset_t offset, Position p = Beginning);
void clear();
offset_t tell() const;
offset_t length();
protected:
File(FileName fileName);
File(IOStream *stream);
void setValid(bool valid);
void truncate(offset_t length);
static unsigned int bufferSize();
private:
class FilePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FilePrivate> d;
};
} // namespace TagLib
#endif
TagLib::AudioProperties
A simple, abstract interface to common audio properties.
Definition audioproperties.h:46
TagLib::ByteVector
A byte vector.
Definition tbytevector.h:46
TagLib::File::rfind
offset_t rfind(const ByteVector &pattern, offset_t fromOffset=0, const ByteVector &before=ByteVector())
TagLib::File::StripTags
StripTags
Definition tfile.h:68
TagLib::File::StripOthers
@ StripOthers
Strip all tags not explicitly referenced in method call.
Definition tfile.h:70
TagLib::File::StripNone
@ StripNone
Don't strip any tags.
Definition tfile.h:69
TagLib::File::isOpen
bool isOpen() const
TagLib::File::writeBlock
void writeBlock(const ByteVector &data)
TagLib::File::setProperties
virtual PropertyMap setProperties(const PropertyMap &properties)
TagLib::File::File
File(IOStream *stream)
TagLib::File::properties
virtual PropertyMap properties() const
TagLib::File::complexProperties
virtual List< VariantMap > complexProperties(const String &key) const
TagLib::File::audioProperties
virtual AudioProperties * audioProperties() const =0
TagLib::File::insert
void insert(const ByteVector &data, offset_t start=0, size_t replace=0)
TagLib::File::setComplexProperties
virtual bool setComplexProperties(const String &key, const List< VariantMap > &value)
TagLib::File::readOnly
bool readOnly() const
TagLib::File::clear
void clear()
TagLib::File::complexPropertyKeys
virtual StringList complexPropertyKeys() const
TagLib::File::truncate
void truncate(offset_t length)
TagLib::File::removeBlock
void removeBlock(offset_t start=0, size_t length=0)
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::End
@ End
Seek from the end of the file.
Definition tfile.h:62
TagLib::File::~File
virtual ~File()
TagLib::File::name
FileName name() const
TagLib::File::length
offset_t length()
TagLib::File::operator=
File & operator=(const File &)=delete
TagLib::File::setValid
void setValid(bool valid)
TagLib::File::isValid
bool isValid() const
TagLib::File::save
virtual bool save()=0
TagLib::File::DuplicateTags
DuplicateTags
Definition tfile.h:77
TagLib::File::Duplicate
@ Duplicate
Synchronize values between different tag types.
Definition tfile.h:78
TagLib::File::DoNotDuplicate
@ DoNotDuplicate
Do not synchronize values between different tag types.
Definition tfile.h:79
TagLib::File::seek
void seek(offset_t offset, Position p=Beginning)
TagLib::File::find
offset_t find(const ByteVector &pattern, offset_t fromOffset=0, const ByteVector &before=ByteVector())
TagLib::File::File
File(FileName fileName)
TagLib::File::tell
offset_t tell() const
TagLib::File::readBlock
ByteVector readBlock(size_t length)
TagLib::File::File
File(const File &)=delete
TagLib::File::removeUnsupportedProperties
virtual void removeUnsupportedProperties(const StringList &properties)
TagLib::File::bufferSize
static unsigned int bufferSize()
TagLib::File::tag
virtual Tag * tag() const =0
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::offset_t
off_t offset_t
Definition taglib.h:64
tag.h
taglib.h
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
tbytevector.h
tiostream.h