net: Replace enum CConnMan::NumConnections with enum class ConnectionDirection

This commit is contained in:
Luke Dashjr
2019-10-16 17:37:19 +00:00
parent b4d22654fe
commit c77de622dd
9 changed files with 36 additions and 24 deletions

View File

@@ -18,6 +18,7 @@
#include <memory>
#include <stdint.h>
#include <string>
#include <type_traits>
#include <vector>
extern int nConnectTimeout;
@@ -28,6 +29,22 @@ static const int DEFAULT_CONNECT_TIMEOUT = 5000;
//! -dns default
static const int DEFAULT_NAME_LOOKUP = true;
enum class ConnectionDirection {
None = 0,
In = (1U << 0),
Out = (1U << 1),
Both = (In | Out),
};
static inline ConnectionDirection& operator|=(ConnectionDirection& a, ConnectionDirection b) {
using underlying = typename std::underlying_type<ConnectionDirection>::type;
a = ConnectionDirection(underlying(a) | underlying(b));
return a;
}
static inline bool operator&(ConnectionDirection a, ConnectionDirection b) {
using underlying = typename std::underlying_type<ConnectionDirection>::type;
return (underlying(a) & underlying(b));
}
class proxyType
{
public: