TagLib API Documentation
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 "tbytevector.h"
30#include "taglib_export.h"
31#include "taglib.h"
32
33#ifdef _WIN32
34#include <string>
35#endif
36
37namespace TagLib {
38
39#ifdef _WIN32
41 {
42 public:
43 FileName(const wchar_t *name);
44 FileName(const char *name);
45
46 FileName(const FileName &name);
47
48 operator const wchar_t *() const;
49
50 const std::wstring &wstr() const;
51
52 String toString() const;
53
54 private:
56 const std::wstring m_wname;
57 };
58#else
59 using FileName = const char *;
60#endif
61
63
65 {
66 public:
70 enum Position {
76 End
77 };
78
80
84 virtual ~IOStream();
85
86 IOStream(const IOStream &) = delete;
87 IOStream &operator=(const IOStream &) = delete;
88
92 virtual FileName name() const = 0;
93
97 virtual ByteVector readBlock(size_t length) = 0;
98
108 virtual void writeBlock(const ByteVector &data) = 0;
109
117 virtual void insert(const ByteVector &data,
118 offset_t start = 0, size_t replace = 0) = 0;
119
127 virtual void removeBlock(offset_t start = 0, size_t length = 0) = 0;
128
132 virtual bool readOnly() const = 0;
133
138 virtual bool isOpen() const = 0;
139
146 virtual void seek(offset_t offset, Position p = Beginning) = 0;
147
151 virtual void clear();
152
156 virtual offset_t tell() const = 0;
157
161 virtual offset_t length() = 0;
162
166 virtual void truncate(offset_t length) = 0;
167
168 private:
169 class IOStreamPrivate;
171 std::unique_ptr<IOStreamPrivate> d;
172 };
173
174} // namespace TagLib
175
176#endif
A byte vector.
Definition: tbytevector.h:46
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:65
virtual ByteVector readBlock(size_t length)=0
virtual void seek(offset_t offset, Position p=Beginning)=0
virtual void insert(const ByteVector &data, offset_t start=0, size_t replace=0)=0
virtual bool readOnly() const =0
virtual offset_t length()=0
virtual void removeBlock(offset_t start=0, size_t length=0)=0
virtual ~IOStream()
virtual bool isOpen() const =0
virtual void clear()
virtual void writeBlock(const ByteVector &data)=0
virtual void truncate(offset_t length)=0
Position
Definition: tiostream.h:70
@ Current
Seek from the current position in the file.
Definition: tiostream.h:74
@ Beginning
Seek from the beginning of the file.
Definition: tiostream.h:72
IOStream(const IOStream &)=delete
IOStream & operator=(const IOStream &)=delete
virtual offset_t tell() const =0
virtual FileName name() const =0
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
off_t offset_t
Definition: taglib.h:64
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