The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
wml_error.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by Ignacio R. Morelle <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef GUI_DIALOGS_WML_ERROR_HPP_INCLUDED
16 #define GUI_DIALOGS_WML_ERROR_HPP_INCLUDED
17 
18 #include "gui/dialogs/dialog.hpp"
19 
20 namespace gui2
21 {
22 
23 /** WML preprocessor/parser error report dialog. */
24 class twml_error : public tdialog
25 {
26 public:
27  /**
28  * Constructor.
29  *
30  * @param summary Leading summary line for the report.
31  * @param post_summary Additional line with instructions for the user, may
32  * be empty.
33  * @param files List of WML files on which errors were detected.
34  * @param details Detailed WML preprocessor/parser error report.
35  */
36  twml_error(const std::string& summary,
37  const std::string& post_summary,
38  const std::vector<std::string>& files,
39  const std::string& details);
40 
41  /** The display function; see @ref tdialog for more information. */
42  static void display(const std::string& summary,
43  const std::string& post_summary,
44  const std::vector<std::string>& files,
45  const std::string& details,
46  CVideo& video)
47  {
48  twml_error(summary, post_summary, files, details).show(video);
49  }
50 
51  /** The display function; see @ref tdialog for more information. */
52  static void display(const std::string& summary,
53  const std::string& details,
54  CVideo& video)
55  {
56  display(summary, "", std::vector<std::string>(), details, video);
57  }
58 
59 private:
62  std::string report_; // Plain text report for copying to clipboard.
63 
64  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
65  virtual const std::string& window_id() const;
66 
67  /** Inherited from tdialog. */
68  void pre_show(twindow& window);
69 
70  void copy_report_callback();
71 };
72 
73 } // end namespace gui2
74 
75 #endif
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
static void display(const std::string &summary, const std::string &post_summary, const std::vector< std::string > &files, const std::string &details, CVideo &video)
The display function; see tdialog for more information.
Definition: wml_error.hpp:42
void pre_show(twindow &window)
Inherited from tdialog.
Definition: wml_error.cpp:206
Definition: video.hpp:58
bool have_post_summary_
Definition: wml_error.hpp:61
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
WML preprocessor/parser error report dialog.
Definition: wml_error.hpp:24
Abstract base class for all dialogs.
Definition: dialog.hpp:121
void copy_report_callback()
Definition: wml_error.cpp:230
twml_error(const std::string &summary, const std::string &post_summary, const std::vector< std::string > &files, const std::string &details)
Constructor.
Definition: wml_error.cpp:171
static void display(const std::string &summary, const std::string &details, CVideo &video)
The display function; see tdialog for more information.
Definition: wml_error.hpp:52
GLsizei const GLcharARB ** string
Definition: glew.h:4503
std::string report_
Definition: wml_error.hpp:62