v1/v2: simplify EBML_SEM_ID(EBML_CTX_IDX()) to EBML_CTX_IDX_ID()
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libebml@138 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
4eef9565c1
commit
2753bfd8a3
@ -194,7 +194,6 @@ extern const EbmlSemanticContext Context_EbmlGlobal;
|
||||
#define EBML_INFO_CONTEXT(cb) (cb).GetContext()
|
||||
|
||||
#define EBML_SEM_UNIQUE(s) (s).IsUnique()
|
||||
#define EBML_SEM_ID(s) ((const EbmlCallbacks &)(s)).ClassId()
|
||||
#define EBML_SEM_CONTEXT(s) ((const EbmlCallbacks &)(s)).GetContext()
|
||||
#define EBML_SEM_CREATE(s) (s).Create()
|
||||
|
||||
@ -203,6 +202,7 @@ extern const EbmlSemanticContext Context_EbmlGlobal;
|
||||
#define EBML_CTX_PARENT(c) (c).Parent()
|
||||
#define EBML_CTX_IDX(c,i) (c).GetSemantic(i)
|
||||
#define EBML_CTX_IDX_INFO(c,i) (const EbmlCallbacks &)((c).GetSemantic(i))
|
||||
#define EBML_CTX_IDX_ID(c,i) ((const EbmlCallbacks &)((c).GetSemantic(i))).ClassId()
|
||||
#else
|
||||
#define EBML_CONCRETE_CLASS(Type) \
|
||||
public: \
|
||||
@ -227,7 +227,6 @@ extern const EbmlSemanticContext Context_EbmlGlobal;
|
||||
#define EBML_INFO_CONTEXT(cb) (cb).Context
|
||||
|
||||
#define EBML_SEM_UNIQUE(s) (s).Unique
|
||||
#define EBML_SEM_ID(s) (s).GetCallbacks.GlobalId
|
||||
#define EBML_SEM_CONTEXT(s) (s).GetCallbacks.Context
|
||||
#define EBML_SEM_CREATE(s) (s).Create()
|
||||
|
||||
@ -236,6 +235,7 @@ extern const EbmlSemanticContext Context_EbmlGlobal;
|
||||
#define EBML_CTX_PARENT(c) (c).UpTable
|
||||
#define EBML_CTX_IDX(c,i) (c).MyTable[(i)]
|
||||
#define EBML_CTX_IDX_INFO(c,i) (c).MyTable[(i)].GetCallbacks
|
||||
#define EBML_CTX_IDX_ID(c,i) (c).MyTable[(i)].GetCallbacks.GlobalId
|
||||
#endif
|
||||
|
||||
#if !defined(INVALID_FILEPOS_T)
|
||||
|
@ -492,7 +492,7 @@ EbmlElement * EbmlElement::SkipData(EbmlStream & DataStream, const EbmlSemanticC
|
||||
unsigned int EltIndex;
|
||||
// data known in this Master's context
|
||||
for (EltIndex = 0; EltIndex < EBML_CTX_SIZE(Context); EltIndex++) {
|
||||
if (EbmlId(*Result) == EBML_SEM_ID(EBML_CTX_IDX(Context,EltIndex))) {
|
||||
if (EbmlId(*Result) == EBML_CTX_IDX_ID(Context,EltIndex)) {
|
||||
// skip the data with its own context
|
||||
Result = Result->SkipData(DataStream, EBML_SEM_CONTEXT(EBML_CTX_IDX(Context,EltIndex)), NULL);
|
||||
break; // let's go to the next ID
|
||||
@ -527,8 +527,8 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb
|
||||
|
||||
// elements at the current level
|
||||
for (ContextIndex = 0; ContextIndex < EBML_CTX_SIZE(Context); ContextIndex++) {
|
||||
if (aID == EBML_SEM_ID(EBML_CTX_IDX(Context,ContextIndex))) {
|
||||
return &EBML_CTX_IDX(Context,ContextIndex).Create();
|
||||
if (aID == EBML_CTX_IDX_ID(Context,ContextIndex)) {
|
||||
return &EBML_SEM_CREATE(EBML_CTX_IDX(Context,ContextIndex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ bool EbmlMaster::ProcessMandatory()
|
||||
unsigned int EltIdx;
|
||||
for (EltIdx = 0; EltIdx < EBML_CTX_SIZE(Context); EltIdx++) {
|
||||
if (EBML_CTX_IDX(Context,EltIdx).IsMandatory() && EBML_CTX_IDX(Context,EltIdx).IsUnique()) {
|
||||
// assert(EBML_CTX_IDX(Context,EltIdx).Create() != NULL);
|
||||
PushElement(EBML_CTX_IDX(Context,EltIdx).Create());
|
||||
// assert(EBML_CTX_IDX(Context,EltIdx).Create != NULL);
|
||||
PushElement(EBML_SEM_CREATE(EBML_CTX_IDX(Context,EltIdx)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user