1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 #ifndef _GIOMM_DBUSSUBTREEVTABLE_H
3 #define _GIOMM_DBUSSUBTREEVTABLE_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 <giomm/dbusinterfacevtable.h>
27 #include <gio/gio.h>
28 
29 
30 namespace Gio
31 {
32 
33 namespace DBus
34 {
35 
36 /** This represents a virtual table for
37  * subtrees registered with Gio::DBus::Connection::register_subtree().
38  *
39  * The only correct use of this class is to declare a global instance of it
40  * (or an instance local to the main function) and pass pointers to the
41  * instance to the methods that require such a parameter.  The instance can be
42  * used for multiple registrations and the memory it uses will be freed at the
43  * end of execution.  Any other use (like creating an instance local to a
44  * function and using that) may cause memory leaks or errors (if the instance
45  * is destroyed too early).
46  *
47  * @newin{2,28}
48  * @ingroup DBus
49  */
50 class GIOMM_API SubtreeVTable
51 {
52   public:
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54   using CppObjectType = SubtreeVTable;
55   using BaseObjectType = GDBusSubtreeVTable;
56 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
57 
58 private:
59 
60 
61 public:
62   /** The type for a slot which handles enumerating child nodes.
63    *
64    * This slot is called when generating introspection data and also when
65    * preparing to dispatch incoming messages in the event that the
66    * Gio::DBus::SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not
67    * specified (ie: to verify that the object path is valid).
68    *
69    * Hierarchies are not supported; the items that you return should not
70    * contain the '/' character.
71    *
72    * For example,
73    * @code
74    * std::vector<Glib::ustring> on_subtree_enumerate(const
75    * Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring&
76    * sender, const Glib::ustring& object_path);
77    * @endcode
78    */
79   using SlotSubtreeEnumerate = sigc::slot<
80     std::vector<Glib::ustring>,
81     const Glib::RefPtr<Connection>&,
82     const Glib::ustring&,
83     const Glib::ustring&
84     >;
85 
86   /** The type for a slot which handles introspecting a child node.
87    *
88    * Subtrees are flat. @a node, if non-<tt>0</tt>, is always exactly one
89    * segment of the object path (ie: it never contains a slash).
90    *
91    * This function should return an empty vector to indicate that there is no
92    * object at this node.
93    *
94    * If this function returns a non-empty vector, the return value is expected
95    * to be a list of InterfaceInfo structures describing the interfaces
96    * implemented by node.
97    *
98    * for example,
99    * @code
100    * std::vector< Glib::RefPtr<Gio::DBus::InterFaceInfo> >
101    * on_subtree_introspect(const Glib::RefPtr<Gio::DBus::Connection>&
102    * connection, const Glib::ustring& sender, const Glib::ustring&
103    * object_path, const Glib::ustring& node);
104    * @endcode
105    */
106   using SlotSubtreeIntrospect = sigc::slot<
107     std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> >,
108     const Glib::RefPtr<Connection>&,
109     const Glib::ustring&,
110     const Glib::ustring&,
111     const Glib::ustring&
112     >;
113 
114   /** The type for a slot which handles dispatching a remote call on a child
115    * node.
116    *
117    * Subtrees are flat. @a node, if non-<tt>0</tt>, is always exactly one
118    * segment of the object path (ie: it never contains a slash).
119    *
120    * for example,
121    * @code
122    * const Gio::DBus::InterfaceVTable* on_subtree_dispatch(const
123    * Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring&
124    * sender, const Glib::ustring& object_path, const Glib::ustring&
125    * interface_name, const Glib::ustring& node);
126    * @endcode
127    */
128   using SlotSubtreeDispatch = sigc::slot<
129     const InterfaceVTable*,
130     const Glib::RefPtr<Connection>&,
131     const Glib::ustring&,
132     const Glib::ustring&,
133     const Glib::ustring&,
134     const Glib::ustring&
135     >;
136 
137   /** Constructs a new SubtreeVTable using specified slots.
138    * @param slot_enumerate The slot for handling incoming method calls.
139    * @param slot_introspect The slot for getting a property.
140    * @param slot_dispatch The slot for setting a property.
141    */
142   explicit SubtreeVTable(
143    const SlotSubtreeEnumerate& slot_enumerate,
144    const SlotSubtreeIntrospect& slot_introspect = SlotSubtreeIntrospect(),
145    const SlotSubtreeDispatch& slot_dispatch = SlotSubtreeDispatch()
146   );
147 
148   SubtreeVTable(const SubtreeVTable& other) = delete;
149   SubtreeVTable& operator=(const SubtreeVTable& other) = delete;
150 
151   SubtreeVTable(SubtreeVTable&& other) noexcept;
152   SubtreeVTable& operator=(SubtreeVTable&& other) noexcept;
153 
154   /// Destructor.
155   virtual ~SubtreeVTable();
156 
157   /// Provides access to the underlying C object.
gobj()158   GDBusSubtreeVTable* gobj()
159     { return reinterpret_cast<GDBusSubtreeVTable*>(&gobject_); }
160 
161   /// Provides access to the underlying C object.
gobj()162   const GDBusSubtreeVTable* gobj() const
163     { return reinterpret_cast<const GDBusSubtreeVTable*>(&gobject_); }
164 
165 public:
166 #ifndef DOXYGEN_SHOULD_SKIP_THIS
167   // These are so the C callbacks and the
168   // Gio::DBus::Connection::register_subtreee() method can have access to the
169   // copies of the slots used for creation when registering.
170   SlotSubtreeEnumerate*         get_slot_enumerate() const;
171   SlotSubtreeIntrospect*        get_slot_introspect() const;
172   SlotSubtreeDispatch*          get_slot_dispatch() const;
173 #endif
174 
175 protected:
176   // The underlying C instance.
177   GDBusSubtreeVTable          gobject_;
178 
179   // Pointers to copies of the slots used to create an instance.
180   SlotSubtreeEnumerate*         slot_enumerate_;
181   SlotSubtreeIntrospect*        slot_introspect_;
182   SlotSubtreeDispatch*          slot_dispatch_;
183 
184 
185 };
186 
187 
188 } //namespace DBus
189 
190 } // namespace Gio
191 
192 
193 #endif /* _GIOMM_DBUSSUBTREEVTABLE_H */
194 
195