1 #include "smokebinding.h"
9 /** @class NoDispatchBinding
10 * @brief The Smoke binding for classes we need no dispatching.
11 * This saves some overhead, since it does not call into Lisp.
12 * Idea stolen from CommonQt ;)
14 * Dispatches for non extended classes (not of class CXX:CLASS) are between
15 * 20% - 40% (for qt.examples:colliding-mice - qt.examples:class-browser). (18 February 2010)
18 /** @typedef NoDispatchBinding::destructed
19 * Callback when a Smoke object is destructed.
21 * @param class_index Index of the object's class.
22 * @param object pointer to the object
26 * @param destruct destruct callback
28 NoDispatchBinding::NoDispatchBinding(destructed destruct)
35 /** Invoked when a Smoke object is destructed. */
37 NoDispatchBinding::deleted(Smoke::Index, void *object)
42 /** Invoked when a Smoke method gets called. */
44 NoDispatchBinding::callMethod(Smoke::Index method, void* object,
45 Smoke::Stack stack, bool abstract)
52 * @todo Returning a const char* would be better
55 NoDispatchBinding::className(Smoke::Index classId)
57 qFatal("className() Not implemented");
60 /** @function NoDispatchBinding::get_smoke()
61 * Gets the Smoke instance associated with the binding.
62 * @return a pointer to the Smoke instance
66 * @brief The Smoke binding.
69 /** @typedef Binding::dispatch_method
70 * Callback when a Smoke method gets called.
72 * @param binding Smoke binding of @a object
73 * @param method index of the method
74 * @param object the object for which the method is called
75 * @param args the arguments to the method
76 * @param abstract @c true when the method is abstract and @c false otherwise
78 * @return @c true when the method call was handled and @c false
79 * when the default method shall be invoked.
83 * @param destruct destruct callback
84 * @param dispatch method dispatch callback
86 Binding::Binding(destructed destruct, dispatch_method dispatch)
87 : NoDispatchBinding(destruct),
94 /** Invoked when a Smoke method gets called. */
96 Binding::callMethod(Smoke::Index method, void* object,
97 Smoke::Stack stack, bool abstract)
99 int ret = dispatch(method, object, stack, abstract);
100 Q_ASSERT( !abstract || ret );
105 } // namespace cl_smoke