diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-30 14:25:29 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-04-30 14:25:29 +0200 |
commit | 07780b06aa7b0fe049cc412309cf87e7fb10a0ef (patch) | |
tree | b6d0f1ee50223f5cbbc4b8c5d0dc4f69ff7f2352 /brep/module | |
parent | 259a92ac4e1ac50e4c029f54265b735f6214b49d (diff) |
Implement module configuration with an option list
Diffstat (limited to 'brep/module')
-rw-r--r-- | brep/module | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/brep/module b/brep/module index 54d41cf..d1399fb 100644 --- a/brep/module +++ b/brep/module @@ -11,6 +11,7 @@ #include <web/module> +#include <brep/options> #include <brep/diagnostics> namespace brep @@ -69,10 +70,6 @@ namespace brep // class module: public web::module { - public: - virtual void - handle (request&, response&) = 0; - // Diagnostics. // protected: @@ -95,18 +92,33 @@ namespace brep module (); module (const module& ); + private: virtual void handle (request&, response&, log&); virtual void - init (const char* path); + handle (request&, response&) = 0; + + virtual void + init (const name_values&, log&); + + // Can be overriden by module implementation which has configuration + // options. + // + virtual void + init (::cli::scanner& s) + { + // Just scan options to ensure there is no misspelled ones. + // + module_options o (s, cli::unknown_mode::fail, cli::unknown_mode::fail); + } // Diagnostics implementation details. // private: log* log_ {nullptr}; // Diagnostics backend provided by the web server. - public: + private: // Extract function name from a __PRETTY_FUNCTION__. // Throw std::invalid_argument if fail to parse. // |