diff options
Diffstat (limited to 'project2/common/environment.h')
-rw-r--r-- | project2/common/environment.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/project2/common/environment.h b/project2/common/environment.h new file mode 100644 index 0000000..681a80c --- /dev/null +++ b/project2/common/environment.h @@ -0,0 +1,51 @@ +#ifndef ENVIRONMENT_H +#define ENVIRONMENT_H + +#include <string> +#include <glibmm/ustring.h> +#include <boost/program_options.hpp> +#include <boost/function.hpp> +#include <boost/filesystem/path.hpp> + +class Environment { + public: + Environment(int argc, char ** argv); + virtual ~Environment() = 0; + + void init(); + + static const Environment * getCurrent(); + + virtual Glib::ustring getParamUri(unsigned int idx) const = 0; + virtual Glib::ustring getParamQuery(const std::string & idx) const = 0; + + virtual std::string getServerName() const = 0; + virtual std::string getScriptName() const = 0; + + boost::filesystem::path resolveScript(const std::string & group, const std::string & name) const; + boost::filesystem::path resolveScript(const std::string & path) const; + + private: + static const Environment * currentEnv; + + virtual boost::program_options::options_description addOptions(boost::program_options::positional_options_description &) = 0; + virtual void postinit(const boost::program_options::options_description &, const boost::program_options::variables_map &) = 0; + int argc; + char ** argv; + + static bool optionsBuilt; + static boost::program_options::options_description allOptions; + static boost::program_options::positional_options_description posOptions; + + static int clLevel; + static int slLevel; + + public: + std::string datasourceRoot; + Glib::ustring xmlNamespace; + Glib::ustring xmlPrefix; + time_t sessionTimeOut; +}; + +#endif + |