TagLib  1.13.1
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
33namespace TagLib {
34
35#ifdef _WIN32
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
63 {
64 public:
76
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} // namespace TagLib
169
170#endif
A byte vector.
Definition tbytevector.h:46
virtual void removeBlock(unsigned long start=0, unsigned long length=0)=0
virtual void insert(const ByteVector &data, unsigned long start=0, unsigned long replace=0)=0
virtual bool readOnly() const =0
virtual void truncate(long length)=0
virtual ~IOStream()
virtual void seek(long offset, Position p=Beginning)=0
virtual bool isOpen() const =0
virtual long length()=0
virtual void clear()
virtual void writeBlock(const ByteVector &data)=0
virtual ByteVector readBlock(unsigned long length)=0
Position
Definition tiostream.h:68
@ End
Seek from the end of the file.
Definition tiostream.h:74
@ Current
Seek from the current position in the file.
Definition tiostream.h:72
@ Beginning
Seek from the beginning of the file.
Definition tiostream.h:70
virtual FileName name() const =0
virtual long tell() const =0
A namespace for all TagLib related classes and functions.
Definition apefile.h:41
const char * FileName
Definition tiostream.h:57
#define TAGLIB_EXPORT
Definition taglib_export.h:40