disable access to internal values when EBML_STRICT_API is defined
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@20 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
c331b9b443
commit
66f1b56fba
@ -95,6 +95,9 @@ class EBML_DLL_API EbmlBinary : public EbmlElement {
|
|||||||
protected:
|
protected:
|
||||||
binary *GetData() const {return Data;}
|
binary *GetData() const {return Data;}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
binary *Data; // the binary data inside the element
|
binary *Data; // the binary data inside the element
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +99,11 @@ class EBML_DLL_API EbmlCrc32 : public EbmlBinary {
|
|||||||
|
|
||||||
void ForceCrc32(uint32 NewValue) { m_crc_final = NewValue; SetValueIsSet();}
|
void ForceCrc32(uint32 NewValue) { m_crc_final = NewValue; SetValueIsSet();}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
void ResetCRC() {m_crc = CRC32_NEGL;}
|
void ResetCRC() {m_crc = CRC32_NEGL;}
|
||||||
void UpdateByte(binary b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
|
void UpdateByte(binary b) {m_crc = m_tab[CRC32_INDEX(m_crc) ^ b] ^ CRC32_SHIFTED(m_crc);}
|
||||||
|
|
||||||
|
@ -81,7 +81,11 @@ class EBML_DLL_API EbmlDate : public EbmlElement {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||||
|
|
||||||
int64 myDate; ///< internal format of the date
|
int64 myDate; ///< internal format of the date
|
||||||
|
@ -50,7 +50,11 @@ class EBML_DLL_API EbmlDummy : public EbmlBinary {
|
|||||||
bool IsDummy() const {return true;}
|
bool IsDummy() const {return true;}
|
||||||
bool IsDefaultValue() const {return true;}
|
bool IsDefaultValue() const {return true;}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
const EbmlId DummyId;
|
const EbmlId DummyId;
|
||||||
static const EbmlId DummyRawId;
|
static const EbmlId DummyRawId;
|
||||||
|
|
||||||
|
@ -144,6 +144,25 @@ class EBML_DLL_API EbmlSemanticContext {
|
|||||||
const EbmlCallbacks *MasterElt;
|
const EbmlCallbacks *MasterElt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
#define EBML_CONCRETE_CLASS(Type) \
|
||||||
|
public: \
|
||||||
|
virtual const EbmlSemanticContext &Context() const {return ClassInfos.Context;} \
|
||||||
|
virtual const char *DebugName() const {return ClassInfos.DebugName;} \
|
||||||
|
virtual operator const EbmlId &() const {return ClassInfos.GlobalId;} \
|
||||||
|
virtual EbmlElement & CreateElement() const {return Create();} \
|
||||||
|
virtual EbmlElement * Clone() const { return new Type(*this); } \
|
||||||
|
static EbmlElement & Create() {return *(new Type);} \
|
||||||
|
static const EbmlCallbacks & ClassInfo() {return ClassInfos;} \
|
||||||
|
static const EbmlId & ClassId() {return ClassInfos.GlobalId;} \
|
||||||
|
private: \
|
||||||
|
static const EbmlCallbacks ClassInfos; \
|
||||||
|
|
||||||
|
#define EBML_INFO(ref) ref::ClassInfo()
|
||||||
|
#define EBML_ID(ref) ref::ClassId()
|
||||||
|
#define EBML_CONTEXT(e) e->Context()
|
||||||
|
#define EBML_NAME(e) e->DebugName()
|
||||||
|
#else
|
||||||
#define EBML_CONCRETE_CLASS(Type) \
|
#define EBML_CONCRETE_CLASS(Type) \
|
||||||
public: \
|
public: \
|
||||||
virtual const EbmlCallbacks & Generic() const {return ClassInfos;} \
|
virtual const EbmlCallbacks & Generic() const {return ClassInfos;} \
|
||||||
@ -157,6 +176,7 @@ class EBML_DLL_API EbmlSemanticContext {
|
|||||||
#define EBML_ID(ref) ref::ClassInfos.GlobalId
|
#define EBML_ID(ref) ref::ClassInfos.GlobalId
|
||||||
#define EBML_CONTEXT(e) e->Generic().Context
|
#define EBML_CONTEXT(e) e->Generic().Context
|
||||||
#define EBML_NAME(e) e->Generic().DebugName
|
#define EBML_NAME(e) e->Generic().DebugName
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class EbmlElement
|
\class EbmlElement
|
||||||
@ -188,8 +208,13 @@ class EBML_DLL_API EbmlElement {
|
|||||||
virtual EbmlElement * Clone() const = 0;
|
virtual EbmlElement * Clone() const = 0;
|
||||||
|
|
||||||
virtual operator const EbmlId &() const = 0;
|
virtual operator const EbmlId &() const = 0;
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
virtual const char *DebugName() const = 0;
|
||||||
|
virtual const EbmlSemanticContext &Context() const = 0;
|
||||||
|
#else
|
||||||
/// return the generic callback to monitor a derived class
|
/// return the generic callback to monitor a derived class
|
||||||
virtual const EbmlCallbacks & Generic() const = 0;
|
virtual const EbmlCallbacks & Generic() const = 0;
|
||||||
|
#endif
|
||||||
virtual EbmlElement & CreateElement() const = 0;
|
virtual EbmlElement & CreateElement() const = 0;
|
||||||
|
|
||||||
// by default only allow to set element as finite (override when needed)
|
// by default only allow to set element as finite (override when needed)
|
||||||
@ -285,6 +310,9 @@ class EBML_DLL_API EbmlElement {
|
|||||||
inline void SetSizeIsFinite(bool Set = true) {bSizeIsFinite = Set;}
|
inline void SetSizeIsFinite(bool Set = true) {bSizeIsFinite = Set;}
|
||||||
inline uint64 GetSizePosition() const {return SizePosition;}
|
inline uint64 GetSizePosition() const {return SizePosition;}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
uint64 Size; ///< the size of the data to write
|
uint64 Size; ///< the size of the data to write
|
||||||
uint64 DefaultSize; ///< Minimum data size to fill on rendering (0 = optimal)
|
uint64 DefaultSize; ///< Minimum data size to fill on rendering (0 = optimal)
|
||||||
int SizeLength; /// the minimum size on which the size will be written (0 = optimal)
|
int SizeLength; /// the minimum size on which the size will be written (0 = optimal)
|
||||||
|
@ -86,7 +86,11 @@ template<class TYPE, endianess ENDIAN> class Endian
|
|||||||
inline size_t size() const { return sizeof(TYPE); }
|
inline size_t size() const { return sizeof(TYPE); }
|
||||||
inline bool operator!=(const binary *buffer) const {return *((TYPE*)buffer) == platform_value;}
|
inline bool operator!=(const binary *buffer) const {return *((TYPE*)buffer) == platform_value;}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
TYPE platform_value;
|
TYPE platform_value;
|
||||||
TYPE endian_value;
|
TYPE endian_value;
|
||||||
|
|
||||||
|
@ -90,7 +90,11 @@ class EBML_DLL_API EbmlFloat : public EbmlElement {
|
|||||||
return (DefaultISset() && Value == DefaultValue);
|
return (DefaultISset() && Value == DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
double Value; /// The actual value of the element
|
double Value; /// The actual value of the element
|
||||||
double DefaultValue;
|
double DefaultValue;
|
||||||
};
|
};
|
||||||
|
@ -40,8 +40,15 @@
|
|||||||
|
|
||||||
START_LIBEBML_NAMESPACE
|
START_LIBEBML_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
#define EBML_ID_VALUE(id) id.GetValue()
|
||||||
|
#define EBML_ID_LENGTH(id) id.GetLength()
|
||||||
|
#else
|
||||||
#define EBML_ID_VALUE(id) id.Value
|
#define EBML_ID_VALUE(id) id.Value
|
||||||
#define EBML_ID_LENGTH(id) id.Length
|
#define EBML_ID_LENGTH(id) id.Length
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class EbmlId
|
\class EbmlId
|
||||||
*/
|
*/
|
||||||
@ -80,6 +87,9 @@ class EBML_DLL_API EbmlId {
|
|||||||
inline size_t GetLength() const { return Length; }
|
inline size_t GetLength() const { return Length; }
|
||||||
inline uint32 GetValue() const { return Value; }
|
inline uint32 GetValue() const { return Value; }
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
uint32 Value;
|
uint32 Value;
|
||||||
size_t Length;
|
size_t Length;
|
||||||
};
|
};
|
||||||
|
@ -164,7 +164,11 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
|||||||
*/
|
*/
|
||||||
std::vector<std::string> FindAllMissingElements();
|
std::vector<std::string> FindAllMissingElements();
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
std::vector<EbmlElement *> ElementList;
|
std::vector<EbmlElement *> ElementList;
|
||||||
|
|
||||||
const EbmlSemanticContext & Context;
|
const EbmlSemanticContext & Context;
|
||||||
|
@ -82,7 +82,11 @@ class EBML_DLL_API EbmlSInteger : public EbmlElement {
|
|||||||
return (DefaultISset() && Value == DefaultValue);
|
return (DefaultISset() && Value == DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
int64 Value; /// The actual value of the element
|
int64 Value; /// The actual value of the element
|
||||||
int64 DefaultValue;
|
int64 DefaultValue;
|
||||||
};
|
};
|
||||||
|
@ -63,7 +63,11 @@ class EBML_DLL_API EbmlStream {
|
|||||||
inline IOCallback & I_O() {return Stream;}
|
inline IOCallback & I_O() {return Stream;}
|
||||||
operator IOCallback &() {return Stream;}
|
operator IOCallback &() {return Stream;}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
IOCallback & Stream;
|
IOCallback & Stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,11 @@ class EBML_DLL_API EbmlString : public EbmlElement {
|
|||||||
return (DefaultISset() && Value == DefaultValue);
|
return (DefaultISset() && Value == DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
std::string Value; /// The actual value of the element
|
std::string Value; /// The actual value of the element
|
||||||
std::string DefaultValue;
|
std::string DefaultValue;
|
||||||
};
|
};
|
||||||
|
@ -82,7 +82,11 @@ class EBML_DLL_API EbmlUInteger : public EbmlElement {
|
|||||||
return (DefaultISset() && Value == DefaultValue);
|
return (DefaultISset() && Value == DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
uint64 Value; /// The actual value of the element
|
uint64 Value; /// The actual value of the element
|
||||||
uint64 DefaultValue;
|
uint64 DefaultValue;
|
||||||
};
|
};
|
||||||
|
@ -77,7 +77,11 @@ public:
|
|||||||
const std::string & GetUTF8() const {return UTF8string;}
|
const std::string & GetUTF8() const {return UTF8string;}
|
||||||
void SetUTF8(const std::string &);
|
void SetUTF8(const std::string &);
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
size_t _Length; ///< length of the UCS string excluding the \0
|
size_t _Length; ///< length of the UCS string excluding the \0
|
||||||
wchar_t* _Data; ///< internal UCS representation
|
wchar_t* _Data; ///< internal UCS representation
|
||||||
std::string UTF8string;
|
std::string UTF8string;
|
||||||
@ -116,7 +120,11 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElement {
|
|||||||
return (DefaultISset() && Value == DefaultValue);
|
return (DefaultISset() && Value == DefaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(EBML_STRICT_API)
|
||||||
|
private:
|
||||||
|
#else
|
||||||
protected:
|
protected:
|
||||||
|
#endif
|
||||||
UTFstring Value; /// The actual value of the element
|
UTFstring Value; /// The actual value of the element
|
||||||
UTFstring DefaultValue;
|
UTFstring DefaultValue;
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,7 @@ LIB ebml
|
|||||||
|
|
||||||
INCLUDE .
|
INCLUDE .
|
||||||
EXPINCLUDE .
|
EXPINCLUDE .
|
||||||
|
EXPDEFINE(USE_EBML_STRICT_API) EBML_STRICT_API
|
||||||
|
|
||||||
// OPTIMIZE_GLOBALLY .
|
// OPTIMIZE_GLOBALLY .
|
||||||
FAVOR_MAX_SPEED .
|
FAVOR_MAX_SPEED .
|
||||||
|
Loading…
Reference in New Issue
Block a user