|
DBus-1-TQt
1.0
|
00001 /* tqdbusunixfd.h DBUS unix file handle data type 00002 * 00003 * Copyright (C) 2013 Slávek Banko <slavek.banko@axis.cz> 00004 * 00005 * Licensed under the Academic Free License version 2.1 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 * USA. 00021 * 00022 */ 00023 00024 #ifndef TQDBUSUNIXFD_H 00025 #define TQDBUSUNIXFD_H 00026 00027 #include "dbus/dbus.h" 00028 #ifndef QT_H 00029 #include "ntqshared.h" 00030 #endif // QT_H 00031 #include "tqdbusmacros.h" 00032 00033 00034 #ifndef DBUS_TYPE_UNIX_FD 00035 #define DBUS_TYPE_UNIX_FD ((int) 'h') 00036 #endif 00037 00038 #ifndef DBUS_TYPE_UNIX_FD_AS_STRING 00039 #define DBUS_TYPE_UNIX_FD_AS_STRING "h" 00040 #endif 00041 00051 class TQDBUS_EXPORT TQT_DBusUnixFd 00052 { 00053 public: 00057 TQT_DBusUnixFd(); 00058 00064 TQT_DBusUnixFd(const TQT_DBusUnixFd& other); 00065 00071 TQT_DBusUnixFd(int other); 00072 00076 virtual ~TQT_DBusUnixFd(); 00077 00086 bool isValid() const; 00087 00093 int fileDescriptor() const; 00094 00100 void setFileDescriptor(int fileDescriptor); 00101 00107 void giveFileDescriptor(int fileDescriptor); 00108 00114 TQT_DBusUnixFd &operator=( const TQT_DBusUnixFd &other ); 00115 00124 inline bool operator==(const TQT_DBusUnixFd& other) const 00125 { 00126 return (&other == this) || (other.d == d); 00127 } 00128 00137 inline bool operator!=(const TQT_DBusUnixFd& other) const 00138 { 00139 return (&other != this) && (other.d != d); 00140 } 00141 00142 00143 protected: 00144 struct TQT_DBusUnixFdPrivate : public TQShared { 00145 int fd; 00146 } *d; 00147 00148 }; 00149 00150 #endif