You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In cobj, in order to call interface methods, you need a reference to that very interface, which is itself the result of a queryinterface call.
Consider providing a reference to each implemented interface for a object to be created initialized when an object is initialized.
So you always have to deal with objects and the corresponding interfaces. This makes using cobj harder then in should be, and results in more boilerplate code.
Example:
// init a class
myclass c;
myclass_initialize(&c);
// get references for "interface1" and "interface2", and call the foo function on them:
interface1 i1;
interface2 i2;
interface1_queryinterface(&c.object, &i1);
interface2_queryinterface(&c.object, &i2);
interface1_foo(&i1);
interface2_foo(&i2);
This could become much more readable by:
// init a class. The cobj generator emits a default reference to each implemented interface.
myclass c;
myclass_initialize(&c);
// call methods by using the default references:
interface1_foo(&c.interface1);
interface2_foo(&c.interface2);
As a result of this change, queryinterface may not be needed at all, but this will go into a new issue.
The text was updated successfully, but these errors were encountered:
Implementing these changes will cause uncompatible changes, but they make cobj that much easier to use, that it will be implemented. So this will be version 2 of cobj ;-)
In cobj, in order to call interface methods, you need a reference to that very interface, which is itself the result of a queryinterface call.
Consider providing a reference to each implemented interface for a object to be created initialized when an object is initialized.
So you always have to deal with objects and the corresponding interfaces. This makes using cobj harder then in should be, and results in more boilerplate code.
Example:
This could become much more readable by:
As a result of this change, queryinterface may not be needed at all, but this will go into a new issue.
The text was updated successfully, but these errors were encountered: