ARTS 2.5.9 (git: 825fa5f2)
exceptions.h
Go to the documentation of this file.
1/* Copyright (C) 2000-2012 Stefan Buehler <sbuehler@ltu.se>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
31#ifndef exceptions_h
32#define exceptions_h
33
34#include <stdexcept>
35
36#include "matpack.h"
37#include "mystring.h"
38
39// Special stuff for the parser:
40
41class ParseError : public std::runtime_error {
42 public:
43 ParseError(const String& s = "", String f = "", Index l = 0, Index c = 0)
44 : runtime_error(s),
45 mFile(std::move(f)),
46 mLine(l),
47 mColumn(c) { /* Nothing to do here. */
48 }
49
50 [[nodiscard]] String file() const { return mFile; }
51 [[nodiscard]] Index line() const { return mLine; }
52 [[nodiscard]] Index column() const { return mColumn; }
53
54 private:
61};
62
63class Eot : public ParseError {
64 public:
65 Eot(const String& s = "", const String& f = "", Index l = 0, Index c = 0)
66 : ParseError(s, f, l, c) { /* Nothing to do here. */
67 }
68};
69
70class UnexpectedChar : public ParseError {
71 public:
72 UnexpectedChar(const String& s = "",
73 const String& f = "",
74 Index l = 0,
75 Index c = 0)
76 : ParseError(s, f, l, c) { /* Nothing to do here. */
77 }
78};
79
81 public:
82 IllegalLinebreak(const String& s = "",
83 const String& f = "",
84 Index l = 0,
85 Index c = 0)
86 : ParseError(s, f, l, c) { /* Nothing to do here. */
87 }
88};
89
90class UnknownMethod : public ParseError {
91 public:
92 UnknownMethod(const String& s = "",
93 const String& f = "",
94 Index l = 0,
95 Index c = 0)
96 : ParseError(s, f, l, c) { /* Nothing to do here. */
97 }
98};
99
100class UnknownWsv : public ParseError {
101 public:
102 UnknownWsv(const String& s = "",
103 const String& f = "",
104 Index l = 0,
105 Index c = 0)
106 : ParseError(s, f, l, c) { /* Nothing to do here. */
107 }
108};
109
111 public:
113 const String& f = "",
114 Index l = 0,
115 Index c = 0)
116 : ParseError(s, f, l, c) { /* Nothing to do here. */
117 }
118};
119
120class WrongWsvGroup : public ParseError {
121 public:
122 WrongWsvGroup(const String& s = "",
123 const String& f = "",
124 Index l = 0,
125 Index c = 0)
126 : ParseError(s, f, l, c) { /* Nothing to do here. */
127 }
128};
129
130#endif // exceptions_h
Definition: exceptions.h:63
Eot(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:65
IllegalLinebreak(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:82
ParseError(const String &s="", String f="", Index l=0, Index c=0)
Definition: exceptions.h:43
String file() const
Definition: exceptions.h:50
Index line() const
Definition: exceptions.h:51
String mFile
Filename associated with this part of the text.
Definition: exceptions.h:56
Index mColumn
Column where the error occured.
Definition: exceptions.h:60
Index mLine
Line where the error occured.
Definition: exceptions.h:58
Index column() const
Definition: exceptions.h:52
UnexpectedChar(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:72
UnknownMethod(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:92
UnknownWsv(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:102
WrongWsvGroup(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:122
WsvAlreadyExists(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:112
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
This file contains the definition of String, the ARTS string class.
#define c