Classes | Public Member Functions | Protected Attributes

TQT_DBusUnixFd Class Reference

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

#include <tqdbusunixfd.h>

Collaboration diagram for TQT_DBusUnixFd:

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.

                               : d(new TQT_DBusUnixFdPrivate())
{
    d->ref();
    d->fd = -1;
};

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.

                                                          : d(other.d)
{
    d->ref();
}

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().

                                        : d(0)
{
    setFileDescriptor(other);
}

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().

{
    if (d && d->deref() ) {
        if ( isValid() ) {
            close(d->fd);
        }
        delete d;
    }
}

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.

{
    return d ? d->fd : -1;
}

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().

{
    if ( d && d->deref() ) {
        if ( isValid() ) {
            close(d->fd);
        }
    }
    else {
        d = new TQT_DBusUnixFdPrivate;
    }
    d->ref();
    d->fd = fileDescriptor;
}

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.

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

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.

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

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().

{
    if (other.d) {
        other.d->ref();
    }
    if ( d && d->deref() ) {
        if ( isValid() ) {
            close(d->fd);
        }
        delete d;
    }
    d = other.d;
    return *this;
}

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.

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

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().

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: