dbus-cxx logo

watch.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007,2008,2009 by Rick L. Vinyard, Jr.                  *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the dbus-cxx library.                            *
00006  *                                                                         *
00007  *   The dbus-cxx library is free software; you can redistribute it and/or *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The dbus-cxx library is distributed in the hope that it will be       *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef DBUSWATCH_H
00020 #define DBUSWATCH_H
00021 
00022 #include <dbus/dbus.h>
00023 #include <dbus-cxx/pointer.h>
00024 
00025 namespace DBus
00026 {
00027 
00038   class Watch
00039   {
00040     protected:
00041       Watch( DBusWatch* cobj = NULL );
00042       
00043     public:
00044       
00045       typedef DBusCxxPointer<Watch> pointer;
00046       typedef DBusCxxWeakPointer<Watch> weak_pointer;
00047       
00048       static pointer create( DBusWatch* cobj = NULL );
00049       
00050       ~Watch();
00051 
00052       bool is_valid() const;
00053 
00054       operator bool() const;
00055 
00056       int unix_fd() const;
00057 
00058       int socket() const;
00059 
00060       unsigned int flags() const;
00061 
00062       bool is_readable() const;
00063 
00064       bool is_writable() const;
00065 
00066       bool is_enabled() const;
00067 
00068       bool handle( unsigned int flags );
00069 
00070       bool handle_read( bool error=false, bool hangup=false );
00071       
00072       bool handle_write( bool error=false, bool hangup=false );
00073 
00074       bool handle_readwrite( bool error = false, bool hangup = false );
00075 
00076       DBusWatch* cobj();
00077       
00078       const DBusWatch* cobj() const;
00079 
00080       operator DBusWatch*();
00081 
00082     protected:
00083       DBusWatch* m_cobj;
00084   };
00085 
00086 }
00087 
00088 #endif

Generated on Fri Jun 26 15:50:38 2009 for dbus-cxx by doxygen 1.5.8