DBus-1-TQt 1.0
tqdbusunixfd.h
Go to the documentation of this file.
1/* tqdbusunixfd.h DBUS unix file handle data type
2 *
3 * Copyright (C) 2013 Slávek Banko <slavek.banko@axis.cz>
4 *
5 * Licensed under the Academic Free License version 2.1
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 * USA.
21 *
22 */
23
24#ifndef TQDBUSUNIXFD_H
25#define TQDBUSUNIXFD_H
26
27#include "dbus/dbus.h"
28#ifndef QT_H
29#include "ntqshared.h"
30#endif // QT_H
31#include "tqdbusmacros.h"
32
33
34#ifndef DBUS_TYPE_UNIX_FD
35#define DBUS_TYPE_UNIX_FD ((int) 'h')
36#endif
37
38#ifndef DBUS_TYPE_UNIX_FD_AS_STRING
39#define DBUS_TYPE_UNIX_FD_AS_STRING "h"
40#endif
41
52{
53public:
58
64 TQT_DBusUnixFd(const TQT_DBusUnixFd& other);
65
71 TQT_DBusUnixFd(int other);
72
76 virtual ~TQT_DBusUnixFd();
77
86 bool isValid() const;
87
93 int fileDescriptor() const;
94
100 void setFileDescriptor(int fileDescriptor);
101
107 void giveFileDescriptor(int fileDescriptor);
108
114 TQT_DBusUnixFd &operator=( const TQT_DBusUnixFd &other );
115
124 inline bool operator==(const TQT_DBusUnixFd& other) const
125 {
126 return (&other == this) || (other.d == d);
127 }
128
137 inline bool operator!=(const TQT_DBusUnixFd& other) const
138 {
139 return (&other != this) && (other.d != d);
140 }
141
142
143protected:
144 struct TQT_DBusUnixFdPrivate : public TQShared {
145 int fd;
146 } *d;
147
148};
149
150#endif
Class for representing D-Bus unix file handles.
Definition: tqdbusunixfd.h:52
TQT_DBusUnixFd::TQT_DBusUnixFdPrivate * d
bool operator==(const TQT_DBusUnixFd &other) const
Checks if the given other variant is equal to this one.
Definition: tqdbusunixfd.h:124
bool operator!=(const TQT_DBusUnixFd &other) const
Checks if the given other variant is not equal to this one.
Definition: tqdbusunixfd.h:137
#define TQDBUS_EXPORT
Definition: tqdbusmacros.h:29