1divert(-1)
2
3dnl $Id$
4
5dnl  Glib::Variant specializations for fundamental types
6dnl
7dnl  Copyright 2010 The gtkmm Development Team
8dnl
9dnl  This library is free software; you can redistribute it and/or
10dnl  modify it under the terms of the GNU Lesser General Public
11dnl  License as published by the Free Software Foundation; either
12dnl  version 2.1 of the License, or (at your option) any later version.
13dnl
14dnl  This library is distributed in the hope that it will be useful,
15dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
16dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17dnl  Lesser General Public License for more details.
18dnl
19dnl  You should have received a copy of the GNU Lesser General Public
20dnl  License along with this library.  If not, see <http://www.gnu.org/licenses/>.
21
22include(template.macros.m4)
23
24dnl
25dnl For instance, GLIB_VARIANT_BASIC(C++ type, C type, C type name [,C type name 2])
26dnl Parameters:
27dnl C++ type: The C++ type for the specialization, such as bool.
28dnl C type: The C type used by the C API, such as gboolean.
29dnl C type name: The text used in the C API functions and macros, such as boolean
30dnl   in g_variant_get_boolean() and G_VARIANT_TYPE_BOOLEAN.
31dnl C type name 2: Optional second text, such as handle in g_variant_get_handle()
32dnl   and G_VARIANT_TYPE_HANDLE.
33dnl
34define([GLIB_VARIANT_BASIC],[dnl
35LINE(]__line__[)dnl
36
37/** Specialization of Glib::Variant containing a $1 type.
38 * @newin{2,26}
39 * @ingroup Variant
40 */
41template <>
42class GLIBMM_API Variant<$1> : public VariantBase
43{
44public:
45  using CType = $2;
46
47  /// Default constructor.
48  Variant<$1>()
49  : VariantBase()
50  {}
51
52  /** GVariant constructor.
53   * @param castitem The GVariant to wrap.
54   * @param take_a_reference Whether to take an extra reference of the
55   * GVariant or not (not taking one could destroy the GVariant with the
56   * wrapper).
57   */
58  explicit Variant<$1>(GVariant* castitem, bool take_a_reference = false)
59  : VariantBase(castitem, take_a_reference)
60  {}
61
62  /** Gets the Glib::VariantType.
63   * @return The Glib::VariantType.
64   */
65  static const VariantType& variant_type() G_GNUC_CONST;
66
67  /** Creates a new Glib::Variant<$1>.
68   * @param data The value of the new Glib::Variant<$1>.
69   * @return The new Glib::Variant<$1>.
70   */
71  static Variant<$1> create($1 data);
72ifelse($4,,,[
73  /** Creates a new Glib::Variant<$1> of type VARIANT_TYPE_[]UPPER($4).
74   * @param data The value of the new Glib::Variant<$1>.
75   * @return The new Glib::Variant<$1>.
76   */
77  static Variant<$1> create_$4($1 data);
78])
79  /** Gets the value of the Glib::Variant<$1>.
80   * @return The $1 value of the Glib::Variant<$1>.
81   */
82  $1 get() const;
83};
84])
85
86divert[]dnl
87// This is a generated file. Do not edit it.  Generated from __file__
88
89#ifndef DOXYGEN_SHOULD_SKIP_THIS
90#ifndef _GLIBMM_VARIANT_H_INCLUDE_VARIANT_BASICTYPES_H
91#error "glibmm/variant_basictypes.h cannot be included directly"
92#endif
93#endif
94
95namespace Glib
96{
97GLIB_VARIANT_BASIC(bool, gboolean, boolean)
98GLIB_VARIANT_BASIC(unsigned char, guchar, byte)
99GLIB_VARIANT_BASIC(gint16, gint16, int16)
100GLIB_VARIANT_BASIC(guint16, guint16, uint16)
101GLIB_VARIANT_BASIC(gint32, gint32, int32, handle)
102GLIB_VARIANT_BASIC(guint32, guint32, uint32)
103GLIB_VARIANT_BASIC(gint64, gint64, int64)
104GLIB_VARIANT_BASIC(guint64, guint64, uint64)
105GLIB_VARIANT_BASIC(double, gdouble, double)
106} // namespace Glib
107