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:
|
||||
binary *GetData() const {return Data;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#endif
|
||||
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();}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
void ResetCRC() {m_crc = CRC32_NEGL;}
|
||||
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;
|
||||
}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
uint32 RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact = false);
|
||||
|
||||
int64 myDate; ///< internal format of the date
|
||||
|
@ -50,7 +50,11 @@ class EBML_DLL_API EbmlDummy : public EbmlBinary {
|
||||
bool IsDummy() const {return true;}
|
||||
bool IsDefaultValue() const {return true;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
const EbmlId DummyId;
|
||||
static const EbmlId DummyRawId;
|
||||
|
||||
|
@ -144,6 +144,25 @@ class EBML_DLL_API EbmlSemanticContext {
|
||||
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) \
|
||||
public: \
|
||||
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_CONTEXT(e) e->Generic().Context
|
||||
#define EBML_NAME(e) e->Generic().DebugName
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class EbmlElement
|
||||
@ -188,8 +208,13 @@ class EBML_DLL_API EbmlElement {
|
||||
virtual EbmlElement * Clone() 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
|
||||
virtual const EbmlCallbacks & Generic() const = 0;
|
||||
#endif
|
||||
virtual EbmlElement & CreateElement() const = 0;
|
||||
|
||||
// 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 uint64 GetSizePosition() const {return SizePosition;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#endif
|
||||
uint64 Size; ///< the size of the data to write
|
||||
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)
|
||||
|
@ -86,7 +86,11 @@ template<class TYPE, endianess ENDIAN> class Endian
|
||||
inline size_t size() const { return sizeof(TYPE); }
|
||||
inline bool operator!=(const binary *buffer) const {return *((TYPE*)buffer) == platform_value;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
TYPE platform_value;
|
||||
TYPE endian_value;
|
||||
|
||||
|
@ -90,7 +90,11 @@ class EBML_DLL_API EbmlFloat : public EbmlElement {
|
||||
return (DefaultISset() && Value == DefaultValue);
|
||||
}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
double Value; /// The actual value of the element
|
||||
double DefaultValue;
|
||||
};
|
||||
|
@ -40,8 +40,15 @@
|
||||
|
||||
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_LENGTH(id) id.Length
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class EbmlId
|
||||
*/
|
||||
@ -80,6 +87,9 @@ class EBML_DLL_API EbmlId {
|
||||
inline size_t GetLength() const { return Length; }
|
||||
inline uint32 GetValue() const { return Value; }
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#endif
|
||||
uint32 Value;
|
||||
size_t Length;
|
||||
};
|
||||
|
@ -164,7 +164,11 @@ class EBML_DLL_API EbmlMaster : public EbmlElement {
|
||||
*/
|
||||
std::vector<std::string> FindAllMissingElements();
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
std::vector<EbmlElement *> ElementList;
|
||||
|
||||
const EbmlSemanticContext & Context;
|
||||
|
@ -82,7 +82,11 @@ class EBML_DLL_API EbmlSInteger : public EbmlElement {
|
||||
return (DefaultISset() && Value == DefaultValue);
|
||||
}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
int64 Value; /// The actual value of the element
|
||||
int64 DefaultValue;
|
||||
};
|
||||
|
@ -63,7 +63,11 @@ class EBML_DLL_API EbmlStream {
|
||||
inline IOCallback & I_O() {return Stream;}
|
||||
operator IOCallback &() {return Stream;}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
IOCallback & Stream;
|
||||
};
|
||||
|
||||
|
@ -71,7 +71,11 @@ class EBML_DLL_API EbmlString : public EbmlElement {
|
||||
return (DefaultISset() && Value == DefaultValue);
|
||||
}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
std::string Value; /// The actual value of the element
|
||||
std::string DefaultValue;
|
||||
};
|
||||
|
@ -82,7 +82,11 @@ class EBML_DLL_API EbmlUInteger : public EbmlElement {
|
||||
return (DefaultISset() && Value == DefaultValue);
|
||||
}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
uint64 Value; /// The actual value of the element
|
||||
uint64 DefaultValue;
|
||||
};
|
||||
|
@ -77,7 +77,11 @@ public:
|
||||
const std::string & GetUTF8() const {return UTF8string;}
|
||||
void SetUTF8(const std::string &);
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
size_t _Length; ///< length of the UCS string excluding the \0
|
||||
wchar_t* _Data; ///< internal UCS representation
|
||||
std::string UTF8string;
|
||||
@ -116,7 +120,11 @@ class EBML_DLL_API EbmlUnicodeString : public EbmlElement {
|
||||
return (DefaultISset() && Value == DefaultValue);
|
||||
}
|
||||
|
||||
#if defined(EBML_STRICT_API)
|
||||
private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
UTFstring Value; /// The actual value of the element
|
||||
UTFstring DefaultValue;
|
||||
};
|
||||
|
@ -6,6 +6,7 @@ LIB ebml
|
||||
|
||||
INCLUDE .
|
||||
EXPINCLUDE .
|
||||
EXPDEFINE(USE_EBML_STRICT_API) EBML_STRICT_API
|
||||
|
||||
// OPTIMIZE_GLOBALLY .
|
||||
FAVOR_MAX_SPEED .
|
||||
|
Loading…
Reference in New Issue
Block a user