On 12/20/2010 05:59 PM, John Cummings wrote:
>
> It appears that in fact I may have been confusing the simple libfoo
> example and my more complex existing library. However, I can now cause
> compilation to fail once again.
>
> To cause a failure, I overloaded the "==" operator for the Math type in
> foo.h:
>
> namespace bar {
> class Math : public QObject
> {
> ...
> };
> bool operator == (const Math& left, const Math& right);
> }
>
> Then in foo.cpp we have:
>
> bool bar::operator ==(const bar::Math& left, const bar::Math& right)
> {
> return &left == &right;
> }
>
> I can compile libfoo just fine, generate bindings, etc.. However, trying
> to compile bar_wrapper.cpp fails with the following errors:
>
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp: In
> function ‘PyObject* Sbk_bar_richcompare(PyObject*, PyObject*, int)’:
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:31:8:
> error: expected primary-expression before ‘&’ token
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:31:10:
> error: ‘cppSelf’ was not declared in this scope
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:31:21:
> error: expected primary-expression before ‘;’ token
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:35:2:
> error: expected primary-expression before ‘else’
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:35:2:
> error: expected ‘;’ before ‘else’
> /tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:45:5:
> warning: label ‘Sbk_bar_RichComparison_TypeError’ defined but not used
>
> I see a vague reference to operators in the documentation:
>
> http://www.pyside.org/docs/apiextractor/typesystem_specifying_types.html#object-type
>
> I tried setting the stream parameter to yes or no and that does not seem
> to make a difference. However, you already indicated that the
> documentation may be out of date.
>
> So, is there another setting I am missing?
>
> I am attaching a patch file for the Binding Tutorial example tarball
> that is found here:
>
> http://pyside.org/files/binding-tutorial.tar.gz
>
> The patch modifies libfoo and foobindings-cmake files.
>
> Thank you
> John Cummings
>
>
So, apparently the operator issue is a known bug with shiboken and C++
operators:
http://bugs.openbossa.org/show_bug.cgi?id=497
http://bugs.openbossa.org/show_bug.cgi?id=495
Is the only workaround to do a modify-function tag to exclude the
operator as I see in QtMobility? In particular, that would mean adding:
<modify-function signature="operator==(const bar::Math&, const
bar::Math&)" remove="all"/>
within the namespace-type tag for namespace bar. However, that doesn't
seem to completely work for me. It cuts down on the number of error
messages, but they persist still:
/tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp: In
function ‘PyObject* Sbk_bar_richcompare(PyObject*, PyObject*,
int)’:
/tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:30:8:
error: expected primary-expression before ‘&’ token
/tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:30:10:
error: ‘cppSelf’ was not declared in this scope
/tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:30:21:
error: expected primary-expression before ‘;’ token
/tmp/binding-tutorial/foobinding-cmake/build/foo/foo/bar_wrapper.cpp:40:5:
warning: label ‘Sbk_bar_RichComparison_TypeError’ defined but not used
I'm still poking around to see if there is another way to do it.
Thank you
John Cummings
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside