Commit 98cb1b73 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

rest of doxygen for DataDefinition class

git-svn-id: svn:// e5f2f494-b856-4b98-b285-d166d9295462
parent 13b30757
......@@ -121,8 +121,8 @@ check_command_list(const ElementPtr& spec) {
static void
check_data_specification(const ElementPtr& spec) {
check_leaf_item(spec, "module_name", Element::string, true);
// not mandatory; module could just define commands and have
// no config
// config_data is not mandatory; module could just define
// commands and have no config
if (spec->contains("config_data")) {
......@@ -140,7 +140,7 @@ check_definition(const ElementPtr& def)
throw DataDefinitionError("Data specification does not contain data_specification element");
} else {
DataDefinition::DataDefinition(std::istream& in, const bool check)
......@@ -9,7 +9,7 @@ namespace isc { namespace data {
/// A standard DataDefinition exception that is thrown when a
/// .spec file could not be parsed.
/// specification is not in the correct form.
/// TODO: use jinmei's exception class as a base and not c_str in
/// what() there
......@@ -29,6 +29,9 @@ namespace isc { namespace data {
/// This class holds that specification, and provides a function to
/// validate a set of data, to see whether it conforms to the given
/// specification
/// The form of the specification is described in doc/ (TODO)
class DataDefinition {
explicit DataDefinition() {};
......@@ -37,12 +40,26 @@ namespace isc { namespace data {
/// \param e The Element containing the data specification
explicit DataDefinition(ElementPtr e) : definition(e) {};
// todo: make check default false, or leave out option completely and always check?
/// Creates a \c DataDefinition instance from the given .spec
/// file stream. If check is true, and the definition is not of
/// the correct form, a DataDefinitionError is thrown. If the
/// file could not be parsed, a ParseError is thrown.
/// \param in The std::istream containing the .spec file data
/// \param check If true, the data definition is checked to be
/// of the correct form
explicit DataDefinition(std::istream& in, const bool check = true)
throw(ParseError, DataDefinitionError);
/// Returns the base \c element of the data definition contained
/// by this instance
/// \return ElementPtr Shared pointer to the data definition
const ElementPtr getDefinition() { return definition; };
// returns true if the given element conforms to this data
// definition scheme
/// Validates the given data for this specification.
/// \param data The base \c Element of the data to check
/// \return true if the data conforms to the specification,
/// false otherwise.
bool validate(const ElementPtr data);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment