3 * D-Bus++ - C++ bindings for D-Bus
5 * Copyright (C) 2005-2009 Paolo Durante <shackan@gmail.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef __DBUSXX_OBJECT_H
26 #define __DBUSXX_OBJECT_H
32 #include "interface.h"
33 #include "connection.h"
39 class DBUSXXAPI Object
43 Object(Connection
&conn
, const Path
&path
, const char *service
);
49 const DBus::Path
&path() const { return _path
; }
51 const std::string
&service() const { return _service
; }
53 Connection
&conn() { return _conn
; }
57 DBUSXXAPILOCAL
virtual bool handle_message(const Message
&) = 0;
58 DBUSXXAPILOCAL
virtual void register_obj() = 0;
59 DBUSXXAPILOCAL
virtual void unregister_obj() = 0;
73 typedef std::list
<ObjectAdaptor
*> ObjectAdaptorPList
;
74 typedef std::list
<std::string
> ObjectPathList
;
76 class DBUSXXAPI ObjectAdaptor
: public Object
, public virtual AdaptorBase
80 static ObjectAdaptor
*from_path(const Path
&path
);
82 static ObjectAdaptorPList
from_path_prefix(const std::string
&prefix
);
84 static ObjectPathList
child_nodes_from_prefix(const std::string
&prefix
);
88 ObjectAdaptor(Connection
&conn
, const Path
&path
);
92 ObjectAdaptor
&object() { return *this; }
96 void _emit_signal(SignalMessage
&);
98 bool handle_message(const Message
&);
101 void unregister_obj();
103 friend struct Private
;
111 typedef std::list
<ObjectProxy
*> ObjectProxyPList
;
113 class DBUSXXAPI ObjectProxy
: public Object
, public virtual ProxyBase
,
114 virtual public CallbackTarget
118 ObjectProxy(Connection
&conn
, const Path
&path
, const char *service
= "");
122 ObjectProxy
&object() { return *this; }
126 Message
_invoke_method(CallMessage
&, int timeout
);
127 PendingCall
_invoke_method_async(CallMessage
&, const PendingCallSlot
&, void*, int timeout
);
129 bool handle_message(const Message
&);
132 void unregister_obj();
136 MessageSlot _filtered
;
137 PendingCalls _pending
;
139 friend class PendingCall
; //TODO: in order to manage pending calls lifetime
140 friend struct PendingCall::Private
; //TODO: in order to manage pending calls lifetime
143 } /* namespace DBus */
145 #endif//__DBUSXX_OBJECT_H