Class for representing D-Bus unix file handles. More...
#include <tqdbusunixfd.h>
Classes | |
| struct | TQT_DBusUnixFdPrivate |
Public Member Functions | |
| TQT_DBusUnixFd () | |
| TQT_DBusUnixFd (const TQT_DBusUnixFd &other) | |
| TQT_DBusUnixFd (int other) | |
| virtual | ~TQT_DBusUnixFd () |
| bool | isValid () const |
| int | fileDescriptor () const |
| void | setFileDescriptor (int fileDescriptor) |
| void | giveFileDescriptor (int fileDescriptor) |
| TQT_DBusUnixFd & | operator= (const TQT_DBusUnixFd &other) |
| bool | operator== (const TQT_DBusUnixFd &other) const |
| bool | operator!= (const TQT_DBusUnixFd &other) const |
Protected Attributes | |
| TQT_DBusUnixFd::TQT_DBusUnixFdPrivate * | d |
Class for representing D-Bus unix file handles.
This data type is necessary to correctly represent unix file handles in the context of D-Bus messages, since normal strings have a different D-Bus signature than unix file handles.
Definition at line 51 of file tqdbusunixfd.h.
| TQT_DBusUnixFd::TQT_DBusUnixFd | ( | ) |
Creates an empty and invalid unix file handle.
Definition at line 27 of file tqdbusunixfd.cpp.
References d, and TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd.
| TQT_DBusUnixFd::TQT_DBusUnixFd | ( | const TQT_DBusUnixFd & | other | ) |
| TQT_DBusUnixFd::TQT_DBusUnixFd | ( | int | other | ) |
Creates copy of the given other unix file handle.
| other | the unix file handle to copy |
Definition at line 38 of file tqdbusunixfd.cpp.
References setFileDescriptor().
00038 : d(0) 00039 { 00040 setFileDescriptor(other); 00041 }
| TQT_DBusUnixFd::~TQT_DBusUnixFd | ( | ) | [virtual] |
Destroys the unix file handle.
Definition at line 43 of file tqdbusunixfd.cpp.
References d, TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd, and isValid().
00044 { 00045 if (d && d->deref() ) { 00046 if ( isValid() ) { 00047 close(d->fd); 00048 } 00049 delete d; 00050 } 00051 }
| int TQT_DBusUnixFd::fileDescriptor | ( | ) | const |
Get unix file handle.
Definition at line 58 of file tqdbusunixfd.cpp.
References d, and TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd.
| void TQT_DBusUnixFd::giveFileDescriptor | ( | int | fileDescriptor | ) |
Give unix file handle.
Definition at line 68 of file tqdbusunixfd.cpp.
References d, TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd, and isValid().
00069 { 00070 if ( d && d->deref() ) { 00071 if ( isValid() ) { 00072 close(d->fd); 00073 } 00074 } 00075 else { 00076 d = new TQT_DBusUnixFdPrivate; 00077 } 00078 d->ref(); 00079 d->fd = fileDescriptor; 00080 }
| bool TQT_DBusUnixFd::isValid | ( | ) | const |
Returns whether the current content is considered a valid unix file handle.
true if the object's content describe a valid unix file handle, otherwise false Definition at line 53 of file tqdbusunixfd.cpp.
References d, and TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd.
| bool TQT_DBusUnixFd::operator!= | ( | const TQT_DBusUnixFd & | other | ) | const [inline] |
Checks if the given other variant is not equal to this one.
| other | unix file handle to compare with |
true if both use different file handle, otherwise false Definition at line 137 of file tqdbusunixfd.h.
References d.
| TQT_DBusUnixFd & TQT_DBusUnixFd::operator= | ( | const TQT_DBusUnixFd & | other | ) |
Copy unix file handle from TQT_DBusUnixFd.
Definition at line 82 of file tqdbusunixfd.cpp.
References d, TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd, and isValid().
00083 { 00084 if (other.d) { 00085 other.d->ref(); 00086 } 00087 if ( d && d->deref() ) { 00088 if ( isValid() ) { 00089 close(d->fd); 00090 } 00091 delete d; 00092 } 00093 d = other.d; 00094 return *this; 00095 }
| bool TQT_DBusUnixFd::operator== | ( | const TQT_DBusUnixFd & | other | ) | const [inline] |
Checks if the given other variant is equal to this one.
| other | unix file handle to compare with |
true if both use same file handle, otherwise false Definition at line 124 of file tqdbusunixfd.h.
References d.
| void TQT_DBusUnixFd::setFileDescriptor | ( | int | fileDescriptor | ) |
Set new unix file handle.
Definition at line 63 of file tqdbusunixfd.cpp.
References giveFileDescriptor().
00064 { 00065 giveFileDescriptor(fileDescriptor != -1 ? dup(fileDescriptor) : -1); 00066 }
TQT_DBusUnixFd::TQT_DBusUnixFdPrivate * TQT_DBusUnixFd::d [protected] |
1.6.3