EdbusMessage.h
/*
* $Id: EdbusMessage.h 3401 2012-08-29 07:57:30Z karijes $
*
* D-BUS stuff
* Copyright (c) 2008 edelib authors
*
* 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 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/>.
*/
#ifndef __EDELIB_EDBUSMESSAGE_H__
#define __EDELIB_EDBUSMESSAGE_H__
#include "List.h"
#include "EdbusData.h"
struct DBusMessage;
EDELIB_NS_BEGIN
class EdbusConnection;
struct EdbusMessageImpl;
class EDELIB_API EdbusMessage {
private:
friend class EdbusConnection;
EdbusMessageImpl* dm;
list<EdbusData> msg_content;
void from_dbus_message(DBusMessage* m);
DBusMessage* to_dbus_message(void) const;
E_DISABLE_CLASS_COPY(EdbusMessage)
public:
typedef list<EdbusData>::iterator iterator;
typedef list<EdbusData>::const_iterator const_iterator;
EdbusMessage() : dm(NULL) { }
EdbusMessage(DBusMessage* msg);
~EdbusMessage();
void create_signal(const char* path, const char* interface, const char* name);
void create_method_call(const char* service, const char* path, const char* interface, const char* method);
void create_reply(const EdbusMessage& replying_to);
void create_error_reply(const EdbusMessage& replying_to, const char* errmsg);
void clear_all(void);
bool is_signal(void);
bool is_method_call(void);
bool is_error_reply(const char* errmsg);
void path(const char* np);
const char* path(void) const;
void interface(const char* ni);
const char* interface(void) const;
void destination(const char* nd);
const char* destination(void) const;
void member(const char* nm);
const char* member(void) const;
void sender(const char* ns);
const char* sender(void) const;
const char* signature(void) const;
void append(const EdbusData& data) { msg_content.push_back(data); }
iterator begin(void) { return msg_content.begin(); }
const_iterator begin(void) const { return msg_content.begin(); }
iterator end(void) { return msg_content.end(); }
const_iterator end(void) const { return msg_content.end(); }
unsigned int size(void) const { return msg_content.size(); }
};
inline EdbusMessage& operator<<(EdbusMessage& m, const EdbusData& val) {
m.append(val);
return m;
}
EDELIB_NS_END
#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