odsstream
odsexception.h
1 /*
2  libodsstream is a library to read and write ODS documents as streams
3  Copyright (C) 2013 Olivier Langella <Olivier.Langella@moulon.inra.fr>
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #pragma once
21 
22 #include <QException>
23 #include <QDebug>
24 
25 class OdsException : public QException
26 {
27  public:
28  OdsException(const QString &message) throw()
29  {
30  qDebug() << message;
31  m_message = message;
32  }
33 
34  OdsException(const OdsException &other) throw()
35  {
36  m_message = other.m_message;
37  }
38  void
39  raise() const override
40  {
41  throw *this;
42  }
43  virtual QException *
44  clone() const override
45  {
46  return new OdsException(*this);
47  }
48 
49  virtual const QString &
50  qwhat() const throw()
51  {
52  return m_message;
53  }
54 
55  virtual const char *
56  what() const throw() override
57  {
58  return m_message.toStdString().c_str();
59  }
60 
61  virtual ~OdsException() throw()
62  {
63  }
64 
65  private:
66  QString m_message; // Description of the error
67 };
OdsException
Definition: odsexception.h:25