DBus-1-TQt 1.0
Loading...
Searching...
No Matches
TQT_DBusUnixFd Class Reference

#include <tqdbusunixfd.h>

+ Collaboration diagram for TQT_DBusUnixFd:

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() [1/3]

TQT_DBusUnixFd::TQT_DBusUnixFd ( )

Creates an empty and invalid unix file handle.

Definition at line 27 of file tqdbusunixfd.cpp.

27 : d(new TQT_DBusUnixFdPrivate())
28{
29 d->ref();
30 d->fd = -1;
31};
TQT_DBusUnixFd::TQT_DBusUnixFdPrivate * d

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

◆ TQT_DBusUnixFd() [2/3]

TQT_DBusUnixFd::TQT_DBusUnixFd ( const TQT_DBusUnixFd other)

Creates copy of the given other unix file handle.

Parameters
otherthe unix file handle to copy

Definition at line 33 of file tqdbusunixfd.cpp.

33 : d(other.d)
34{
35 d->ref();
36}

References d.

◆ TQT_DBusUnixFd() [3/3]

TQT_DBusUnixFd::TQT_DBusUnixFd ( int  other)

Creates copy of the given other unix file handle.

Parameters
otherthe unix file handle to copy

Definition at line 38 of file tqdbusunixfd.cpp.

38 : d(0)
39{
40 setFileDescriptor(other);
41}
void setFileDescriptor(int fileDescriptor)
Set new unix file handle.

References setFileDescriptor().

+ Here is the call graph for this function:

◆ ~TQT_DBusUnixFd()

TQT_DBusUnixFd::~TQT_DBusUnixFd ( )
virtual

Destroys the unix file handle.

Definition at line 43 of file tqdbusunixfd.cpp.

44{
45 if (d && d->deref() ) {
46 if ( isValid() ) {
47 close(d->fd);
48 }
49 delete d;
50 }
51}
bool isValid() const
Returns whether the current content is considered a valid unix file handle.

References d, TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd, and isValid().

+ Here is the call graph for this function:

Member Function Documentation

◆ fileDescriptor()

int TQT_DBusUnixFd::fileDescriptor ( ) const

Get unix file handle.

See also
dbusconventions-unixfd

Definition at line 58 of file tqdbusunixfd.cpp.

59{
60 return d ? d->fd : -1;
61}

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

+ Here is the caller graph for this function:

◆ giveFileDescriptor()

void TQT_DBusUnixFd::giveFileDescriptor ( int  fileDescriptor)

Give unix file handle.

See also
dbusconventions-unixfd

Definition at line 68 of file tqdbusunixfd.cpp.

69{
70 if ( d && d->deref() ) {
71 if ( isValid() ) {
72 close(d->fd);
73 }
74 }
75 else {
76 d = new TQT_DBusUnixFdPrivate;
77 }
78 d->ref();
80}
int fileDescriptor() const
Get unix file handle.

References d, TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd, fileDescriptor(), and isValid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValid()

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.

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

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

+ Here is the caller graph for this function:

◆ operator!=()

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

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

Parameters
otherunix file handle to compare with
Returns
true if both use different file handle, otherwise false

Definition at line 137 of file tqdbusunixfd.h.

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

References d.

◆ operator=()

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.

83{
84 if (other.d) {
85 other.d->ref();
86 }
87 if ( d && d->deref() ) {
88 if ( isValid() ) {
89 close(d->fd);
90 }
91 delete d;
92 }
93 d = other.d;
94 return *this;
95}

References d, TQT_DBusUnixFd::TQT_DBusUnixFdPrivate::fd, and isValid().

+ Here is the call graph for this function:

◆ operator==()

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

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

Parameters
otherunix file handle to compare with
Returns
true if both use same file handle, otherwise false

Definition at line 124 of file tqdbusunixfd.h.

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

References d.

◆ setFileDescriptor()

void TQT_DBusUnixFd::setFileDescriptor ( int  fileDescriptor)

Set new unix file handle.

See also
dbusconventions-unixfd

Definition at line 63 of file tqdbusunixfd.cpp.

64{
66}
void giveFileDescriptor(int fileDescriptor)
Give unix file handle.

References fileDescriptor(), and giveFileDescriptor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ d

TQT_DBusUnixFd::TQT_DBusUnixFdPrivate * TQT_DBusUnixFd::d
protected

The documentation for this class was generated from the following files: