dbus-cxx logo
messagehandler.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2009,2010 by Rick L. Vinyard, Jr. *
3  * rvinyard@cs.nmsu.edu *
4  * *
5  * This file is part of the dbus-cxx library. *
6  * *
7  * The dbus-cxx library is free software; you can redistribute it and/or *
8  * modify it under the terms of the GNU General Public License *
9  * version 3 as published by the Free Software Foundation. *
10  * *
11  * The dbus-cxx library is distributed in the hope that it will be *
12  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this software. If not see <http://www.gnu.org/licenses/>. *
18  ***************************************************************************/
19 #include <sigc++/sigc++.h>
20 
21 #include <dbus-cxx/enums.h>
22 #include <dbus-cxx/pointer.h>
23 #include <dbus-cxx/accumulators.h>
24 #include <dbus-cxx/forward_decls.h>
25 #include <dbus-cxx/message.h>
26 
27 #ifndef DBUSCXX_MESSAGEHANDLER_H
28 #define DBUSCXX_MESSAGEHANDLER_H
29 
30 namespace DBus
31 {
40  class MessageHandler : public sigc::trackable
41  {
42  protected:
44 
45  public:
46 
47  typedef DBusCxxPointer<MessageHandler> pointer;
48 
49  typedef DBusCxxWeakPointer<MessageHandler> weak_pointer;
50 
51  virtual ~MessageHandler();
52 
54  virtual HandlerResult handle_message( DBusCxxPointer<Connection>, Message::const_pointer );
55 
56  typedef sigc::signal<HandlerResult,DBusCxxPointer<Connection>, Message::const_pointer>::accumulated<MessageHandlerAccumulator> MessageSignal;
57 
58  MessageSignal& signal_message();
59 
60  protected:
61 
62  MessageSignal m_signal_message;
63 
68  static DBusHandlerResult message_handler_callback(DBusConnection* connection, DBusMessage* message, void* user_data);
69 
70  };
71 
72 }
73 
74 #endif
virtual HandlerResult handle_message(DBusCxxPointer< Connection >, Message::const_pointer)
The default implementation simply emits the message signal and returns the result.
Definition: messagehandler.cpp:34
static DBusHandlerResult message_handler_callback(DBusConnection *connection, DBusMessage *message, void *user_data)
When used as a callback, this method expects.
Definition: messagehandler.cpp:44
HandlerResult
Definition: enums.h:87
Definition: accumulators.h:24
This class provides a common base class for all message handlers.
Definition: messagehandler.h:40
virtual ~MessageHandler()
Definition: messagehandler.cpp:30
sigc::signal< HandlerResult, DBusCxxPointer< Connection >, Message::const_pointer >::accumulated< MessageHandlerAccumulator > MessageSignal
Definition: messagehandler.h:56
DBusCxxPointer< MessageHandler > pointer
Definition: messagehandler.h:47
MessageSignal & signal_message()
Definition: messagehandler.cpp:39
DBusCxxWeakPointer< MessageHandler > weak_pointer
Definition: messagehandler.h:49
MessageSignal m_signal_message
Definition: messagehandler.h:62
DBusCxxPointer< const Message > const_pointer
Definition: message.h:62
MessageHandler()
Definition: messagehandler.cpp:25

Generated on Sun Mar 19 2017 14:54:27 for dbus-cxx by doxygen 1.8.8