tiostream.h
Go to the documentation of this file.
/***************************************************************************
copyright : (C) 2011 by Lukas Lalinsky
email : lalinsky@gmail.com
***************************************************************************/
/***************************************************************************
* 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_IOSTREAM_H
#define TAGLIB_IOSTREAM_H
#include "tbytevector.h"
#include "taglib_export.h"
#include "taglib.h"
#ifdef _WIN32
#include <string>
#endif
namespace TagLib {
#ifdef _WIN32
class TAGLIB_EXPORT FileName
{
public:
FileName(const wchar_t *name);
FileName(const char *name);
FileName(const FileName &name);
operator const wchar_t *() const;
const std::wstring &wstr() const;
String toString() const;
private:
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
const std::wstring m_wname;
};
#else
using FileName = const char *;
#endif
class TAGLIB_EXPORT IOStream
{
public:
enum Position {
Beginning,
Current,
End
};
IOStream();
virtual ~IOStream();
IOStream(const IOStream &) = delete;
IOStream &operator=(const IOStream &) = delete;
virtual FileName name() const = 0;
virtual ByteVector readBlock(size_t length) = 0;
virtual void writeBlock(const ByteVector &data) = 0;
virtual void insert(const ByteVector &data,
offset_t start = 0, size_t replace = 0) = 0;
virtual void removeBlock(offset_t start = 0, size_t length = 0) = 0;
virtual bool readOnly() const = 0;
virtual bool isOpen() const = 0;
virtual void seek(offset_t offset, Position p = Beginning) = 0;
virtual void clear();
virtual offset_t tell() const = 0;
virtual offset_t length() = 0;
virtual void truncate(offset_t length) = 0;
private:
class IOStreamPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<IOStreamPrivate> d;
};
} // namespace TagLib
#endif
TagLib::ByteVector
A byte vector.
Definition tbytevector.h:46
TagLib::IOStream::readBlock
virtual ByteVector readBlock(size_t length)=0
TagLib::IOStream::seek
virtual void seek(offset_t offset, Position p=Beginning)=0
TagLib::IOStream::insert
virtual void insert(const ByteVector &data, offset_t start=0, size_t replace=0)=0
TagLib::IOStream::readOnly
virtual bool readOnly() const =0
TagLib::IOStream::length
virtual offset_t length()=0
TagLib::IOStream::removeBlock
virtual void removeBlock(offset_t start=0, size_t length=0)=0
TagLib::IOStream::~IOStream
virtual ~IOStream()
TagLib::IOStream::isOpen
virtual bool isOpen() const =0
TagLib::IOStream::clear
virtual void clear()
TagLib::IOStream::writeBlock
virtual void writeBlock(const ByteVector &data)=0
TagLib::IOStream::truncate
virtual void truncate(offset_t length)=0
TagLib::IOStream::Position
Position
Definition tiostream.h:70
TagLib::IOStream::End
@ End
Seek from the end of the file.
Definition tiostream.h:76
TagLib::IOStream::Current
@ Current
Seek from the current position in the file.
Definition tiostream.h:74
TagLib::IOStream::Beginning
@ Beginning
Seek from the beginning of the file.
Definition tiostream.h:72
TagLib::IOStream::IOStream
IOStream(const IOStream &)=delete
TagLib::IOStream::operator=
IOStream & operator=(const IOStream &)=delete
TagLib::IOStream::IOStream
IOStream()
TagLib::IOStream::tell
virtual offset_t tell() const =0
TagLib::IOStream::name
virtual FileName name() const =0
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
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