TagLib  2.3.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#include "matroskawritestyle.h"
30
31namespace TagLib {
32 class File;
33 class ByteVector;
34
35 namespace Matroska {
36 class TAGLIB_EXPORT Element
37 {
38 public:
39 using ID = unsigned int;
40 explicit Element(ID id);
41 virtual ~Element();
42
43 offset_t size() const;
44 offset_t offset() const;
45 ID id() const;
46 void setOffset(offset_t offset);
47 void adjustOffset(offset_t delta);
48 void setSize(offset_t size);
49 void setID(ID id);
50 virtual bool render();
51 void setNeedsRender(bool needsRender);
52 bool needsRender() const;
53 void setData(const ByteVector &data);
54 const ByteVector &data() const;
55 virtual void write(TagLib::File &file);
56 void clearSizeListeners();
57 void addSizeListener(Element *element);
58 void addSizeListeners(const List<Element *> &elements);
59 bool emitSizeChanged(offset_t delta);
60 virtual bool sizeChanged(Element &caller, offset_t delta);
61
62 void setWriteStyle(WriteStyle style);
63 WriteStyle writeStyle() const;
64 void setIsLastElement(bool isLast);
65 void setAppendOffset(offset_t appendOffset);
66 bool wasMoved() const;
70 void setIsTrailingInSegment(bool isTrailing);
71 bool isTrailingInSegment() const;
72
73 protected:
74 offset_t sizeRenderedOrWritten() const;
75
76 private:
77 virtual ByteVector renderInternal() = 0;
78
79 class ElementPrivate;
81 std::unique_ptr<ElementPrivate> e;
82 };
83 }
84}
85
86#endif
87#endif
A byte vector.
Definition tbytevector.h:46
A file class with some useful methods for tag manipulation.
Definition tfile.h:51
An implementation of Matroska metadata.
Definition matroskaattachedfile.h:32
WriteStyle
Definition matroskawritestyle.h:36
A namespace for all TagLib related classes and functions.
Definition apefile.h:41
off_t offset_t
Definition taglib.h:64
#define TAGLIB_EXPORT
Definition taglib_export.h:40
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition taglib_export.h:55