Skip to content

Commit

Permalink
update namespace code style
Browse files Browse the repository at this point in the history
  • Loading branch information
IronsDu committed Oct 18, 2018
1 parent 1ed5d98 commit 0bc3b81
Show file tree
Hide file tree
Showing 41 changed files with 3,919 additions and 3,933 deletions.
2 changes: 2 additions & 0 deletions examples/BenchWebsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

using namespace brynet;
using namespace brynet::net;
using namespace brynet::net::http;
using namespace brynet::utils;

std::atomic<int32_t> count;

Expand Down
1 change: 1 addition & 0 deletions examples/BroadCastClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using namespace std;
using namespace brynet;
using namespace brynet::net;
using namespace brynet::utils;

atomic_llong TotalRecvPacketNum = ATOMIC_VAR_INIT(0);
atomic_llong TotalRecvSize = ATOMIC_VAR_INIT(0);
Expand Down
1 change: 1 addition & 0 deletions examples/BroadCastServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using namespace brynet;
using namespace brynet::net;
using namespace brynet::utils;

std::atomic_llong TotalSendLen = ATOMIC_VAR_INIT(0);
std::atomic_llong TotalRecvLen = ATOMIC_VAR_INIT(0);
Expand Down
1 change: 1 addition & 0 deletions examples/TestHttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using namespace brynet;
using namespace brynet::net;
using namespace brynet::net::http;

int main(int argc, char **argv)
{
Expand Down
1 change: 1 addition & 0 deletions examples/TestPromiseReceive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using namespace brynet;
using namespace brynet::net;
using namespace brynet::net::http;

int main(int argc, char **argv)
{
Expand Down
34 changes: 16 additions & 18 deletions src/brynet/net/Any.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,23 @@
#include <cstdint>
#endif

namespace brynet
{
namespace net
{
namespace brynet { namespace net {

#ifdef HAVE_LANG_CXX17
typedef std::any BrynetAny;
using BrynetAny = std::any;

template<typename T>
auto cast(const BrynetAny& ud)
{
return std::any_cast<T>(&ud);
}
template<typename T>
auto cast(const BrynetAny& ud)
{
return std::any_cast<T>(&ud);
}
#else
typedef int64_t BrynetAny;
template<typename T>
const T* cast(const BrynetAny& ud)
{
return static_cast<const T*>(&ud);
}
#endif
using BrynetAny = int64_t;
template<typename T>
const T* cast(const BrynetAny& ud)
{
return static_cast<const T*>(&ud);
}
}
#endif

} }
30 changes: 14 additions & 16 deletions src/brynet/net/Channel.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#pragma once

namespace brynet
{
namespace net
namespace brynet { namespace net {

class EventLoop;

class Channel
{
class EventLoop;
public:
virtual ~Channel() = default;

class Channel
{
public:
virtual ~Channel() = default;
private:
virtual void canSend() = 0;
virtual void canRecv() = 0;
virtual void onClose() = 0;

private:
virtual void canSend() = 0;
virtual void canRecv() = 0;
virtual void onClose() = 0;
friend class EventLoop;
};

friend class EventLoop;
};
}
}
} }
Loading

0 comments on commit 0bc3b81

Please sign in to comment.