factorize some common macros
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@26 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
cd5d717fb9
commit
baa61c54cb
@ -104,6 +104,8 @@ class EbmlElement;
|
|||||||
|
|
||||||
#define EBML_SEM_UNIQUE(s) (s).IsUnique()
|
#define EBML_SEM_UNIQUE(s) (s).IsUnique()
|
||||||
#define EBML_SEM_INFO(s) (const EbmlCallbacks &)(s)
|
#define EBML_SEM_INFO(s) (const EbmlCallbacks &)(s)
|
||||||
|
#define EBML_SEM_ID(s) ((const EbmlCallbacks &)(s)).ClassId()
|
||||||
|
#define EBML_SEM_CONTEXT(s) ((const EbmlCallbacks &)(s)).GetContext()
|
||||||
|
|
||||||
#define EBML_CTX_SIZE(c) (c).GetSize()
|
#define EBML_CTX_SIZE(c) (c).GetSize()
|
||||||
#define EBML_CTX_MASTER(c) (c).GetMaster()
|
#define EBML_CTX_MASTER(c) (c).GetMaster()
|
||||||
@ -130,6 +132,8 @@ class EbmlElement;
|
|||||||
|
|
||||||
#define EBML_SEM_UNIQUE(s) (s).Unique
|
#define EBML_SEM_UNIQUE(s) (s).Unique
|
||||||
#define EBML_SEM_INFO(s) (s).GetCallbacks
|
#define EBML_SEM_INFO(s) (s).GetCallbacks
|
||||||
|
#define EBML_SEM_ID(s) (s).GetCallbacks.GlobalId
|
||||||
|
#define EBML_SEM_CONTEXT(s) (s).GetCallbacks.Context
|
||||||
|
|
||||||
#define EBML_CTX_SIZE(c) (c).Size
|
#define EBML_CTX_SIZE(c) (c).Size
|
||||||
#define EBML_CTX_MASTER(c) (c).MasterElt
|
#define EBML_CTX_MASTER(c) (c).MasterElt
|
||||||
|
@ -483,9 +483,9 @@ EbmlElement * EbmlElement::SkipData(EbmlStream & DataStream, const EbmlSemanticC
|
|||||||
unsigned int EltIndex;
|
unsigned int EltIndex;
|
||||||
// data known in this Master's context
|
// data known in this Master's context
|
||||||
for (EltIndex = 0; EltIndex < EBML_CTX_SIZE(Context); EltIndex++) {
|
for (EltIndex = 0; EltIndex < EBML_CTX_SIZE(Context); EltIndex++) {
|
||||||
if (EbmlId(*Result) == EBML_INFO_ID(EBML_SEM_INFO(Context.MyTable[EltIndex]))) {
|
if (EbmlId(*Result) == EBML_SEM_ID(Context.MyTable[EltIndex])) {
|
||||||
// skip the data with its own context
|
// skip the data with its own context
|
||||||
Result = Result->SkipData(DataStream, EBML_INFO_CONTEXT(EBML_SEM_INFO(Context.MyTable[EltIndex])), NULL);
|
Result = Result->SkipData(DataStream, EBML_SEM_CONTEXT(Context.MyTable[EltIndex]), NULL);
|
||||||
break; // let's go to the next ID
|
break; // let's go to the next ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -518,7 +518,7 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb
|
|||||||
|
|
||||||
// elements at the current level
|
// elements at the current level
|
||||||
for (ContextIndex = 0; ContextIndex < EBML_CTX_SIZE(Context); ContextIndex++) {
|
for (ContextIndex = 0; ContextIndex < EBML_CTX_SIZE(Context); ContextIndex++) {
|
||||||
if (aID == EBML_INFO_ID(EBML_SEM_INFO(Context.MyTable[ContextIndex]))) {
|
if (aID == EBML_SEM_ID(Context.MyTable[ContextIndex])) {
|
||||||
return &Context.MyTable[ContextIndex].Create();
|
return &Context.MyTable[ContextIndex].Create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user