3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / plugins / matroska / libebml / ebml / EbmlBinary.h
blobb5f68d643bc891aecb1953bcf82fba04edc316a9
1 /****************************************************************************
2 ** libebml : parse EBML files, see http://embl.sourceforge.net/
3 **
4 ** <file/class description>
5 **
6 ** Copyright (C) 2002-2005 Steve Lhomme. All rights reserved.
7 **
8 ** This file is part of libebml.
9 **
10 ** This library is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU Lesser General Public
12 ** License as published by the Free Software Foundation; either
13 ** version 2.1 of the License, or (at your option) any later version.
14 **
15 ** This library is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** Lesser General Public License for more details.
19 **
20 ** You should have received a copy of the GNU Lesser General Public
21 ** License along with this library; if not, write to the Free Software
22 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
26 ** Contact license@matroska.org if any conditions of this licensing are
27 ** not clear to you.
29 **********************************************************************/
31 /*!
32 \file
33 \version \$Id: EbmlBinary.h 1298 2008-02-21 22:14:18Z mosu $
34 \author Steve Lhomme <robux4 @ users.sf.net>
35 \author Julien Coloos <suiryc @ users.sf.net>
37 #ifndef LIBEBML_BINARY_H
38 #define LIBEBML_BINARY_H
40 #include <string>
41 #include <cstring>
43 #include "EbmlTypes.h"
44 #include "EbmlElement.h"
46 // ----- Added 10/15/2003 by jcsston from Zen -----
47 #if defined (__BORLANDC__) //Maybe other compilers?
48 #include <mem.h>
49 #endif //__BORLANDC__
50 // ------------------------------------------------
52 START_LIBEBML_NAMESPACE
54 /*!
55 \class EbmlBinary
56 \brief Handle all operations on an EBML element that contains "unknown" binary data
58 \todo handle fix sized elements (like UID of CodecID)
60 class EBML_DLL_API EbmlBinary : public EbmlElement {
61 public:
62 EbmlBinary();
63 EbmlBinary(const EbmlBinary & ElementToClone);
64 virtual ~EbmlBinary(void);
66 uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
67 uint64 ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
68 uint64 UpdateSize(bool bKeepIntact = false, bool bForceRender = false);
70 void SetBuffer(const binary *Buffer, const uint32 BufferSize) {
71 Data = (binary *) Buffer;
72 Size = BufferSize;
73 bValueIsSet = true;
76 binary *GetBuffer() const {return Data;}
78 void CopyBuffer(const binary *Buffer, const uint32 BufferSize) {
79 if (Data != NULL)
80 free(Data);
81 Data = (binary *)malloc(BufferSize * sizeof(binary));
82 memcpy(Data, Buffer, BufferSize);
83 Size = BufferSize;
84 bValueIsSet = true;
87 uint64 GetSize() const {return Size;}
88 operator const binary &() const {return *Data;}
90 bool IsDefaultValue() const {
91 return false;
94 bool operator==(const EbmlBinary & ElementToCompare) const;
96 protected:
97 binary *Data; // the binary data inside the element
100 END_LIBEBML_NAMESPACE
102 #endif // LIBEBML_BINARY_H