123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #ifndef _MODULE_SPEC_H
- #define _MODULE_SPEC_H 1
- #include <cc/data.h>
- #include <sstream>
- using namespace isc::data;
- namespace isc { namespace config {
-
-
-
-
-
-
- class ModuleSpecError : public std::exception {
- public:
- ModuleSpecError(std::string m = "Module specification is invalid") : msg(m) {}
- ~ModuleSpecError() throw() {}
- const char* what() const throw() { return msg.c_str(); }
- private:
- std::string msg;
- };
-
-
-
-
-
-
-
-
-
-
- class ModuleSpec {
- public:
- explicit ModuleSpec() {};
-
-
-
- explicit ModuleSpec(ElementPtr e, const bool check = true)
- throw(ModuleSpecError);
-
-
-
-
- const ElementPtr getCommandsSpec();
-
-
-
-
- const ElementPtr getConfigSpec();
-
-
- const ElementPtr getFullSpec() { return module_specification; };
-
- const std::string getModuleName();
-
-
-
-
-
-
-
- bool validate_config(const ElementPtr data, const bool full = false);
-
- bool validate_config(const ElementPtr data, const bool full, ElementPtr errors);
- private:
- bool validate_item(const ElementPtr spec, const ElementPtr data, const bool full, ElementPtr errors);
- bool validate_spec(const ElementPtr spec, const ElementPtr data, const bool full, ElementPtr errors);
- bool validate_spec_list(const ElementPtr spec, const ElementPtr data, const bool full, ElementPtr errors);
- ElementPtr module_specification;
- };
-
-
-
-
-
-
-
-
- ModuleSpec
- moduleSpecFromFile(const std::string& file_name, const bool check = true)
- throw(ParseError, ModuleSpecError);
-
-
-
-
-
-
-
-
- ModuleSpec
- moduleSpecFromFile(std::ifstream& in, const bool check = true)
- throw(ParseError, ModuleSpecError);
- } }
- #endif
|