The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
exception.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2017 by Mark de Wever <koraq@xs4all.nl>
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 /**
16  * @file
17  * Contains the exceptions thrown by the @ref gui2::iteration::iterator classes.
18  */
19 
20 #pragma once
21 
23 
24 #include <stdexcept>
25 #include <string>
26 
27 namespace gui2
28 {
29 
30 namespace iteration
31 {
32 
33 /**
34  * Thrown when deferring an invalid iterator.
35  *
36  * Invalid means the initial state at_end() == true.
37  */
38 class logic_error : public std::logic_error, public lua_jailbreak_exception
39 {
40 public:
41  explicit logic_error(const std::string& message)
42  : std::logic_error("GUI2 ITERATOR: " + message)
44  {
45  }
46 
47 private:
49 };
50 
51 /**
52  * Thrown when moving an invalid iterator.
53  *
54  * Invalid means the initial state at_end() == true.
55  */
56 class range_error : public std::range_error, public lua_jailbreak_exception
57 {
58 public:
59  explicit range_error(const std::string& message)
60  : std::range_error("GUI2 ITERATOR: " + message)
62  {
63  }
64 
65 private:
67 };
68 
69 } // namespace iteration
70 
71 } // namespace gui2
std::vector< char_t > string
#define IMPLEMENT_LUA_JAILBREAK_EXCEPTION(type)
Helper macro for classes deriving from lua_jailbreak_exception.
Main class to show messages to the user.
Definition: message.hpp:34
STL namespace.
range_error(const std::string &message)
Definition: exception.hpp:59
Generic file dialog.
Definition: field-fwd.hpp:22
Thrown when moving an invalid iterator.
Definition: exception.hpp:56
Thrown when deferring an invalid iterator.
Definition: exception.hpp:38
Base class for exceptions that want to be thrown 'through' lua.
logic_error(const std::string &message)
Definition: exception.hpp:41