-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the number of methods and cleanup some macros #247
Conversation
hmmmmm |
ebml/EbmlElement.h
Outdated
@@ -234,32 +234,31 @@ class DllApi x : public BaseClass { \ | |||
|
|||
#define EBML_CONCRETE_CLASS(Type) \ | |||
public: \ | |||
libebml::EbmlElement & CreateElement() const override {return Create();} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for me. There are places where I have a generic EbmlElement
, and I need to create another instance of the same type. Before I could just use this function; now I cannot see a way to do it anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, we need this for generic usage. I dropped this commit.
01f8416
to
b1f9ac1
Compare
@@ -427,10 +427,9 @@ EbmlElement *EbmlElement::CreateElementUsingContext(const EbmlId & aID, const Eb | |||
// elements at the current level | |||
for (unsigned int ContextIndex = 0; ContextIndex < EBML_CTX_SIZE(Context); ContextIndex++) { | |||
if (aID == EBML_CTX_IDX_ID(Context,ContextIndex)) { | |||
auto ClassInfos = EBML_CTX_IDX(Context,ContextIndex); | |||
if (AsInfiniteSize && !ClassInfos.GetCallbacks().CanHaveInfiniteSize()) | |||
if (AsInfiniteSize && !EBML_CTX_IDX_INFO(Context,ContextIndex).CanHaveInfiniteSize()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When merging this PR to the current master, this line doesn't compile anymore:
lib/libebml/src/EbmlElement.cpp:430:70: fatal error: no member named 'CanHaveInfiniteSize' in 'libebml::EbmlSemantic'
if (AsInfiniteSize && !EBML_CTX_IDX_INFO(Context,ContextIndex).CanHaveInfiniteSize())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased on top of #267 which has a bit more macro usage and fixes that issue.
We can differentiate between the "pure" access macros and the "wrapper" ones.
EBML_CTX_IDX(MasterContext,EltIdx).GetCallbacks() is equivalent to EBML_CTX_IDX_INFO(MasterContext,EltIdx)
We can just use the semantic. No need to create a function for each existing class.
According to 8613939 it was kept for compatibility, but we're breaking the API.
Just like every other Ebml element that will have a Create().
But not static as some may be exported.
b1f9ac1
to
dde8107
Compare
We can do with less methods and reuse the methods that already exist to do the same calls.
That will make things easier to maintain.