summaryrefslogtreecommitdiff
path: root/src/QGlib/type.cpp
blob: f6e84bb1d2a57a0136843d34788252660540ed87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
    Copyright (C) 2009-2010  George Kiagiadakis <kiagiadakis.george@gmail.com>

    This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "type.h"
#include "string.h"
#include "quark.h"
#include <glib-object.h>

namespace QGlib {

Type Type::fromInstance(void *instance)
{
    return G_TYPE_FROM_INSTANCE(instance);
}

Type Type::fromName(const QGlib::String & name)
{
    return g_type_from_name(name);
}

QGlib::String Type::name() const
{
    return QGlib::String(g_type_name(m_type));
}

Quark Type::qname() const
{
    return g_type_qname(m_type);
}

bool Type::isAbstract() const
{
    return G_TYPE_IS_ABSTRACT(m_type);
}

bool Type::isDerived() const
{
    return G_TYPE_IS_DERIVED(m_type);
}

bool Type::isFundamental() const
{
    return G_TYPE_IS_FUNDAMENTAL(m_type);
}

bool Type::isValueType() const
{
    return G_TYPE_IS_VALUE_TYPE(m_type);
}

bool Type::hasValueTable() const
{
    return G_TYPE_HAS_VALUE_TABLE(m_type);
}

bool Type::isClassed() const
{
    return G_TYPE_IS_CLASSED(m_type);
}

bool Type::isInstantiatable() const
{
    return G_TYPE_IS_INSTANTIATABLE(m_type);
}

bool Type::isDerivable() const
{
    return G_TYPE_IS_DERIVABLE(m_type);
}

bool Type::isDeepDerivable() const
{
    return G_TYPE_IS_DEEP_DERIVABLE(m_type);
}

bool Type::isInterface() const
{
    return G_TYPE_IS_INTERFACE(m_type);
}

Type::FundamentalType Type::fundamental() const
{
    return static_cast<Type::FundamentalType>(G_TYPE_FUNDAMENTAL(m_type));
}

Type Type::parent() const
{
    return g_type_parent(m_type);
}

uint Type::depth() const
{
    return g_type_depth(m_type);
}

Type Type::nextBase(Type rootType) const
{
    return g_type_next_base(m_type, rootType);
}

bool Type::isA(Type is_a_type) const
{
    return g_type_is_a(m_type, is_a_type);
}

void *Type::quarkData(const Quark & qname) const
{
    return g_type_get_qdata(m_type, qname);
}

void Type::setQuarkData(const Quark & qname, void *data)
{
    g_type_set_qdata(m_type, qname, data);
}

}