The Battle for Wesnoth  1.19.20+dev
parser.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2025
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 namespace io
27 {
28 config read(std::istream& in, abstract_validator* validator = nullptr); // Throws config::error
29 config read(const std::string& in, abstract_validator* validator = nullptr); // Throws config::error
30 config read_gz(std::istream& in, abstract_validator* validator = nullptr);
31 config read_bz2(std::istream& in, abstract_validator* validator = nullptr);
32 
33 void write(std::ostream& out, const configr_of& cfg, unsigned int level = 0, bool strong_quotes = false);
34 void write_gz(std::ostream& out, const configr_of& cfg);
35 void write_bz2(std::ostream& out, const configr_of& cfg);
36 void write_key_val(std::ostream& out,
37  const std::string& key,
38  const config::attribute_value& value,
39  unsigned level,
40  std::string& textdomain,
41  bool strong_quotes);
42 void write_open_child(std::ostream& out, const std::string& child, unsigned int level);
43 void write_close_child(std::ostream& out, const std::string& child, unsigned int level);
44 
45 } // namespace io
unsigned in
If equal to search_counter, the node is off the list.
Definition: astarsearch.cpp:70
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:157
Definitions for the interface to Wesnoth Markup Language (WML).
const config * cfg
Definition: parser.cpp:60
config read(std::istream &in, abstract_validator *validator)
Definition: parser.cpp:610
void write_open_child(std::ostream &out, const std::string &child, unsigned int level)
Definition: parser.cpp:687
void write(std::ostream &out, const configr_of &cfg, unsigned int level, bool strong_quotes)
Definition: parser.cpp:748
void write_close_child(std::ostream &out, const std::string &child, unsigned int level)
Definition: parser.cpp:692
config read_bz2(std::istream &file, abstract_validator *validator)
Might throw a std::ios_base::failure especially bzip2_error.
Definition: parser.cpp:672
void write_bz2(std::ostream &out, const configr_of &cfg)
Definition: parser.cpp:772
config read_gz(std::istream &file, abstract_validator *validator)
Might throw a std::ios_base::failure especially a gzip_error.
Definition: parser.cpp:666
void write_gz(std::ostream &out, const configr_of &cfg)
Definition: parser.cpp:767
void write_key_val(std::ostream &out, const std::string &key, const config::attribute_value &value, unsigned level, std::string &textdomain, bool strong_quotes)
Definition: parser.cpp:677