dbus-cxx logo
watch.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007,2008,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 <dbus/dbus.h>
20 #include <dbus-cxx/pointer.h>
21 
22 #ifndef DBUSCXX_WATCH_H
23 #define DBUSCXX_WATCH_H
24 
25 namespace DBus
26 {
27 
38  class Watch
39  {
40  protected:
41  Watch( DBusWatch* cobj = NULL );
42 
43  public:
44 
45  typedef DBusCxxPointer<Watch> pointer;
46  typedef DBusCxxWeakPointer<Watch> weak_pointer;
47 
48  static pointer create( DBusWatch* cobj = NULL );
49 
50  ~Watch();
51 
52  bool is_valid() const;
53 
54  operator bool() const;
55 
56  int unix_fd() const;
57 
58  int socket() const;
59 
60  unsigned int flags() const;
61 
62  bool is_readable() const;
63 
64  bool is_writable() const;
65 
66  bool is_enabled() const;
67 
68  bool handle( unsigned int flags );
69 
70  bool handle_read( bool error=false, bool hangup=false );
71 
72  bool handle_write( bool error=false, bool hangup=false );
73 
74  bool handle_readwrite( bool error = false, bool hangup = false );
75 
76  DBusWatch* cobj();
77 
78  const DBusWatch* cobj() const;
79 
80  operator DBusWatch*();
81 
82  protected:
83  DBusWatch* m_cobj;
84  };
85 
86 }
87 
88 #endif
int unix_fd() const
Definition: watch.cpp:50
int socket() const
Definition: watch.cpp:56
Definition: accumulators.h:24
bool handle_write(bool error=false, bool hangup=false)
Definition: watch.cpp:98
bool is_readable() const
Definition: watch.cpp:68
static pointer create(DBusWatch *cobj=NULL)
Definition: watch.cpp:31
bool handle(unsigned int flags)
Definition: watch.cpp:84
Watch(DBusWatch *cobj=NULL)
Definition: watch.cpp:26
DBusCxxWeakPointer< Watch > weak_pointer
Definition: watch.h:46
DBusCxxPointer< Watch > pointer
Definition: watch.h:45
bool is_valid() const
Definition: watch.cpp:40
Provides file descriptor watches.
Definition: watch.h:38
DBusWatch * m_cobj
Definition: watch.h:83
bool is_writable() const
Definition: watch.cpp:73
bool is_enabled() const
Definition: watch.cpp:78
DBusWatch * cobj()
Definition: watch.cpp:114
~Watch()
Definition: watch.cpp:36
bool handle_read(bool error=false, bool hangup=false)
Definition: watch.cpp:90
bool handle_readwrite(bool error=false, bool hangup=false)
Definition: watch.cpp:106
unsigned int flags() const
Definition: watch.cpp:62

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