ARTS  2.2.66
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  virtual ~ParseError() throw() {}
52 
53  virtual String file() const { return mFile; }
54  virtual Index line() const { return mLine; }
55  virtual Index column() const { return mColumn; }
56 
57 private:
64 };
65 
66 
67 class Eot : public ParseError {
68 public:
69  Eot( const String& s="",
70  const String& f="",
71  Index l = 0,
72  Index c = 0 ) :
73  ParseError(s,f,l,c) { /* Nothing to do here. */ }
74 };
75 
76 class UnexpectedChar : public ParseError {
77 public:
78  UnexpectedChar( const String& s="",
79  const String& f="",
80  Index l = 0,
81  Index c = 0 ) :
82  ParseError(s,f,l,c) { /* Nothing to do here. */ }
83 };
84 
85 class IllegalLinebreak : public ParseError {
86 public:
87  IllegalLinebreak( const String& s="",
88  const String& f="",
89  Index l = 0,
90  Index c = 0 ) :
91  ParseError(s,f,l,c) { /* Nothing to do here. */ }
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 class UnknownWsv : public ParseError {
104 public:
105  UnknownWsv( 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 class WsvAlreadyExists : public ParseError {
113 public:
114  WsvAlreadyExists( const String& s="",
115  const String& f="",
116  Index l = 0,
117  Index c = 0 ) :
118  ParseError(s,f,l,c) { /* Nothing to do here. */ }
119 };
120 
121 class WrongWsvGroup : public ParseError {
122 public:
123  WrongWsvGroup( const String& s="",
124  const String& f="",
125  Index l = 0,
126  Index c = 0 ) :
127  ParseError(s,f,l,c) { /* Nothing to do here. */ }
128 };
129 
130 
131 #endif // exceptions_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
virtual Index line() const
Definition: exceptions.h:54
Index mLine
Line where the error occured.
Definition: exceptions.h:61
virtual ~ParseError()
Definition: exceptions.h:51
WrongWsvGroup(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:123
virtual String file() const
Definition: exceptions.h:53
Index mColumn
Column where the error occured.
Definition: exceptions.h:63
String mFile
Filename associated with this part of the text.
Definition: exceptions.h:59
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:105
UnexpectedChar(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:78
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:114
virtual Index column() const
Definition: exceptions.h:55
IllegalLinebreak(const String &s="", const String &f="", Index l=0, Index c=0)
Definition: exceptions.h:87
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.