ARTS 2.5.11 (git: 6827797f)
exceptions.h
Go to the documentation of this file.
1
14#ifndef exceptions_h
15#define exceptions_h
16
17#include <stdexcept>
18
19#include "matpack_concepts.h"
20#include "mystring.h"
21
22// Special stuff for the parser:
23
24class ParseError : public std::runtime_error {
25 public:
26 ParseError(const String& s = "", String f = "", Index l = 0, Index c = 0)
27 : runtime_error(s),
28 mFile(std::move(f)),
29 mLine(l),
30 mColumn(c) { /* Nothing to do here. */
31 }
32
33 [[nodiscard]] String file() const { return mFile; }
34 [[nodiscard]] Index line() const { return mLine; }
35 [[nodiscard]] Index column() const { return mColumn; }
36
37 private:
41 Index mLine;
43 Index mColumn;
44};
45
46class Eot : public ParseError {
47 public:
48 Eot(const String& s = "", const String& f = "", Index l = 0, Index c = 0)
49 : ParseError(s, f, l, c) { /* Nothing to do here. */
50 }
51};
52
53class UnexpectedChar : public ParseError {
54 public:
55 UnexpectedChar(const String& s = "",
56 const String& f = "",
57 Index l = 0,
58 Index c = 0)
59 : ParseError(s, f, l, c) { /* Nothing to do here. */
60 }
61};
62
64 public:
65 IllegalLinebreak(const String& s = "",
66 const String& f = "",
67 Index l = 0,
68 Index c = 0)
69 : ParseError(s, f, l, c) { /* Nothing to do here. */
70 }
71};
72
73class UnknownMethod : public ParseError {
74 public:
75 UnknownMethod(const String& s = "",
76 const String& f = "",
77 Index l = 0,
78 Index c = 0)
79 : ParseError(s, f, l, c) { /* Nothing to do here. */
80 }
81};
82
83class UnknownWsv : public ParseError {
84 public:
85 UnknownWsv(const String& s = "",
86 const String& f = "",
87 Index l = 0,
88 Index c = 0)
89 : ParseError(s, f, l, c) { /* Nothing to do here. */
90 }
91};
92
94 public:
95 WsvAlreadyExists(const String& s = "",
96 const String& f = "",
97 Index l = 0,
98 Index c = 0)
99 : ParseError(s, f, l, c) { /* Nothing to do here. */
100 }
101};
102
103class WrongWsvGroup : public ParseError {
104 public:
105 WrongWsvGroup(const String& s = "",
106 const String& f = "",
107 Index l = 0,
108 Index c = 0)
109 : ParseError(s, f, l, c) { /* Nothing to do here. */
110 }
111};
112
113#endif // exceptions_h
Definition: exceptions.h:46
Eot(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:48
IllegalLinebreak(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:65
ParseError(const String &s="", String f="", Index l=0, Index c=0)
Definition: exceptions.h:26
String file() const
Definition: exceptions.h:33
Index line() const
Definition: exceptions.h:34
String mFile
Filename associated with this part of the text.
Definition: exceptions.h:39
Index mColumn
Column where the error occured.
Definition: exceptions.h:43
Index mLine
Line where the error occured.
Definition: exceptions.h:41
Index column() const
Definition: exceptions.h:35
UnexpectedChar(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:55
UnknownMethod(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:75
UnknownWsv(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:85
WrongWsvGroup(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:105
WsvAlreadyExists(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:95
This file contains the definition of String, the ARTS string class.
Definition: mystring.h:246
#define c