libquentier  0.4.0
The library for rich desktop clients of Evernote service
ErrorString.h
1 /*
2  * Copyright 2017 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier 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 libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_TYPES_ERROR_STRING_H
20 #define LIB_QUENTIER_TYPES_ERROR_STRING_H
21 
22 #include <quentier/utility/Printable.h>
23 #include <QSharedDataPointer>
24 
25 namespace quentier {
26 
27 QT_FORWARD_DECLARE_CLASS(ErrorStringData)
28 
29 
38 class QUENTIER_EXPORT ErrorString: public Printable
39 {
40 public:
41  explicit ErrorString(const char * error = Q_NULLPTR);
42  explicit ErrorString(const QString & error);
43  ErrorString(const ErrorString & other);
44  ErrorString & operator=(const ErrorString & other);
45  virtual ~ErrorString();
46 
47  const QString & base() const;
48  QString & base();
49 
50  const QStringList & additionalBases() const;
51  QStringList & additionalBases();
52 
53  const QString & details() const;
54  QString & details();
55 
56  void setBase(const QString & error);
57  void setBase(const char * error);
58 
59  void appendBase(const QString & error);
60  void appendBase(const QStringList & errors);
61  void appendBase(const char * error);
62 
63  void setDetails(const QString & error);
64  void setDetails(const char * error);
65 
66  bool isEmpty() const;
67  void clear();
68 
69  QString localizedString() const;
70  QString nonLocalizedString() const;
71 
72  virtual QTextStream & print(QTextStream & strm) const Q_DECL_OVERRIDE;
73 
74 private:
75  QSharedDataPointer<ErrorStringData> d;
76 };
77 
78 } // namespace quentier
79 
80 #endif // LIB_QUENTIER_TYPES_ERROR_STRING_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:38
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:54