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