Soprano 2.9.4
error.h
Go to the documentation of this file.
1/*
2 * This file is part of Soprano Project.
3 *
4 * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#ifndef _SOPRANO_ERROR_H_
23#define _SOPRANO_ERROR_H_
24
25#include "soprano_export.h"
26
27#include <QtCore/QString>
28#include <QtCore/QSharedDataPointer>
29
30
31namespace Soprano {
32 namespace Error {
40 enum ErrorCode {
41 ErrorNone = 0x0,
48 ErrorUnknown = 0x1000
49 };
50
55
64
65 class ErrorData;
66 class ParserError;
67
78 {
79 public:
84
93 Error( const QString& message, int code = ErrorUnknown );
94
98 Error( const Error& );
99
103 virtual ~Error();
104
106
121 operator bool() const { return code() != ErrorNone; }
122
132
147 int code() const;
148
153 bool isParserError() const;
154
168
169 protected:
171 Error( ErrorData* );
174 };
175
176 class Locator;
177
201 {
202 public:
207
208 ParserError( const Locator&, const QString& message = QString(), int code = ErrorParsingFailed );
209
211
213
215
217 };
218
235 {
236 public:
237 virtual ~ErrorCache();
238
242 virtual Error lastError() const;
243
244 protected:
246
250 void clearError() const;
251
257 void setError( const Error& ) const;
258
263 void setError( const QString& errorMessage, int code = ErrorUnknown ) const;
264
265 private:
266 class Private;
267 Private* const d;
268 };
269 }
270}
271
272class QDebug;
273class QTextStream;
274
277
278#endif
Core class of Soprano's exception system.
Definition: error.h:235
void setError(const QString &errorMessage, int code=ErrorUnknown) const
virtual Error lastError() const
void setError(const Error &) const
Represents an error in Soprano.
Definition: error.h:78
ParserError toParserError() const
bool isParserError() const
Error(const Error &)
Error & operator=(const Error &)
Error(const QString &message, int code=ErrorUnknown)
QString message() const
Details of a parser Error.
Definition: locator.h:41
Represents a parser error in Soprano.
Definition: error.h:201
ParserError(const Locator &, const QString &message=QString(), int code=ErrorParsingFailed)
ParserError & operator=(const Error &)
SOPRANO_EXPORT QDebug operator<<(QDebug s, const Soprano::Node &)
SOPRANO_EXPORT QString errorMessage(ErrorCode)
SOPRANO_EXPORT ErrorCode convertErrorCode(int code)
@ ErrorPermissionDenied
Definition: error.h:46
@ ErrorInvalidArgument
Definition: error.h:42
@ ErrorNotSupported
Definition: error.h:44
@ ErrorUnknown
Definition: error.h:48
@ ErrorTimeout
Definition: error.h:47
@ ErrorParsingFailed
Definition: error.h:45
@ ErrorInvalidStatement
Definition: error.h:43
#define SOPRANO_EXPORT