00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00037 #ifndef LIBEBML_BINARY_H
00038 #define LIBEBML_BINARY_H
00039
00040 #include <cstring>
00041
00042 #include "EbmlTypes.h"
00043 #include "EbmlElement.h"
00044
00045
00046 #if defined (__BORLANDC__) //Maybe other compilers?
00047 #include <mem.h>
00048 #endif //__BORLANDC__
00049
00050
00051 START_LIBEBML_NAMESPACE
00052
00059 class EBML_DLL_API EbmlBinary : public EbmlElement {
00060 public:
00061 EbmlBinary();
00062 EbmlBinary(const EbmlBinary & ElementToClone);
00063 virtual ~EbmlBinary(void);
00064
00065 virtual bool ValidateSize() const {return IsFiniteSize() && GetSize() < 0x7FFFFFFF;}
00066
00067 filepos_t RenderData(IOCallback & output, bool bForceRender, bool bWithDefault = false);
00068 filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA);
00069 filepos_t UpdateSize(bool bWithDefault = false, bool bForceRender = false);
00070
00071 void SetBuffer(const binary *Buffer, const uint32 BufferSize) {
00072 Data = (binary *) Buffer;
00073 SetSize_(BufferSize);
00074 SetValueIsSet();
00075 }
00076
00077 binary *GetBuffer() const {return Data;}
00078
00079 void CopyBuffer(const binary *Buffer, const uint32 BufferSize) {
00080 if (Data != NULL)
00081 free(Data);
00082 Data = (binary *)malloc(BufferSize * sizeof(binary));
00083 memcpy(Data, Buffer, BufferSize);
00084 SetSize_(BufferSize);
00085 SetValueIsSet();
00086 }
00087
00088 operator const binary &() const {return *Data;}
00089
00090 bool IsDefaultValue() const {
00091 return false;
00092 }
00093
00094 bool operator==(const EbmlBinary & ElementToCompare) const;
00095
00096 #if defined(EBML_STRICT_API)
00097 private:
00098 #else
00099 protected:
00100 #endif
00101 binary *Data;
00102 };
00103
00104 END_LIBEBML_NAMESPACE
00105
00106 #endif // LIBEBML_BINARY_H