| TagLib 1.13 |  |

tiostream.h
Go to the documentation of this file.
1/***************************************************************************
2 copyright : (C) 2011 by Lukas Lalinsky
3 email : lalinsky@gmail.com
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_IOSTREAM_H
27#define TAGLIB_IOSTREAM_H
28
29#include "taglib_export.h"
30#include "taglib.h"
31#include "tbytevector.h"
32
33 namespace TagLib {
34
35#ifdef _WIN32
36 class TAGLIB_EXPORT FileName
37 {
38 public:
39 FileName(const wchar_t *name);
40 FileName(const char *name);
41
42 FileName(const FileName &name);
43
44 operator const wchar_t *() const;
45 operator const char *() const;
46
47 const std::wstring &wstr() const;
48 const std::string &str() const;
49
50 String toString() const;
51
52 private:
53 const std::string m_name;
54 const std::wstring m_wname;
55 };
56#else
57 typedef const char *FileName;
58#endif
59
61
62 class TAGLIB_EXPORT IOStream
63 {
64 public:
68 enum Position {
70 Beginning,
72 Current,
74 End
75 };
76
77 IOStream();
78
82 virtual ~IOStream();
83
87 virtual FileName name() const = 0;
88
92 virtual ByteVector readBlock(unsigned long length) = 0;
93
103 virtual void writeBlock(const ByteVector &data) = 0;
104
112 virtual void insert(const ByteVector &data,
113 unsigned long start = 0, unsigned long replace = 0) = 0;
114
122 virtual void removeBlock(unsigned long start = 0, unsigned long length = 0) = 0;
123
127 virtual bool readOnly() const = 0;
128
133 virtual bool isOpen() const = 0;
134
141 virtual void seek(long offset, Position p = Beginning) = 0;
142
146 virtual void clear();
147
151 virtual long tell() const = 0;
152
156 virtual long length() = 0;
157
161 virtual void truncate(long length) = 0;
162
163 private:
164 IOStream(const IOStream &);
165 IOStream &operator=(const IOStream &);
166 };
167
168}
169
170#endif
TagLib::ByteVector
A byte vector.
Definition: tbytevector.h:46
TagLib::IOStream
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:63
TagLib::IOStream::removeBlock
virtual void removeBlock(unsigned long start=0, unsigned long length=0)=0
TagLib::IOStream::insert
virtual void insert(const ByteVector &data, unsigned long start=0, unsigned long replace=0)=0
TagLib::IOStream::readOnly
virtual bool readOnly() const =0
TagLib::IOStream::truncate
virtual void truncate(long length)=0
TagLib::IOStream::~IOStream
virtual ~IOStream()
TagLib::IOStream::seek
virtual void seek(long offset, Position p=Beginning)=0
TagLib::IOStream::isOpen
virtual bool isOpen() const =0
TagLib::IOStream::length
virtual long length()=0
TagLib::IOStream::clear
virtual void clear()
TagLib::IOStream::writeBlock
virtual void writeBlock(const ByteVector &data)=0
TagLib::IOStream::readBlock
virtual ByteVector readBlock(unsigned long length)=0
TagLib::IOStream::Position
Position
Definition: tiostream.h:68
TagLib::IOStream::Current
@ Current
Seek from the current position in the file.
Definition: tiostream.h:72
TagLib::IOStream::Beginning
@ Beginning
Seek from the beginning of the file.
Definition: tiostream.h:70
TagLib::IOStream::IOStream
IOStream()
TagLib::IOStream::name
virtual FileName name() const =0
TagLib::IOStream::tell
virtual long tell() const =0
TagLib
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
TagLib::FileName
const char * FileName
Definition: tiostream.h:57
TagLib::wstring
std::basic_string< wchar_t > wstring
Definition: taglib.h:86
taglib.h
taglib_export.h
TAGLIB_EXPORT
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
tbytevector.h