The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
parser.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 by David White <[email protected]>
3  Copyright (C) 2005 - 2016 by Guillaume Melquiond <[email protected]>
4  Part of the Battle for Wesnoth Project http://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 #ifndef SERIALIZATION_PARSER_HPP_INCLUDED
19 #define SERIALIZATION_PARSER_HPP_INCLUDED
20 
21 #include "global.hpp"
22 #include "config.hpp"
23 #include "configr_assign.hpp"
24 
25 class abstract_validator;
26 // Read data in, clobbering existing data.
27 void read(config &cfg, std::istream &in,
28  abstract_validator * validator = nullptr); // Throws config::error
29 void read(config &cfg, const std::string &in,
30  abstract_validator * validator = nullptr); // Throws config::error
31 void read_gz(config &cfg, std::istream &in,
32  abstract_validator * validator = nullptr);
33 void read_bz2(config &cfg, std::istream &in,
34  abstract_validator * validator = nullptr);
35 
36 void write(std::ostream &out, configr_of const &cfg, unsigned int level=0);
37 void write_gz(std::ostream &out, configr_of const &cfg);
38 void write_bz2(std::ostream &out, configr_of const &cfg);
39 void write_key_val(std::ostream &out, const std::string &key, const config::attribute_value &value, unsigned level, 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);
42 
43 #endif
void read(config &cfg, std::istream &in, abstract_validator *validator=nullptr)
Definition: parser.cpp:400
void write_key_val(std::ostream &out, const std::string &key, const config::attribute_value &value, unsigned level, std::string &textdomain)
Definition: parser.cpp:558
void write_gz(std::ostream &out, configr_of const &cfg)
Definition: parser.cpp:639
GLint level
Definition: glew.h:1220
void write_open_child(std::ostream &out, const std::string &child, unsigned int level)
Definition: parser.cpp:565
Definitions for the interface to Wesnoth Markup Language (WML).
Variant for storing WML attributes.
Definition: config.hpp:223
GLuint in
Definition: glew.h:9261
Used in parsing config file.
Definition: validator.hpp:36
GLsizei const GLfloat * value
Definition: glew.h:1817
void write_bz2(std::ostream &out, configr_of const &cfg)
Definition: parser.cpp:644
void write(std::ostream &out, configr_of const &cfg, unsigned int level=0)
Definition: parser.cpp:621
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:460
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503
void write_close_child(std::ostream &out, const std::string &child, unsigned int level)
Definition: parser.cpp:570
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:454