summaryrefslogtreecommitdiff
path: root/gi/arg-types-inl.h
blob: ca70ba171ce6326f5b5ff69923147a82eafc5da0 (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
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2020 Marco Trevisan <marco.trevisan@canonical.com>

#pragma once

#include <config.h>

#include <stdint.h>

#include <girepository.h>
#include <glib-object.h>  // for GType
#include <glib.h>         // for gboolean

namespace Gjs {

template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
constexpr inline const char* static_type_name() = delete;

template <>
constexpr inline const char* static_type_name<bool>() {
    return "bool";
}

template <>
constexpr inline const char* static_type_name<int8_t>() {
    return "int8";
}

template <>
constexpr inline const char* static_type_name<uint8_t>() {
    return "uint8";
}

template <>
constexpr inline const char* static_type_name<int16_t>() {
    return "int16";
}

template <>
constexpr inline const char* static_type_name<uint16_t>() {
    return "uint16";
}

template <>
constexpr inline const char* static_type_name<int32_t>() {
    return "int32";
}

template <>
constexpr inline const char* static_type_name<uint32_t>() {
    return "uint32";
}

template <>
constexpr inline const char* static_type_name<char32_t>() {
    return "char32_t";
}

template <>
constexpr inline const char* static_type_name<int64_t>() {
    return "int64";
}

template <>
constexpr inline const char* static_type_name<uint64_t>() {
    return "uint64";
}

template <>
constexpr inline const char* static_type_name<float>() {
    return "float";
}

template <>
constexpr inline const char* static_type_name<double>() {
    return "double";
}

template <>
constexpr inline const char* static_type_name<void*>() {
    return "pointer";
}

template <>
constexpr inline const char* static_type_name<GType, GI_TYPE_TAG_GTYPE>() {
    return "GType";
}

template <>
constexpr inline const char* static_type_name<gboolean, GI_TYPE_TAG_BOOLEAN>() {
    return "boolean";
}

template <>
constexpr inline const char* static_type_name<GValue>() {
    return "GValue";
}

template <>
inline const char* static_type_name<char*>() {
    return "string";
}

}  // namespace Gjs