TQT_DBusUnixFd Class Reference

Class for representing D-Bus unix file handles. More...

#include <tqdbusunixfd.h>

Collaboration diagram for TQT_DBusUnixFd:
[legend]

List of all members.

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_DBusUnixFdoperator= (const TQT_DBusUnixFd &other)
bool operator== (const TQT_DBusUnixFd &other) const
bool operator!= (const TQT_DBusUnixFd &other) const

Protected Attributes

TQT_DBusUnixFd::TQT_DBusUnixFdPrivated

Detailed Description

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.

See also:
dbusconventions-unixfd

Definition at line 51 of file tqdbusunixfd.h.


Constructor & Destructor Documentation

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.

00027                                : d(new TQT_DBusUnixFdPrivate())
00028 {
00029     d->ref();
00030     d->fd = -1;
00031 };

TQT_DBusUnixFd::TQT_DBusUnixFd ( const TQT_DBusUnixFd other  ) 

Creates copy of the given other unix file handle.

Parameters:
other the unix file handle to copy

Definition at line 33 of file tqdbusunixfd.cpp.

References d.

00033                                                           : d(other.d)
00034 {
00035     d->ref();
00036 }

TQT_DBusUnixFd::TQT_DBusUnixFd ( int  other  ) 

Creates copy of the given other unix file handle.

Parameters:
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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:


Member Function Documentation

int TQT_DBusUnixFd::fileDescriptor (  )  const

Get unix file handle.

See also:
dbusconventions-unixfd

Definition at line 58 of file tqdbusunixfd.cpp.

References d, and TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd.

00059 {
00060     return d ? d->fd : -1;
00061 }

Here is the caller graph for this function:

void TQT_DBusUnixFd::giveFileDescriptor ( int  fileDescriptor  ) 

Give unix file handle.

See also:
dbusconventions-unixfd

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool TQT_DBusUnixFd::isValid (  )  const

Returns whether the current content is considered a valid unix file handle.

Returns:
true if the object's content describe a valid unix file handle, otherwise false
See also:
dbusconventions-unixfd

Definition at line 53 of file tqdbusunixfd.cpp.

References d, and TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd.

00054 {
00055     return d ? d->fd != -1 : false;
00056 }

Here is the caller graph for this function:

bool TQT_DBusUnixFd::operator!= ( const TQT_DBusUnixFd other  )  const [inline]

Checks if the given other variant is not equal to this one.

Parameters:
other unix file handle to compare with
Returns:
true if both use different file handle, otherwise false

Definition at line 137 of file tqdbusunixfd.h.

References d.

00138     {
00139         return (&other != this) && (other.d != d);
00140     }

TQT_DBusUnixFd & TQT_DBusUnixFd::operator= ( const TQT_DBusUnixFd other  ) 

Copy unix file handle from TQT_DBusUnixFd.

See also:
dbusconventions-unixfd

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 }

Here is the call graph for this function:

bool TQT_DBusUnixFd::operator== ( const TQT_DBusUnixFd other  )  const [inline]

Checks if the given other variant is equal to this one.

Parameters:
other unix file handle to compare with
Returns:
true if both use same file handle, otherwise false

Definition at line 124 of file tqdbusunixfd.h.

References d.

00125     {
00126         return (&other == this) || (other.d == d);
00127     }

void TQT_DBusUnixFd::setFileDescriptor ( int  fileDescriptor  ) 

Set new unix file handle.

See also:
dbusconventions-unixfd

Definition at line 63 of file tqdbusunixfd.cpp.

References giveFileDescriptor().

00064 {
00065     giveFileDescriptor(fileDescriptor != -1 ? dup(fileDescriptor) : -1);
00066 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation


The documentation for this class was generated from the following files:
Generated on Fri Apr 26 16:30:22 2019 for DBus-1-TQt by  doxygen 1.6.3