libzypp  17.34.1
socketnotifier.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \----------------------------------------------------------------------/
9 *
10 * This file contains private API, this might break at any time between releases.
11 * You have been warned!
12 *
13 */
14 
15 #ifndef ZYPPNG_BASE_SOCKETNOTIFIER_H_DEFINED
16 #define ZYPPNG_BASE_SOCKETNOTIFIER_H_DEFINED
17 
19 #include <zypp-core/zyppng/base/AbstractEventSource>
20 #include <zypp-core/zyppng/base/Signals>
21 
22 namespace zyppng {
23 class SocketNotifierPrivate;
24 
69 {
71 public:
72 
73  using Ptr = std::shared_ptr<SocketNotifier>;
74  using WeakPtr = std::weak_ptr<SocketNotifier>;
75 
77 
84  static Ptr create ( int socket, int evTypes, bool enable = true );
85 
90  void setMode ( int mode );
91 
96  int mode () const;
97 
101  void setEnabled ( bool enabled = true );
102 
106  int socket () const;
107 
112 
113 protected:
114  SocketNotifier( int socket, int evTypes );
115 
116  // AbstractEventSource interface
117 public:
118  void onFdReady(int, int events) override;
119  void onSignal(int signal) override;
120 };
121 
122 }
123 
124 #endif
void onSignal(int signal) override
std::weak_ptr< Base > WeakPtr
Definition: base.h:66
void onFdReady(int, int events) override
SocketNotifier(int socket, int evTypes)
void setMode(int mode)
static Ptr create(int socket, int evTypes, bool enable=true)
void setEnabled(bool enabled=true)
#define ZYPP_DECLARE_PRIVATE(Class)
Definition: zyppglobal.h:86
SignalProxy< void(const SocketNotifier &sock, int evTypes)> sigActivated()
std::shared_ptr< Base > Ptr
Definition: base.h:65