File indexing completed on 2024-05-05 16:13:48

0001 /*
0002     SPDX-FileCopyrightText: 2017 Chinmoy Ranjan Pradhan <chinmoyrp65@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef FDRECEIVER_H
0008 #define FDRECEIVER_H
0009 
0010 #include <QObject>
0011 
0012 class QSocketNotifier;
0013 class FdReceiver : public QObject
0014 {
0015     Q_OBJECT
0016 
0017 public:
0018     explicit FdReceiver(const std::string &path, QObject *parent = nullptr);
0019     ~FdReceiver() override;
0020 
0021     bool isListening() const;
0022     int fileDescriptor() const;
0023 
0024 private:
0025     Q_SLOT void receiveFileDescriptor();
0026 
0027     QSocketNotifier *m_readNotifier;
0028     std::string m_path;
0029     int m_socketDes;
0030     int m_fileDes;
0031 };
0032 
0033 #endif