The Battle for Wesnoth  1.19.7+dev
parser.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2024
3  by Philippe Plantier <ayin@anathas.org>
4  Copyright (C) 2005 by Guillaume Melquiond <guillaume.melquiond@gmail.com>
5  Copyright (C) 2003 by David White <dave@whitevine.net>
6  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY.
14 
15  See the COPYING file for more details.
16 */
17 
18 #pragma once
19 
20 #include "config.hpp"
21 #include "configr_assign.hpp"
23 
24 class abstract_validator;
25 
26 // Read data in, clobbering existing data.
27 void read(config& cfg, std::istream& in, abstract_validator* validator = nullptr); // Throws config::error
28 void read(config& cfg, const std::string& in, abstract_validator* validator = nullptr); // Throws config::error
29 void read_gz(config& cfg, std::istream& in, abstract_validator* validator = nullptr);
30 void read_bz2(config& cfg, std::istream& in, abstract_validator* validator = nullptr);
31 
32 void write(std::ostream& out, const configr_of& cfg, unsigned int level = 0);
33 void write_gz(std::ostream& out, const configr_of& cfg);
34 void write_bz2(std::ostream& out, const configr_of& cfg);
35 void write_key_val(std::ostream& out,
36  const std::string& key,
37  const config::attribute_value& value,
38  unsigned level,
39  std::string& textdomain);
40 void write_open_child(std::ostream& out, const std::string& child, unsigned int level);
41 void write_close_child(std::ostream& out, const std::string& child, unsigned int level);
Used in parsing config file.
Definition: validator.hpp:38
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:172
Definitions for the interface to Wesnoth Markup Language (WML).
unsigned in
If equal to search_counter, the node is off the list.
void write_gz(std::ostream &out, const configr_of &cfg)
Definition: parser.cpp:785
void read(config &cfg, std::istream &in, abstract_validator *validator=nullptr)
Definition: parser.cpp:629
void read_bz2(config &cfg, std::istream &in, abstract_validator *validator=nullptr)
Might throw a std::ios_base::failure especially bzip2_error.
Definition: parser.cpp:691
void write_close_child(std::ostream &out, const std::string &child, unsigned int level)
Definition: parser.cpp:710
void write(std::ostream &out, const configr_of &cfg, unsigned int level=0)
Definition: parser.cpp:766
void read_gz(config &cfg, std::istream &in, abstract_validator *validator=nullptr)
Might throw a std::ios_base::failure especially a gzip_error.
Definition: parser.cpp:685
void write_key_val(std::ostream &out, const std::string &key, const config::attribute_value &value, unsigned level, std::string &textdomain)
Definition: parser.cpp:696
void write_bz2(std::ostream &out, const configr_of &cfg)
Definition: parser.cpp:790
void write_open_child(std::ostream &out, const std::string &child, unsigned int level)
Definition: parser.cpp:705