The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
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
25
26namespace io
27{
28config read(std::istream& in, abstract_validator* validator = nullptr); // Throws config::error
29config read(const std::string& in, abstract_validator* validator = nullptr); // Throws config::error
30config read_gz(std::istream& in, abstract_validator* validator = nullptr);
31config read_bz2(std::istream& in, abstract_validator* validator = nullptr);
32
33void write(std::ostream& out, const configr_of& cfg, unsigned int level = 0, bool strong_quotes = false);
34void write_gz(std::ostream& out, const configr_of& cfg);
35void write_bz2(std::ostream& out, const configr_of& cfg);
36void write_key_val(std::ostream& out,
37 const std::string& key,
39 unsigned level,
40 std::string& textdomain,
41 bool strong_quotes);
42void write_open_child(std::ostream& out, const std::string& child, unsigned int level);
43void 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.
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
std::unique_ptr< MIX_Audio, decltype(&MIX_DestroyAudio)> value
Definition sound.cpp:139