Diffstat (limited to 'include/sitecing/configuration.h') (more/less context) (show whitespace changes)
-rw-r--r-- | include/sitecing/configuration.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/include/sitecing/configuration.h b/include/sitecing/configuration.h index 330a5a6..a2bf612 100644 --- a/include/sitecing/configuration.h +++ b/include/sitecing/configuration.h @@ -123,50 +123,59 @@ namespace sitecing { * Enforced depencies for .so objects. */ list<string> so_deps; /** * The action handler type. */ struct action_handler_t { /** * The regexp to check request against. */ string s_regex; /** * Precompiled regex. */ pcrepp::Pcre regex; /** * The action handler component. */ string action; /** * Arguments for the action hander coponent. */ list<string> args; + /** + * @param s regex pattern + * @param a action handler + */ action_handler_t(const string& s,const string& a) : s_regex(s), regex(s), action(a) { } + /** + * Copy constructor + * + * @param s source object + */ action_handler_t(const action_handler_t& s) : s_regex(s.s_regex), regex(s.regex), action (s.action), args(s.args) { } }; /** * Type for the list of action handlers. */ typedef list<action_handler_t> action_handlers_t; /** * The list of action handlers. */ action_handlers_t action_handlers; /** * Type for the map of HTTP status handler components. */ typedef map<string,string> http_status_handlers_t; /** * The map of HTTP status handler components. */ http_status_handlers_t http_status_handlers; /** * Files to be built automatically. */ list<string> auto_build_files; @@ -197,49 +206,49 @@ namespace sitecing { /** * Configuration data container for the configuration loaded from disk file. */ class loaded_options : public config_options { public: /** * The file where configuration originates from. */ string source_file; /** * The stat structure for the source file as it was when we have * loaded it. */ struct stat st; /** * See if the data is still valid. * @return true if yes. */ bool is_valid(); /** * Load the configuration file. * @param config the main configuration container. - * @param the configuration file. + * @param cfile the configuration file. */ void parse(configuration *config,const string& cfile); }; /** * The main configuration container. */ class configuration { public: /** * @todo TODO:: document me. */ bool autobuild; /** * The flags enumeration. */ enum _flags { /** * Was the source root specified? * @see root_source */ flag_root_source = 0x00000001, /** * Was the root for intermediate files specified? @@ -277,49 +286,49 @@ namespace sitecing { */ flag_min_spare_children = 0x00000080, /** * Was he maximum number of spare child processes specified? * @see max_spare_children */ flag_max_spare_children = 0x00000100, /** * Was the number of requests to handle per child process * specified? * @see requests_per_child */ flag_requests_per_child = 0x00000200, /** * Was the multiprocess node (or it's absences) specified? * @see multi_process */ flag_multi_process = 0x00000400, /** * Was the user specified? * @see user */ flag_user = 0x00000800, /** - * @Was the group specified? + * Was the group specified? * @see group */ flag_group = 0x00001000, /** * Was the root to change to specified? * @see chroot */ flag_chroot = 0x00002000, /** * Was the file for storing PID specified? * @see pidfile */ flag_pid_file = 0x00004000, /** * Was it specified wether we should daemonize the process? * @see daemonize */ flag_daemonize = 0x00008000 }; /** * The flags specifying what parts of the configuration has been * loaded into the object. */ long flags; @@ -369,64 +378,72 @@ namespace sitecing { * Whether we should run in multiprocess mode or not. */ bool multi_process; /** * User to change to. */ string user; /** * Group to set to. */ string group; /** * Directory to change root to. */ string chroot; /** * The file to store PID into. */ string pid_file; /** * Whether we should fork into background. */ bool daemonize; + /** + * Type for the config options map + * @see specs + */ typedef map<string,config_options> specs_t; /** * The local config options map. */ specs_t specs; + /** + * Type for the loaded per-dir config map + * @see loaded_specs + */ typedef map<string,loaded_options> loaded_specs_t; /** * The local config options as specified in per-dir config files * map. */ loaded_specs_t loaded_specs; configuration(); /** * @param cfile the configuration file. - * @param ab @todo TODO:: document me + * @param ab document me @todo TODO:: document me */ configuration(const string& cfile,bool ab=false); /** * Parse the configuration file. * @param cfile the configuration file. */ void parse(const string& cfile); /** * Fetch the reference to options for the very root. */ config_options& root_options() { return specs[""]; } /** * Lookup where the certain config option for the target lies in. * @param target the target component. * @param flag the flag specifying the option we're looking for. * @return the destination options continer or zero. */ config_options* lookup_config(const string& target,int flag); /** * Lookup the action handler for the target. * @param target the target request. * @return the action handler or zero. |