diff options
Diffstat (limited to 'server/src/configuration.h')
| -rw-r--r-- | server/src/configuration.h | 82 | 
1 files changed, 40 insertions, 42 deletions
| diff --git a/server/src/configuration.h b/server/src/configuration.h index 38dd233..1b851f3 100644 --- a/server/src/configuration.h +++ b/server/src/configuration.h @@ -32,57 +32,55 @@  #include "exception.h" -namespace Pentominos { +/** + * This exception is thrown by Configuration when reload fails. + */ +class ConfigurationException: public Exception { +public: +  ConfigurationException(std::string reason) :  +    Exception(reason) {} +}; +/** + * This is the pentominos configuration class.\n + * It simply wraps the libconfig c++ interface. It can be found at  + * http://www.hyperrealm.com/libconfig/libconfig.html\n + * To find out how the interface works, see + * http://www.hyperrealm.com/libconfig/libconfig_manual.html#The-C_002b_002b-API + */ +class Configuration : public libconfig::Config { +public:    /** -   * This exception is thrown by Configuration when reload fails. +   * Constructor.\n +   * @param filename The filename to be loaded.     */ -  class ConfigurationException: public Pentominos::Exception { -  public: -    ConfigurationException(std::string reason) :  -      Pentominos::Exception(reason) {} -  }; +  Configuration(std::string filename);    /** -   * This is the pentominos configuration class.\n -   * It simply wraps the libconfig c++ interface. It can be found at  -   * http://www.hyperrealm.com/libconfig/libconfig.html\n -   * To find out how the interface works, see -   * http://www.hyperrealm.com/libconfig/libconfig_manual.html#The-C_002b_002b-API +   * reload, simply reloads the configuration file attached to the configuration +   * object.     */ -  class Configuration : public libconfig::Config { -  public: -    /** -     * Constructor.\n -     * @param filename The filename to be loaded. -     */ -    Configuration(std::string filename); +  void reload() throw(ConfigurationException); -    /** -     * reload, simply reloads the configuration file attached to the configuration -     * object. -     */ -    void reload() throw(ConfigurationException); +private: +  std::string filename; +}; -  private: -    std::string filename; -  }; +/** + * Initialize the global configuration.\n + * This function sets the Configuration global pointer, that can be reaced through + * the config variable. + * @param config The value of the Configuration pointer. + */ +void initConfig(Configuration *config); -  /** -   * Initialize the global configuration.\n -   * This function sets the Configuration global pointer, that can be reaced through -   * the Pentominos::config variable. -   * @param config The value of the Configuration pointer. -   */ -  void initConfig(Configuration *config); +/** + * This function returns the global configuration object pointer.\n + * Use initConfig to set it.\n + * @return The pointer to the global configuration. + */ +Configuration *config() +  throw(ConfigurationException); -  /** -   * This function returns the global configuration object pointer.\n -   * Use Pentominos::initConfig to set it.\n -   * @return The pointer to the global configuration. -   */ -  Configuration *config() -    throw(ConfigurationException); -};  #endif/*__ARTEFACT_CONFIGURATION_H__*/ | 
