Classes | Public Member Functions

abstract_validator Class Reference

Used in parsing config file. More...

#include <validator.hpp>

Inheritance diagram for abstract_validator:
Inheritance graph
[legend]

List of all members.

Classes

struct  error
 Used to manage with not initialized validators Supposed to be thrown from the constructor. More...

Public Member Functions

 abstract_validator ()
 Constructor of validator can throw validator::error.
virtual ~abstract_validator ()
virtual void open_tag (const std::string &name, int start_line, const std::string &file, bool addittion=false)=0
 Is called when parser opens tag.
virtual void close_tag ()=0
 As far as parser is built on stack, some realizations can store stack too.
virtual void validate (const config &cfg, const std::string &name, int start_line, const std::string &file)=0
 Validates config.
virtual void validate_key (const config &cfg, const std::string &name, const std::string &value, int start_line, const std::string &file)=0
 Checks if key is allowed and if its value is valid What exactly is validated depends on validator realization.

Detailed Description

Used in parsing config file.

parser.cpp Contains virtual methods, which are called by parser and take information about config to be validated

Definition at line 37 of file validator.hpp.


Constructor & Destructor Documentation

abstract_validator::abstract_validator (  )  [inline]

Constructor of validator can throw validator::error.

Exceptions:
abstract_validator::error 

Definition at line 44 of file validator.hpp.

virtual abstract_validator::~abstract_validator (  )  [inline, virtual]

Definition at line 46 of file validator.hpp.


Member Function Documentation

virtual void abstract_validator::close_tag (  )  [pure virtual]

As far as parser is built on stack, some realizations can store stack too.

So they need to know if tag was closed.

Implemented in schema_validation::schema_validator.

virtual void abstract_validator::open_tag ( const std::string &  name,
int  start_line,
const std::string &  file,
bool  addittion = false 
) [pure virtual]

Is called when parser opens tag.

Parameters:
name Name of tag
start_line Line in file
file Name of file

Implemented in schema_validation::schema_validator.

virtual void abstract_validator::validate ( const config cfg,
const std::string &  name,
int  start_line,
const std::string &  file 
) [pure virtual]

Validates config.

Checks if all mandatory elements are present. What exactly is validated depends on validator realization

Parameters:
cfg Config to be validated.
name Name of tag
start_line Line in file
file Name of file

Implemented in schema_validation::schema_validator.

virtual void abstract_validator::validate_key ( const config cfg,
const std::string &  name,
const std::string &  value,
int  start_line,
const std::string &  file 
) [pure virtual]

Checks if key is allowed and if its value is valid What exactly is validated depends on validator realization.

Parameters:
cfg Config to be validated.
name Name of tag
start_line Line in file
file Name of file

Implemented in schema_validation::schema_validator.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:12:33 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs