ARTS  2.3.1285(git:92a29ea9-dirty)
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 #include "matpack.h"
36 #include "mystring.h"
37 
38 // Special stuff for the parser:
39 
40 class ParseError : public std::runtime_error {
41  public:
42  ParseError(const String& s = "",
43  const String& f = "",
44  Index l = 0,
45  Index c = 0)
46  : runtime_error(s),
47  mFile(f),
48  mLine(l),
49  mColumn(c) { /* Nothing to do here. */
50  }
51 
52  virtual ~ParseError() throw() {}
53 
54  virtual String file() const { return mFile; }
55  virtual Index line() const { return mLine; }
56  virtual Index column() const { return mColumn; }
57 
58  private:
65 };
66 
67 class Eot : public ParseError {
68  public:
69  Eot(const String& s = "", const String& f = "", Index l = 0, Index c = 0)
70  : ParseError(s, f, l, c) { /* Nothing to do here. */
71  }
72 };
73 
74 class UnexpectedChar : public ParseError {
75  public:
76  UnexpectedChar(const String& s = "",
77  const String& f = "",
78  Index l = 0,
79  Index c = 0)
80  : ParseError(s, f, l, c) { /* Nothing to do here. */
81  }
82 };
83 
84 class IllegalLinebreak : public ParseError {
85  public:
86  IllegalLinebreak(const String& s = "",
87  const String& f = "",
88  Index l = 0,
89  Index c = 0)
90  : ParseError(s, f, l, c) { /* Nothing to do here. */
91  }
92 };
93 
94 class UnknownMethod : public ParseError {
95  public:
96  UnknownMethod(const String& s = "",
97  const String& f = "",
98  Index l = 0,
99  Index c = 0)
100  : ParseError(s, f, l, c) { /* Nothing to do here. */
101  }
102 };
103 
104 class UnknownWsv : public ParseError {
105  public:
106  UnknownWsv(const String& s = "",
107  const String& f = "",
108  Index l = 0,
109  Index c = 0)
110  : ParseError(s, f, l, c) { /* Nothing to do here. */
111  }
112 };
113 
114 class WsvAlreadyExists : public ParseError {
115  public:
116  WsvAlreadyExists(const String& s = "",
117  const String& f = "",
118  Index l = 0,
119  Index c = 0)
120  : ParseError(s, f, l, c) { /* Nothing to do here. */
121  }
122 };
123 
124 class WrongWsvGroup : public ParseError {
125  public:
126  WrongWsvGroup(const String& s = "",
127  const String& f = "",
128  Index l = 0,
129  Index c = 0)
130  : ParseError(s, f, l, c) { /* Nothing to do here. */
131  }
132 };
133 
134 #endif // exceptions_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
virtual Index line() const
Definition: exceptions.h:55
Index mLine
Line where the error occured.
Definition: exceptions.h:62
virtual ~ParseError()
Definition: exceptions.h:52
WrongWsvGroup(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:126
virtual String file() const
Definition: exceptions.h:54
Index mColumn
Column where the error occured.
Definition: exceptions.h:64
String mFile
Filename associated with this part of the text.
Definition: exceptions.h:60
Eot(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:69
UnknownWsv(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:106
UnexpectedChar(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:76
Definition: exceptions.h:67
ParseError(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:42
WsvAlreadyExists(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:116
virtual Index column() const
Definition: exceptions.h:56
IllegalLinebreak(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:86
UnknownMethod(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:96
This file contains the definition of String, the ARTS string class.