The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | List of all members
abstract_validator Class Referenceabstract

Used in parsing config file. More...

#include <validator.hpp>

Inheritance diagram for abstract_validator:
Inheritance graph

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. More...
 
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. More...
 
virtual void close_tag ()=0
 As far as parser is built on stack, some realizations can store stack too. More...
 
virtual void validate (const config &cfg, const std::string &name, int start_line, const std::string &file)=0
 Validates config. More...
 
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. More...
 

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 35 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 42 of file validator.hpp.

virtual abstract_validator::~abstract_validator ( )
inlinevirtual

Definition at line 44 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
nameName of tag
start_lineLine in file
fileName 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
cfgConfig to be validated.
nameName of tag
start_lineLine in file
fileName 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
cfgConfig to be validated.
nameName of tag
start_lineLine in file
fileName of file

Implemented in schema_validation::schema_validator.


The documentation for this class was generated from the following file: