repos
/
smoke
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Support modular smoke & cleanup.
Annotate for file src/libsmoke/smokebinding.cpp
2010-01-10 tobias
1
#include "smokebinding.h"
2009-04-05 tobias
2
15:36:29 '
3
#include <QtGlobal>
2009-08-02 tobias
4
#include <QDebug>
2009-04-05 tobias
5
15:36:29 '
6
namespace cl_smoke
'
7
{
'
8
2010-02-18 tobias
9
/** @class Binding
19:57:00 '
10
* @brief The Smoke binding.
2009-04-05 tobias
11
*/
15:36:29 '
12
2010-02-18 tobias
13
19:57:00 '
14
/** @typedef Binding::destructed
2009-04-05 tobias
15
* Callback when a Smoke object is destructed.
15:36:29 '
16
*
2009-08-02 tobias
17
* @param class_index Index of the object's class.
2009-06-22 tobias
18
* @param object pointer to the object
2009-04-05 tobias
19
*/
15:36:29 '
20
'
21
'
22
/** @typedef Binding::dispatch_method
'
23
* Callback when a Smoke method gets called.
'
24
*
'
25
* @param binding Smoke binding of @a object
'
26
* @param method index of the method
'
27
* @param object the object for which the method is called
'
28
* @param args the arguments to the method
'
29
* @param abstract @c true when the method is abstract and @c false otherwise
'
30
*
'
31
* @return @c true when the method call was handled and @c false
2009-06-22 tobias
32
* when the default method shall be invoked.
2009-04-05 tobias
33
*/
15:36:29 '
34
'
35
/** Constructor.
2010-02-19 tobias
36
* @param smoke the Smoke module
2009-04-05 tobias
37
* @param destruct destruct callback
15:36:29 '
38
* @param dispatch method dispatch callback
'
39
*/
2010-02-19 tobias
40
Binding::Binding(Smoke *smoke, destructed destruct,
21:10:24 '
41
dispatch_method dispatch)
2010-02-18 tobias
42
: SmokeBinding(smoke),
19:57:00 '
43
destruct(destruct),
2009-04-05 tobias
44
dispatch(dispatch)
15:36:29 '
45
{
2010-02-18 tobias
46
Q_ASSERT(smoke);
19:57:00 '
47
Q_ASSERT(destruct);
2009-04-05 tobias
48
Q_ASSERT(dispatch);
15:36:29 '
49
}
'
50
2010-02-18 tobias
51
/** Invoked when a Smoke object is destructed. */
19:57:00 '
52
void
'
53
Binding::deleted(Smoke::Index, void *object)
'
54
{
'
55
destruct(object);
'
56
}
2009-04-05 tobias
57
2009-06-03 tobias
58
/** Invoked when a Smoke method gets called. */
2009-04-05 tobias
59
bool
15:36:29 '
60
Binding::callMethod(Smoke::Index method, void* object,
'
61
Smoke::Stack stack, bool abstract)
'
62
{
2010-02-19 tobias
63
int ret = dispatch(this, method, object, stack, abstract);
2009-06-03 tobias
64
Q_ASSERT( !abstract || ret );
21:55:26 '
65
'
66
return ret;
2009-04-05 tobias
67
}
15:36:29 '
68
2010-02-18 tobias
69
/**
19:57:00 '
70
* @todo Returning a const char* would be better
'
71
*/
'
72
char*
'
73
Binding::className(Smoke::Index classId)
'
74
{
'
75
return const_cast<char*>(smoke->classes[classId].className);
'
76
}
'
77
'
78
/** Gets the Smoke instance associated with the binding.
'
79
* @return a pointer to the Smoke instance
'
80
*/
'
81
Smoke*
'
82
Binding::get_smoke() const
'
83
{
'
84
return smoke;
'
85
}
'
86
2009-04-05 tobias
87
} // namespace cl_smoke