The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
wml_error.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2014 - 2025
3 by Iris Morelle <shadowm2006@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#pragma once
17
19
20namespace gui2::dialogs
21{
22
23class wml_error : public modal_dialog
24{
25public:
26 /**
27 * Constructor.
28 *
29 * @param summary Leading summary line for the report.
30 * @param post_summary Additional line with instructions for the user, may
31 * be empty.
32 * @param files List of WML files on which errors were detected.
33 * @param details Detailed WML preprocessor/parser error report.
34 */
35 wml_error(const std::string& summary,
36 const std::string& post_summary,
37 const std::vector<std::string>& files,
38 const std::string& details);
39
40 /** The display function; see @ref modal_dialog for more information. */
41 static void display(const std::string& summary,
42 const std::string& post_summary,
43 const std::vector<std::string>& files,
44 const std::string& details)
45 {
46 wml_error(summary, post_summary, files, details).show();
47 }
48
49 /** The display function; see @ref modal_dialog for more information. */
50 static void display(const std::string& summary,
51 const std::string& details)
52 {
53 display(summary, "", std::vector<std::string>(), details);
54 }
55
56private:
59 std::string report_; // Plain text report for copying to clipboard.
60
61 virtual const std::string& window_id() const override;
62
63 virtual void pre_show() override;
64
66};
67
68} // end namespace dialogs
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition display.hpp:88
Abstract base class for all modal dialogs.
bool show(const unsigned auto_close_time=0)
Shows the window.
virtual void pre_show() override
Actions to be taken before showing the window.
static void display(const std::string &summary, const std::string &post_summary, const std::vector< std::string > &files, const std::string &details)
The display function; see modal_dialog for more information.
Definition wml_error.hpp:41
virtual const std::string & window_id() const override
The ID of the window to build.
static void display(const std::string &summary, const std::string &details)
The display function; see modal_dialog for more information.
Definition wml_error.hpp:50