TagLib  2.2.1
matroskaelement.h
Go to the documentation of this file.
1 /***************************************************************************
2  * This library is free software; you can redistribute it and/or modify *
3  * it under the terms of the GNU Lesser General Public License version *
4  * 2.1 as published by the Free Software Foundation. *
5  * *
6  * This library is distributed in the hope that it will be useful, but *
7  * WITHOUT ANY WARRANTY; without even the implied warranty of *
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
9  * Lesser General Public License for more details. *
10  * *
11  * You should have received a copy of the GNU Lesser General Public *
12  * License along with this library; if not, write to the Free Software *
13  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
14  * 02110-1301 USA *
15  * *
16  * Alternatively, this file is available under the Mozilla Public *
17  * License Version 1.1. You may obtain a copy of the License at *
18  * http://www.mozilla.org/MPL/ *
19  ***************************************************************************/
20 
21 #ifndef TAGLIB_MATROSKAELEMENT_H
22 #define TAGLIB_MATROSKAELEMENT_H
23 #ifndef DO_NOT_DOCUMENT
24 
25 #include <memory>
26 #include "taglib_export.h"
27 #include "taglib.h"
28 #include "tlist.h"
29 
30 namespace TagLib {
31  class File;
32  class ByteVector;
33 
34  namespace Matroska {
35  class TAGLIB_EXPORT Element
36  {
37  public:
38  using ID = unsigned int;
39  explicit Element(ID id);
40  virtual ~Element();
41 
42  offset_t size() const;
43  offset_t offset() const;
44  ID id() const;
45  void setOffset(offset_t offset);
46  void adjustOffset(offset_t delta);
47  void setSize(offset_t size);
48  void setID(ID id);
49  virtual bool render();
50  void setNeedsRender(bool needsRender);
51  bool needsRender() const;
52  void setData(const ByteVector &data);
53  const ByteVector &data() const;
54  virtual void write(TagLib::File &file);
55  void addSizeListener(Element *element);
56  void addSizeListeners(const List<Element *> &elements);
57  bool emitSizeChanged(offset_t delta);
58  virtual bool sizeChanged(Element &caller, offset_t delta);
59 
60  protected:
61  offset_t sizeRenderedOrWritten() const;
62 
63  private:
64  virtual ByteVector renderInternal() = 0;
65 
66  class ElementPrivate;
68  std::unique_ptr<ElementPrivate> e;
69  };
70  }
71 }
72 
73 #endif
74 #endif
A file class with some useful methods for tag manipulation.
Definition: tfile.h:50
#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