61 virtual void open_tag(
const std::string& name,
const config& parent,
int start_line = 0,
const std::string& file =
"",
bool addition =
false)
override;
63 virtual void validate(
const config& cfg,
const std::string& name,
int start_line,
const std::string& file)
override;
79 typedef std::map<std::string, counter>
cnt_map;
156 template<
typename... T>
159 cache_.top()[&cfg].emplace_back(std::forward<T>(args)...);
175 virtual void open_tag(
const std::string& name,
const config& parent,
int start_line = 0,
const std::string& file =
"",
bool addition =
false)
override;
177 virtual void validate(
const config& cfg,
const std::string& name,
int start_line,
const std::string& file)
override;
181 reference(
const std::string& value,
const std::string& file,
int line,
const std::string& tag)
189 bool match(
const std::set<std::string>& with);
197 std::map<std::string, std::string>
links_;
202 static bool name_matches(
const std::string& pattern,
const std::string& name);
Used in parsing config file.
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
virtual void open_tag(const std::string &name, const config &parent, int start_line=0, const std::string &file="", bool addition=false) override
Is called when parser opens tag.
virtual void validate(const config &cfg, const std::string &name, int start_line, const std::string &file) override
Validates config.
virtual void close_tag() override
As far as parser is built on stack, some realizations can store stack too.
std::stack< std::string > tag_stack_
std::multimap< std::string, std::string > derivations_
std::vector< reference > referenced_tag_paths_
std::map< std::string, std::string > links_
bool tag_path_exists(const config &cfg, const reference &ref)
void print(message_info &message) override
void check_for_duplicates(const std::string &name, std::vector< std::string > &seen, const config &cfg, message_type type, const std::string &file, int line, const std::string &tag)
std::string current_path() const
std::vector< reference > referenced_types_
std::set< std::string > defined_tag_paths_
static bool name_matches(const std::string &pattern, const std::string &name)
std::set< std::string > defined_types_
virtual void validate_key(const config &cfg, const std::string &name, const config_attribute_value &value, int start_line, const std::string &file) override
Checks if key is allowed and if its value is valid What exactly is validated depends on validator rea...
Realization of serialization/validator.hpp abstract validator.
bool read_config_file(const std::string &filename)
Reads config from input.
void set_create_exceptions(bool value)
const std::vector< std::string > & get_errors() const
wml_type::map types_
Type validators.
wml_tag root_
Root of schema information.
std::vector< std::string > errors_
virtual void validate(const config &cfg, const std::string &name, int start_line, const std::string &file) override
Validates config.
schema_validator(const std::string &filename, bool validate_schema=false)
Initializes validator from file.
bool create_exceptions_
Controls the way to print errors.
wml_type::ptr find_type(const std::string &type) const
std::stack< message_map > cache_
Caches error messages.
std::map< const config *, message_list > message_map
void queue_message(const config &cfg, T &&... args)
cnt_stack counter_
Contains number of children.
virtual void validate_key(const config &cfg, const std::string &name, const config_attribute_value &value, int start_line, const std::string &file) override
Checks if key is allowed and if its value is valid What exactly is validated depends on validator rea...
std::stack< cnt_map > cnt_stack
And counter maps are organize in stack.
std::deque< message_info > message_list
virtual ~schema_validator()
bool config_read_
Shows, if validator is initialized with schema file.
virtual void close_tag() override
As far as parser is built on stack, some realizations can store stack too.
std::string active_tag_path() const
const wml_tag & active_tag() const
virtual void open_tag(const std::string &name, const config &parent, int start_line=0, const std::string &file="", bool addition=false) override
Is called when parser opens tag.
std::stack< const wml_tag * > stack_
std::map< std::string, counter > cnt_map
Counters are mapped by tag name.
virtual void print(message_info &)
bool have_active_tag() const
Stores information about tag.
std::map< std::string, ptr > map
std::shared_ptr< wml_type > ptr
void line(int from_x, int from_y, int to_x, int to_y)
Draw a line.
This file contains object "key", which is used to store information about keys while annotation parsi...
reference(const std::string &value, const std::string &file, int line, const std::string &tag)
bool match(const std::set< std::string > &with)
bool operator<(const reference &other) const
bool can_find(const wml_tag &root, const config &cfg)
message_info(message_type t, const std::string &file, int line=0, int n=0, const std::string &tag="", const std::string &key="", const std::string &value="", const std::string &expected="")
This file contains object "tag", which is used to store information about tags while annotation parsi...
This file contains object "type", which is used to store information about types while annotation par...
This file contains information about validation abstract level interface.