@@ -89,20 +89,14 @@ class ServerImplHandler {
89
89
*/
90
90
class Server {
91
91
public:
92
- Server (const std::string& addr, int port)
93
- : listen_addr_(addr), listen_port_(port), listen_threads_(3 ), listening_(false ) {}
94
-
95
- Server () : listen_addr_(" 127.0.0.1" ), listen_port_(8080 ), listen_threads_(3 ), listening_(false ) {}
92
+ Server (const std::string& addr, int port);
93
+ Server ();
96
94
97
95
/* *
98
96
* When a Server goes out of scope, it will stop listening for you if you
99
97
* haven't done so already.
100
98
*/
101
- ~Server () {
102
- if (this ->is_listening ()) {
103
- this ->stop ();
104
- }
105
- }
99
+ ~Server ();
106
100
107
101
/* *
108
102
* Set the number of threads used for listening to connections.
@@ -138,9 +132,7 @@ class Server {
138
132
/* *
139
133
* Return endpoint data in json format.
140
134
*/
141
- cloe::Json endpoints_to_json (const std::vector<std::string>& endpoints) const {
142
- return handler_.endpoints_to_json (endpoints);
143
- };
135
+ cloe::Json endpoints_to_json (const std::vector<std::string>& endpoints) const ;
144
136
145
137
/* *
146
138
* Stop the server.
@@ -150,7 +142,7 @@ class Server {
150
142
/* *
151
143
* Return a list of all registered endpoints.
152
144
*/
153
- std::vector<std::string> endpoints () const { return handler_. endpoints (); }
145
+ std::vector<std::string> endpoints () const ;
154
146
155
147
protected:
156
148
friend StaticRegistrar;
@@ -160,7 +152,7 @@ class Server {
160
152
/* *
161
153
* Add a handler with the route muxer in the internal handler routine.
162
154
*/
163
- void add_handler (const std::string& key, Handler h) { handler_. add (key, h); }
155
+ void add_handler (const std::string& key, Handler h);
164
156
165
157
private:
166
158
// Configuration
0 commit comments