1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 #ifndef _GIOMM_DBUSINTERFACEVTABLE_H
3 #define _GIOMM_DBUSINTERFACEVTABLE_H
4 
5 
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8 
9 /* Copyright (C) 2010 The giomm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #include <giomm/dbusmethodinvocation.h>
26 #include <gio/gio.h>
27 
28 
29 namespace Gio
30 {
31 
32 namespace DBus
33 {
34 
35 /**This represents a virtual table for
36  * handling properties and method calls for a D-Bus interface.
37  *
38  * If you want to handle getting/setting D-Bus properties asynchronously,
39  * simply register an object with the org.freedesktop.DBus.Properties D-Bus
40  * interface using Gio::DBus::Connection::register_object().
41  *
42  * The only correct use of this class is to declare a global instance of it
43  * (or an instance local to the main function) and pass pointers to the
44  * instance to the methods that require such a parameter.  The instance can be
45  * used for multiple registrations and the memory it uses will be freed at the
46  * end of execution.  Any other use (like creating an instance local to a
47  * function and using that) may cause memory leaks or errors (if the instance
48  * is destroyed too early).
49  *
50  * @newin{2,28}
51  * @ingroup DBus
52  */
53 class GIOMM_API InterfaceVTable
54 {
55   public:
56 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57   using CppObjectType = InterfaceVTable;
58   using BaseObjectType = GDBusInterfaceVTable;
59 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
60 
61 private:
62 
63 
64 public:
65   /** The type for a slot which handles a method call for a D-Bus interface.
66    * for example,
67    * @code
68    * void on_interface_method_call(const Glib::RefPtr<Gio::DBus::Connection>&
69    * connection, const Glib::ustring& sender, const Glib::ustring&
70    * object_path, const Glib::ustring& interface_name, const Glib::ustring&
71    * method_name, const Glib::VariantContainerBase& parameters, const
72    * Glib::RefPtr<Gio::DBus::MethodInvocation>& invocation);
73    * @endcode
74    */
75   using SlotInterfaceMethodCall = sigc::slot<
76     void,
77     const Glib::RefPtr<Connection>&,
78     const Glib::ustring&,
79     const Glib::ustring&,
80     const Glib::ustring&,
81     const Glib::ustring&,
82     const Glib::VariantContainerBase&,
83     const Glib::RefPtr<MethodInvocation>&
84     >;
85 
86   /** The type for a slot which handles getting a property for a D-Bus
87    * interface.
88    * for example,
89    * @code
90    * void on_interface_get_property(Glib::VariantBase& property, const
91    * Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring&
92    * sender, const Glib::ustring& object_path, const Glib::ustring&
93    * interface_name, const Glib::ustring& property_name);
94    * @endcode
95    * @throw Glib::Error.
96    */
97   using SlotInterfaceGetProperty = sigc::slot<
98     void,
99     Glib::VariantBase&,
100     const Glib::RefPtr<Connection>&,
101     const Glib::ustring&,
102     const Glib::ustring&,
103     const Glib::ustring&,
104     const Glib::ustring&
105     >;
106 
107   /** The type for a slot which handles setting a property for a D-Bus
108    * interface.
109    * for example,
110    * @code
111    * bool on_interface_set_property(const Glib::RefPtr<Gio::DBus::Connection>&
112    * connection, const Glib::ustring& sender, const Glib::ustring&
113    * object_path, const Glib::ustring& interface_name, const Glib::ustring&
114    * property_name, const Glib::VariantBase& value);
115    * @endcode
116    * @throw Glib::Error.
117    */
118   using SlotInterfaceSetProperty = sigc::slot<
119     bool,
120     const Glib::RefPtr<Connection>&,
121     const Glib::ustring&,
122     const Glib::ustring&,
123     const Glib::ustring&,
124     const Glib::ustring&,
125     const Glib::VariantBase&
126     >;
127 
128   /** Constructs a new InterfaceVTable using the specified slots.
129    * @param slot_method_call The slot for handling incoming method calls.
130    * @param slot_get_property The slot for getting a property.
131    * @param slot_set_property The slot for setting a property.
132    */
133   explicit InterfaceVTable(
134    const SlotInterfaceMethodCall& slot_method_call,
135    const SlotInterfaceGetProperty& slot_get_property = SlotInterfaceGetProperty(),
136    const SlotInterfaceSetProperty& slot_set_property = SlotInterfaceSetProperty()
137   );
138 
139   InterfaceVTable(const InterfaceVTable& other) = delete;
140   InterfaceVTable& operator=(const InterfaceVTable& other) = delete;
141 
142   InterfaceVTable(InterfaceVTable&& other) noexcept;
143   InterfaceVTable& operator=(InterfaceVTable&& other) noexcept;
144 
145   /// Destructor.
146   virtual ~InterfaceVTable();
147 
148   /// Provides access to the underlying C object.
gobj()149   GDBusInterfaceVTable* gobj()
150     { return reinterpret_cast<GDBusInterfaceVTable*>(&gobject_); }
151 
152   /// Provides access to the underlying C object.
gobj()153   const GDBusInterfaceVTable* gobj() const
154     { return reinterpret_cast<const GDBusInterfaceVTable*>(&gobject_); }
155 
156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
157   // These are so the C callbacks and the
158   // Gio::DBus::Connection::register_object() method can have access to the
159   // copies of the slots used for creation when registering.
160   SlotInterfaceMethodCall*      get_slot_method_call() const;
161   SlotInterfaceGetProperty*     get_slot_get_property() const;
162   SlotInterfaceSetProperty*     get_slot_set_property() const;
163 #endif
164 
165 protected:
166   // The underlying C instance.
167   GDBusInterfaceVTable          gobject_;
168 
169   // Pointers to copies of the slots used to create an instance.
170   SlotInterfaceMethodCall*      slot_method_call_;
171   SlotInterfaceGetProperty*     slot_get_property_;
172   SlotInterfaceSetProperty*     slot_set_property_;
173 
174 
175 };
176 
177 
178 } //namespace DBus
179 
180 } // namespace Gio
181 
182 
183 #endif /* _GIOMM_DBUSINTERFACEVTABLE_H */
184 
185