Remove all global-namespace-level using directives from headers · cucumber/cucumber-cpp@6882ac8 · GitHub
Skip to content

Commit 6882ac8

Browse files
committed
Remove all global-namespace-level using directives from headers
I.e. stop polluting the global namespace of our clients with symbols from other namespaces just to make our code slightly less verbose.
1 parent 83b71e9 commit 6882ac8

6 files changed

Lines changed: 19 additions & 29 deletions

File tree

‎include/cucumber-cpp/internal/ContextManager.hpp‎

Lines changed: 8 additions & 11 deletions

‎include/cucumber-cpp/internal/connectors/wire/WireServer.hpp‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
namespace cucumber {
1111
namespace internal {
1212

13-
using namespace boost::asio;
14-
using namespace boost::asio::ip;
15-
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
16-
using namespace boost::asio::local;
17-
#endif
18-
1913
/**
2014
* Socket server that calls a protocol handler line by line
2115
*/
@@ -33,13 +27,13 @@ class SocketServer {
3327

3428
protected:
3529
const ProtocolHandler *protocolHandler;
36-
io_service ios;
30+
boost::asio::io_service ios;
3731

3832
template <typename Protocol, typename Service>
39-
void doListen(basic_socket_acceptor<Protocol, Service>& acceptor,
33+
void doListen(boost::asio::basic_socket_acceptor<Protocol, Service>& acceptor,
4034
const typename Protocol::endpoint& endpoint);
4135
template <typename Protocol, typename Service>
42-
void doAcceptOnce(basic_socket_acceptor<Protocol, Service>& acceptor);
36+
void doAcceptOnce(boost::asio::basic_socket_acceptor<Protocol, Service>& acceptor);
4337
void processStream(std::iostream &stream);
4438
};
4539

@@ -66,7 +60,7 @@ class TCPSocketServer : public SocketServer {
6660
/**
6761
* Bind and listen to a TCP port on the given endpoint
6862
*/
69-
void listen(const tcp::endpoint endpoint);
63+
void listen(const boost::asio::ip::tcp::endpoint endpoint);
7064

7165
/**
7266
* Endpoint (IP address and port number) that this server is currently
@@ -75,12 +69,12 @@ class TCPSocketServer : public SocketServer {
7569
* @throw boost::system::system_error when not listening on any socket or
7670
* the endpoint cannot be determined.
7771
*/
78-
tcp::endpoint listenEndpoint() const;
72+
boost::asio::ip::tcp::endpoint listenEndpoint() const;
7973

8074
virtual void acceptOnce();
8175

8276
private:
83-
tcp::acceptor acceptor;
77+
boost::asio::ip::tcp::acceptor acceptor;
8478
};
8579

8680
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
@@ -105,14 +99,14 @@ class UnixSocketServer : public SocketServer {
10599
* @throw boost::system::system_error when not listening on any socket or
106100
* the endpoint cannot be determined.
107101
*/
108-
stream_protocol::endpoint listenEndpoint() const;
102+
boost::asio::local::stream_protocol::endpoint listenEndpoint() const;
109103

110104
virtual void acceptOnce();
111105

112106
~UnixSocketServer();
113107

114108
private:
115-
stream_protocol::acceptor acceptor;
109+
boost::asio::local::stream_protocol::acceptor acceptor;
116110
};
117111
#endif
118112

‎include/cucumber-cpp/internal/hook/HookRegistrar.hpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#include "../step/StepManager.hpp"
77

88
#include <boost/make_shared.hpp>
9-
#include <boost/smart_ptr.hpp>
10-
using boost::shared_ptr;
9+
#include <boost/shared_ptr.hpp>
1110

1211
#include <list>
1312

‎src/HookRegistrar.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <cucumber-cpp/internal/hook/HookRegistrar.hpp>
22
#include <cucumber-cpp/internal/CukeCommands.hpp>
3-
#include <boost/make_shared.hpp>
43

54
namespace cucumber {
65
namespace internal {

‎src/connectors/wire/WireServer.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace cucumber {
55
namespace internal {
66

7+
using namespace boost::asio;
78
using namespace boost::asio::ip;
89
#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
910
using namespace boost::asio::local;

‎src/main.cpp‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)