From 07780b06aa7b0fe049cc412309cf87e7fb10a0ef Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 30 Apr 2015 14:25:29 +0200 Subject: Implement module configuration with an option list --- brep/view.cxx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'brep/view.cxx') diff --git a/brep/view.cxx b/brep/view.cxx index 6dafa1b..7ccc159 100644 --- a/brep/view.cxx +++ b/brep/view.cxx @@ -4,12 +4,43 @@ #include +#include // shared_ptr, make_shared() +#include + +#include + using namespace std; namespace brep { void view:: + init (::cli::scanner& s) + { + options_ = std::make_shared (s, + ::cli::unknown_mode::fail, + ::cli::unknown_mode::fail); + } + + void view:: handle (request& rq, response& rs) { + ostream& o (rs.content (200, "text/html;charset=utf-8", false)); + + o << ""; + + o << "Options:" + << "
\ntracing verbosity: " << options_->verb () + << "
\ndb endpoint: " << options_->db_host () << ":" + << options_->db_port (); + + o << "

\nCookies:"; + + for (const auto& c: rq.cookies ()) + { + o << "
\n" << c.name << "=" << c.value; + } + + o << "

Search" + << ""; } } -- cgit v1.1