TagLib  2.0.2
tbytevectorstream.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_BYTEVECTORSTREAM_H
27 #define TAGLIB_BYTEVECTORSTREAM_H
28 
29 #include "tbytevector.h"
30 #include "tiostream.h"
31 #include "taglib_export.h"
32 #include "taglib.h"
33 
34 namespace TagLib {
35 
36  class String;
37  class Tag;
38  class AudioProperties;
39 
41 
43  {
44  public:
48  ByteVectorStream(const ByteVector &data);
49 
53  ~ByteVectorStream() override;
54 
55  ByteVectorStream(const ByteVectorStream &) = delete;
56  ByteVectorStream &operator=(const ByteVectorStream &) = delete;
57 
61  FileName name() const override;
62 
66  ByteVector readBlock(size_t length) override;
67 
75  void writeBlock(const ByteVector &data) override;
76 
84  void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0) override;
85 
93  void removeBlock(offset_t start = 0, size_t length = 0) override;
94 
98  bool readOnly() const override;
99 
103  bool isOpen() const override;
104 
111  void seek(offset_t offset, Position p = Beginning) override;
112 
116  void clear() override;
117 
121  offset_t tell() const override;
122 
126  offset_t length() override;
127 
131  void truncate(offset_t length) override;
132 
133  ByteVector *data();
134 
135  private:
136  class ByteVectorStreamPrivate;
138  std::unique_ptr<ByteVectorStreamPrivate> d;
139  };
140 
141 } // namespace TagLib
142 
143 #endif
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:64
Position
Definition: tiostream.h:70
In-memory Stream class using ByteVector for its storage.
Definition: tbytevectorstream.h:42
A byte vector.
Definition: tbytevector.h:45
const char * FileName
Definition: tiostream.h:59
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
off_t offset_t
Definition: taglib.h:64
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41