edelib: edelib/EdbusMessage.h Source File

edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

EdbusMessage.h
1 /*
2 * $Id: EdbusMessage.h 3401 2012-08-29 07:57:30Z karijes $
3 *
4 * D-BUS stuff
5 * Copyright (c) 2008 edelib authors
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __EDELIB_EDBUSMESSAGE_H__
22 #define __EDELIB_EDBUSMESSAGE_H__
23
24 #include "List.h"
25 #include "EdbusData.h"
26
27 struct DBusMessage;
28
29 EDELIB_NS_BEGIN
30
31 class EdbusConnection;
32 struct EdbusMessageImpl;
33
104 class EDELIB_API EdbusMessage {
105 private:
106 friend class EdbusConnection;
107
108 EdbusMessageImpl* dm;
109 list<EdbusData> msg_content;
110
111 void from_dbus_message(DBusMessage* m);
112 DBusMessage* to_dbus_message(void) const;
113
114 E_DISABLE_CLASS_COPY(EdbusMessage)
115 public:
119 typedef list<EdbusData>::iterator iterator;
120
124 typedef list<EdbusData>::const_iterator const_iterator;
125
131 EdbusMessage() : dm(NULL) { }
132
137 EdbusMessage(DBusMessage* msg);
138
142 ~EdbusMessage();
143
151 void create_signal(const char* path, const char* interface, const char* name);
152
161 void create_method_call(const char* service, const char* path, const char* interface, const char* method);
162
168 void create_reply(const EdbusMessage& replying_to);
169
176 void create_error_reply(const EdbusMessage& replying_to, const char* errmsg);
177
186 void clear_all(void);
187
191 bool is_signal(void);
192
196 bool is_method_call(void);
197
201 bool is_error_reply(const char* errmsg);
202
207 void path(const char* np);
208
213 const char* path(void) const;
214
219 void interface(const char* ni);
220
225 const char* interface(void) const;
226
236 void destination(const char* nd);
237
242 const char* destination(void) const;
243
250 void member(const char* nm);
251
256 const char* member(void) const;
257
266 void sender(const char* ns);
267
276 const char* sender(void) const;
277
287 const char* signature(void) const;
288
292 void append(const EdbusData& data) { msg_content.push_back(data); }
293
297 iterator begin(void) { return msg_content.begin(); }
298
302 const_iterator begin(void) const { return msg_content.begin(); }
303
308 iterator end(void) { return msg_content.end(); }
309
314 const_iterator end(void) const { return msg_content.end(); }
315
319 unsigned int size(void) const { return msg_content.size(); }
320 };
321
331 inline EdbusMessage& operator<<(EdbusMessage& m, const EdbusData& val) {
332 m.append(val);
333 return m;
334 }
335
336 EDELIB_NS_END
337 #endif
edelib::EdbusConnection
D-Bus connection and data sender.
Definition: EdbusConnection.h:154
edelib::EdbusMessage::end
iterator end(void)
Definition: EdbusMessage.h:308
edelib::EdbusMessage::size
unsigned int size(void) const
Definition: EdbusMessage.h:319
edelib::list::begin
iterator begin(void)
Definition: List.h:355
edelib::EdbusData
Class for representing D-Bus data types.
Definition: EdbusData.h:110
edelib::list
Linked list class.
Definition: List.h:160
edelib::EdbusMessage::EdbusMessage
EdbusMessage()
Definition: EdbusMessage.h:131
edelib::EdbusMessage::begin
iterator begin(void)
Definition: EdbusMessage.h:297
edelib::operator<<
EdbusMessage & operator<<(EdbusMessage &m, const EdbusData &val)
Definition: EdbusMessage.h:331
edelib::EdbusMessage::begin
const_iterator begin(void) const
Definition: EdbusMessage.h:302
edelib::EdbusMessage::const_iterator
list< EdbusData >::const_iterator const_iterator
Definition: EdbusMessage.h:124
edelib::EdbusMessage
Data transporter for D-Bus.
Definition: EdbusMessage.h:104
edelib::EdbusMessage::append
void append(const EdbusData &data)
Definition: EdbusMessage.h:292
edelib::list::push_back
void push_back(const T &val)
Definition: List.h:344
E_DISABLE_CLASS_COPY
#define E_DISABLE_CLASS_COPY(klass)
Definition: edelib-global.h:161
edelib::list::end
iterator end(void)
Definition: List.h:367
edelib::list::size
size_type size(void) const
Definition: List.h:399
edelib::EdbusMessage::end
const_iterator end(void) const
Definition: EdbusMessage.h:314
edelib::EdbusMessage::iterator
list< EdbusData >::iterator iterator
Definition: EdbusMessage.h:119