ibus-qt
1.3.3
builddir
build
BUILD
ibus-qt-1.3.3-Source
src
qibusobject.h
1
#ifndef __Q_IBUS_OBJECT_H__
2
#define __Q_IBUS_OBJECT_H__
3
4
#include <QObject>
5
#include <QMetaType>
6
#include "qibuspointer.h"
7
8
#ifdef QT_USE_NAMESPACE
9
# undef QT_USE_NAMESPACE
10
# define QT_USE_NAMESPACE IBus
11
#endif
12
13
namespace
IBus
{
14
15
class
Object;
16
typedef
Pointer <Object> ObjectPointer;
17
18
class
Object
:
public
QObject
19
{
20
Q_OBJECT
21
template
<
typename
T>
friend
class
Pointer
;
22
23
public
:
24
// Q_INVOKABLE Object () : m_referenced (false), m_refcount(1) {}
25
Object
() : m_referenced (
false
), m_refcount(1) {}
26
virtual
~Object
();
27
virtual
void
destroy
();
28
29
private
:
30
Object
* ref () {
31
if
(m_referenced) {
32
m_refcount.ref ();
33
}
34
else
{
35
m_referenced =
true
;
36
}
37
return
this
;
38
}
39
40
void
unref () {
41
if
(! m_refcount.deref ()) {
42
delete
this
;
43
}
44
}
45
46
bool
is_referenced ()
const
{
47
return
m_referenced;
48
}
49
50
bool
m_referenced;
51
QAtomicInt m_refcount;
52
};
53
54
};
55
56
Q_DECLARE_METATYPE(
IBus::ObjectPointer
)
57
58
#endif
IBus
Definition:
qibusattribute.cpp:3
IBus::Object::~Object
virtual ~Object()
Destructor of Object.
Definition:
qibusobject.cpp:10
IBus::Pointer
Definition:
qibuspointer.h:10
IBus::Object
Definition:
qibusobject.h:18
IBus::Object::destroy
virtual void destroy()
Destroy the object.
Definition:
qibusobject.cpp:23
Generated by
1.8.16