The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
schema_validation::class_error_container Class Reference

Container of errors, which are generated while schema generator tool is parsing source files. More...

#include <error_container.hpp>

Classes

struct  error_cache_element
 Container to cache type errors. More...
 

Public Member Functions

 class_error_container ()
 
void add_simple_error (const std::string &message)
 Puts simple error message in container. More...
 
void add_read_error (const std::string &file, int line)
 Generate and put GCC-style error message about error read file error. More...
 
void add_opened_entity_error (const std::string &file, int line, const std::string &name)
 Generate and put GCC-style error message about annotation block somebody missed to close. More...
 
void add_unopened_entity_error (const std::string &file, int line, const std::string &name)
 Generate and put GCC-style error message about closing block that wasn't opened. More...
 
void add_second_parent_error (const std::string &file, int line, const std::string &first, const std::string &second)
 Generate and put GCC-style error message about opening parent block before before closing previous block. More...
 
void add_orphan_error (const std::string &file, int line, const std::string &name)
 Generate and put GCC-style error message about tag without parent. More...
 
void wrong_type_error (const std::string &file, int line, const std::string &name, const std::string &value)
 Generate and put GCC-style error message about wrong type value. More...
 
void add_type_error (const std::string &file, int line, const std::string &type)
 Generate and put GCC-style error message about unknown type to type cache. More...
 
void remove_type_errors (const std::string &type)
 Clears type cache. More...
 
void overriding_type_error (const std::string &file, int line, const std::string &type)
 Generate and put GCC-style error message about overriding type Overriding means that that type was defined somewhere else, and it's old value is lost. More...
 
void add_link_error (const std::string &file, int line, const std::string &link)
 Generate and put GCC-style error message about failed link to link cache. More...
 
void remove_link_errors (const std::string &link)
 Clears link cache. More...
 
void print_errors (std::ostream &s) const
 Prints errors to output stream. More...
 
bool is_empty () const
 Checks, if container is empty. More...
 

Private Types

typedef std::map< std::string,
std::vector
< error_cache_element > > 
error_cache_map
 

Private Attributes

std::vector< std::stringlist_
 Container to store error messages. More...
 
error_cache_map types_
 
error_cache_map links_
 

Detailed Description

Container of errors, which are generated while schema generator tool is parsing source files.

These errors are collected here, to be print on screen after parsing.

Definition at line 37 of file error_container.hpp.

Member Typedef Documentation

Definition at line 174 of file error_container.hpp.

Constructor & Destructor Documentation

schema_validation::class_error_container::class_error_container ( )
inline

Definition at line 39 of file error_container.hpp.

Member Function Documentation

void schema_validation::class_error_container::add_link_error ( const std::string file,
int  line,
const std::string link 
)

Generate and put GCC-style error message about failed link to link cache.

Parameters
fileFilename
lineNumber of line with error
linkName of link

Definition at line 89 of file error_container.cpp.

References links_.

Referenced by schema_validation::class_source_parser::check_allow_link(), and schema_validation::class_source_parser::check_tag_begin().

void schema_validation::class_error_container::add_opened_entity_error ( const std::string file,
int  line,
const std::string name 
)

Generate and put GCC-style error message about annotation block somebody missed to close.

Parameters
fileFilename
lineNumber of line with error
nameName of open block

Definition at line 34 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::add_open_tag_error(), and schema_validation::class_source_parser::parse_keys().

void schema_validation::class_error_container::add_orphan_error ( const std::string file,
int  line,
const std::string name 
)

Generate and put GCC-style error message about tag without parent.

Parameters
fileFilename
lineNumber with error
nameName of tag

Definition at line 59 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::close_opened_tags().

void schema_validation::class_error_container::add_read_error ( const std::string file,
int  line 
)

Generate and put GCC-style error message about error read file error.

Parameters
fileFilename
lineNumber of line with error

Definition at line 28 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::getline().

void schema_validation::class_error_container::add_second_parent_error ( const std::string file,
int  line,
const std::string first,
const std::string second 
)

Generate and put GCC-style error message about opening parent block before before closing previous block.

Parameters
fileFilename
lineNumber with error
firstName of open parent
secondName of parent is opening

Definition at line 50 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::check_parent_begin().

void schema_validation::class_error_container::add_simple_error ( const std::string message)

Puts simple error message in container.

Parameters
messageMessage to print.

Definition at line 24 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::parse_source(), and schema_validation::class_source_parser::save_schema().

void schema_validation::class_error_container::add_type_error ( const std::string file,
int  line,
const std::string type 
)

Generate and put GCC-style error message about unknown type to type cache.

Parameters
fileFilename
lineNumber with error
typeName of type

Definition at line 74 of file error_container.cpp.

References types_.

Referenced by schema_validation::class_source_parser::parse_keys().

void schema_validation::class_error_container::add_unopened_entity_error ( const std::string file,
int  line,
const std::string name 
)

Generate and put GCC-style error message about closing block that wasn't opened.

Parameters
fileFilename
lineNumber of line with error
nameof block

Definition at line 42 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::check_parent_end(), and schema_validation::class_source_parser::check_tag_end().

bool schema_validation::class_error_container::is_empty ( ) const
inline

Checks, if container is empty.

Definition at line 151 of file error_container.hpp.

References links_, list_, and types_.

Referenced by main().

void schema_validation::class_error_container::overriding_type_error ( const std::string file,
int  line,
const std::string type 
)

Generate and put GCC-style error message about overriding type Overriding means that that type was defined somewhere else, and it's old value is lost.

Parameters
fileFilename
lineNumber of line with error
typeName of type

Definition at line 82 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::check_allow_type().

void schema_validation::class_error_container::print_errors ( std::ostream &  s) const

Prints errors to output stream.

Parameters
sOutput

Definition at line 99 of file error_container.cpp.

References i, links_, list_, and types_.

Referenced by main().

void schema_validation::class_error_container::remove_link_errors ( const std::string link)

Clears link cache.

Parameters
linkName of link

Definition at line 94 of file error_container.cpp.

References links_.

Referenced by schema_validation::class_source_parser::close_opened_tags().

void schema_validation::class_error_container::remove_type_errors ( const std::string type)

Clears type cache.

Parameters
typeName of type

Definition at line 79 of file error_container.cpp.

References types_.

Referenced by schema_validation::class_source_parser::check_allow_type(), and schema_validation::class_source_parser::check_remove_type().

void schema_validation::class_error_container::wrong_type_error ( const std::string file,
int  line,
const std::string name,
const std::string value 
)

Generate and put GCC-style error message about wrong type value.

Parameters
fileFilename
lineNumber with error
nameName of type
valueName of value

Definition at line 65 of file error_container.cpp.

References list_.

Referenced by schema_validation::class_source_parser::check_allow_type().

Member Data Documentation

error_cache_map schema_validation::class_error_container::links_
private

Definition at line 176 of file error_container.hpp.

Referenced by add_link_error(), is_empty(), print_errors(), and remove_link_errors().

std::vector<std::string> schema_validation::class_error_container::list_
private
error_cache_map schema_validation::class_error_container::types_
private

Definition at line 175 of file error_container.hpp.

Referenced by add_type_error(), is_empty(), print_errors(), and remove_type_errors().


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