TagLib  2.0.2
tfilestream.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2002 - 2008 by Scott Wheeler
3  email : wheeler@kde.org
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_FILESTREAM_H
27 #define TAGLIB_FILESTREAM_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:
49  FileStream(FileName fileName, bool openReadOnly = false);
50 
54  FileStream(int fileDescriptor, bool openReadOnly = false);
55 
59  ~FileStream() override;
60 
61  FileStream(const FileStream &) = delete;
62  FileStream &operator=(const FileStream &) = delete;
63 
67  FileName name() const override;
68 
72  ByteVector readBlock(size_t length) override;
73 
83  void writeBlock(const ByteVector &data) override;
84 
92  void insert(const ByteVector &data, offset_t start = 0, size_t replace = 0) override;
93 
101  void removeBlock(offset_t start = 0, size_t length = 0) override;
102 
106  bool readOnly() const override;
107 
112  bool isOpen() const override;
113 
120  void seek(offset_t offset, Position p = Beginning) override;
121 
125  void clear() override;
126 
130  offset_t tell() const override;
131 
135  offset_t length() override;
136 
140  void truncate(offset_t length) override;
141 
142  protected:
143 
147  static unsigned int bufferSize();
148 
149  private:
150  class FileStreamPrivate;
152  std::unique_ptr<FileStreamPrivate> d;
153  };
154 
155 } // namespace TagLib
156 
157 #endif
I/O stream with data from a file.
Definition: tfilestream.h:42
An abstract class that provides operations on a sequence of bytes.
Definition: tiostream.h:64
Position
Definition: tiostream.h:70
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