libquentier  0.5.0
The library for rich desktop clients of Evernote service
ErrorString.h
1 /*
2  * Copyright 2017-2020 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 
24 #include <QSharedDataPointer>
25 
26 namespace quentier {
27 
28 QT_FORWARD_DECLARE_CLASS(ErrorStringData)
29 
30 
43 class QUENTIER_EXPORT ErrorString: public Printable
44 {
45 public:
46  explicit ErrorString(const char * error = nullptr);
47  explicit ErrorString(const QString & error);
48  ErrorString(const ErrorString & other);
49  ErrorString & operator=(const ErrorString & other);
50  virtual ~ErrorString() override;
51 
52  const QString & base() const;
53  QString & base();
54 
55  const QStringList & additionalBases() const;
56  QStringList & additionalBases();
57 
58  const QString & details() const;
59  QString & details();
60 
61  void setBase(const QString & error);
62  void setBase(const char * error);
63 
64  void appendBase(const QString & error);
65  void appendBase(const QStringList & errors);
66  void appendBase(const char * error);
67 
68  void setDetails(const QString & error);
69  void setDetails(const char * error);
70 
71  bool isEmpty() const;
72  void clear();
73 
74  QString localizedString() const;
75  QString nonLocalizedString() const;
76 
77  virtual QTextStream & print(QTextStream & strm) const override;
78 
79 private:
80  QSharedDataPointer<ErrorStringData> d;
81 };
82 
83 } // namespace quentier
84 
85 #endif // LIB_QUENTIER_TYPES_ERROR_STRING_H
quentier::Printable
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:38
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43