summaryrefslogtreecommitdiff
path: root/gio/src/dbusobject.hg
blob: c154157e5cb66b3449434f7eb68a43765782e3da (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
/* Copyright (C) 2012 The giomm Development Team
 *
 * 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 library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */

_CONFIGINCLUDE(giommconfig.h)

#include <glibmm/interface.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
_PINCLUDE(gio/gio.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GDBusObjectIface GDBusObjectIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gio
{

namespace DBus
{

class GIOMM_API Interface;

_GMMPROC_EXTRA_NAMESPACE(DBus)

/** Object - Base type for D-Bus objects.
 * The Object type is the base type for D-Bus objects on both the service side
 * (see ObjectSkeleton) and the client side (see ObjectProxy). It is
 * essentially just a container of interfaces.
 * @newin{2,34}
 */

class GIOMM_API Object : public Glib::Interface
{
  _CLASS_INTERFACE(Object, GDBusObject, G_DBUS_OBJECT, GDBusObjectIface, , , GIOMM_API)

public:
  _WRAP_METHOD(Glib::ustring get_object_path() const, g_dbus_object_get_object_path)

#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<Gio::DBus::Interface>>',`Glib::ListHandler<Glib::RefPtr<Gio::DBus::Interface>>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
  _WRAP_METHOD(std::vector<Glib::RefPtr<Gio::DBus::Interface>> get_interfaces(), g_dbus_object_get_interfaces)

#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<const Gio::DBus::Interface>>',`Glib::ListHandler<Glib::RefPtr<const Gio::DBus::Interface>>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
  _WRAP_METHOD(std::vector<Glib::RefPtr<const Gio::DBus::Interface>> get_interfaces() const, g_dbus_object_get_interfaces)

  _WRAP_METHOD(Glib::RefPtr<Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name), g_dbus_object_get_interface)
  _WRAP_METHOD(Glib::RefPtr<const Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name) const, g_dbus_object_get_interface, constversion)

#m4 _CONVERSION(`GDBusInterface*',`const Glib::RefPtr<Gio::DBus::Interface>&',`Glib::wrap($3, true)')

  // The parameter name 'interface' can cause compilation errors with MinGW.
  // See https://bugzilla.gnome.org/show_bug.cgi?id=735137
  // The parameter name in glib is 'interface_'.
  _WRAP_SIGNAL(void interface_added(const Glib::RefPtr<Gio::DBus::Interface>& iface), "interface_added")
  _WRAP_SIGNAL(void interface_removed(const Glib::RefPtr<Gio::DBus::Interface>& iface), "interface_removed")

protected:
#m4 _CONVERSION(`Glib::ustring',`const gchar*',`$3.c_str()')
  _WRAP_VFUNC(Glib::ustring get_object_path() const, "get_object_path", keep_return)

#m4 _CONVERSION(`std::vector<Glib::RefPtr<Gio::DBus::Interface>>',`GList*',
#m4  `g_list_copy_deep(Glib::ListHandler<Glib::RefPtr<Gio::DBus::Interface>>::vector_to_list($3).data(), list_copy_ref, nullptr)')
  _WRAP_VFUNC(std::vector<Glib::RefPtr<Gio::DBus::Interface>> get_interfaces() const, "get_interfaces")

  // Can't use refreturn_ctype here. It generates a call to Glib::unwrap_copy(), which
  // can't be used for Glib::Interface classes. They have no gobj_copy() method.
#m4 _CONVERSION(`Glib::RefPtr<Gio::DBus::Interface>',`GDBusInterface*',`local_unwrap_copy($3)')
  _WRAP_VFUNC(Glib::RefPtr<Gio::DBus::Interface> get_interface(const Glib::ustring& interface_name) const, "get_interface")
};

} // namespace DBus

} // namespace Gio