refactor: move impl into .cpp + fix include paths
This commit is contained in:
parent
9a23b29c12
commit
38b8f34b28
9 changed files with 123 additions and 50 deletions
|
|
@ -19,19 +19,9 @@ namespace xo {
|
|||
Alist() = default;
|
||||
|
||||
/* lookup association by name */
|
||||
std::string_view lookup(std::string n) const {
|
||||
for (auto const & ix : this->assoc_v_) {
|
||||
if (ix.first == n) {
|
||||
return ix.second;
|
||||
}
|
||||
}
|
||||
std::string_view lookup(std::string n) const;
|
||||
|
||||
return "";
|
||||
} /*lookup*/
|
||||
|
||||
void push_back(std::string n, std::string v) {
|
||||
this->assoc_v_.push_back(std::make_pair(std::move(n), std::move(v)));
|
||||
}
|
||||
void push_back(std::string n, std::string v);
|
||||
|
||||
private:
|
||||
std::vector<std::pair<std::string, std::string>> assoc_v_;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "web_util/Alist.hpp"
|
||||
#include "refcnt/Refcounted.hpp"
|
||||
#include "indentlog/print/tag.hpp"
|
||||
#include "indentlog/print/tostr.hpp"
|
||||
#include "Alist.hpp"
|
||||
#include "xo/refcnt/Refcounted.hpp"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace xo {
|
||||
namespace web {
|
||||
|
|
@ -26,21 +25,14 @@ namespace xo {
|
|||
class HttpEndpointDescr {
|
||||
public:
|
||||
HttpEndpointDescr(std::string uri_pattern,
|
||||
HttpEndpointFn endpoint_fn)
|
||||
: uri_pattern_{std::move(uri_pattern)},
|
||||
endpoint_fn_{std::move(endpoint_fn)}
|
||||
{}
|
||||
HttpEndpointFn endpoint_fn);
|
||||
|
||||
std::string const & uri_pattern() const { return uri_pattern_; }
|
||||
HttpEndpointFn const & endpoint_fn() const { return endpoint_fn_; }
|
||||
|
||||
void display(std::ostream & os) const {
|
||||
using xo::xtag;
|
||||
void display(std::ostream & os) const;
|
||||
|
||||
os << "<HttpEndpointDescr" << xtag("uri_pattern", uri_pattern_) << ">";
|
||||
} /*display*/
|
||||
|
||||
std::string display_string() const { return xo::tostr(*this); }
|
||||
std::string display_string() const;
|
||||
|
||||
private:
|
||||
/* unique pattern in URI-space for this endpoint.
|
||||
|
|
|
|||
|
|
@ -6,10 +6,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "Alist.hpp"
|
||||
#include "callback/CallbackSet.hpp"
|
||||
#include "refcnt/Refcounted.hpp"
|
||||
#include "indentlog/print/tag.hpp"
|
||||
#include "indentlog/print/tostr.hpp"
|
||||
#include "xo/callback/CallbackSet.hpp"
|
||||
#include "xo/refcnt/Refcounted.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace xo {
|
||||
|
|
@ -30,22 +28,15 @@ namespace xo {
|
|||
public:
|
||||
StreamEndpointDescr(std::string uri_pattern,
|
||||
StreamSubscribeFn subscribe_fn,
|
||||
StreamUnsubscribeFn unsubscribe_fn)
|
||||
: uri_pattern_{std::move(uri_pattern)},
|
||||
subscribe_fn_{std::move(subscribe_fn)},
|
||||
unsubscribe_fn_{std::move(unsubscribe_fn)} {}
|
||||
StreamUnsubscribeFn unsubscribe_fn);
|
||||
|
||||
std::string const & uri_pattern() const { return uri_pattern_; }
|
||||
StreamSubscribeFn const & subscribe_fn() const { return subscribe_fn_; }
|
||||
StreamUnsubscribeFn const & unsubscribe_fn() const { return unsubscribe_fn_; }
|
||||
|
||||
void display(std::ostream & os) const {
|
||||
using xo::xtag;
|
||||
void display(std::ostream & os) const;
|
||||
|
||||
os << "<StreamEndpointDescr" << xtag("uri_pattern", uri_pattern_) << ">";
|
||||
} /*display*/
|
||||
|
||||
std::string display_string() const { return xo::tostr(*this); }
|
||||
std::string display_string() const;
|
||||
|
||||
private:
|
||||
/* unique pattern in URI-space for this endpoint
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue