Soprano
2.9.4
soprano
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
31
namespace
Soprano
{
32
namespace
Error {
40
enum
ErrorCode
{
41
ErrorNone
= 0x0,
42
ErrorInvalidArgument
= 0x1,
43
ErrorInvalidStatement
=
ErrorInvalidArgument
,
44
ErrorNotSupported
= 0x2,
45
ErrorParsingFailed
= 0x3,
46
ErrorPermissionDenied
= 0x4,
47
ErrorTimeout
= 0x5,
48
ErrorUnknown
= 0x1000
49
};
50
54
SOPRANO_EXPORT
QString
errorMessage
(
ErrorCode
);
55
63
SOPRANO_EXPORT
ErrorCode
convertErrorCode
(
int
code );
64
65
class
ErrorData;
66
class
ParserError;
67
77
class
SOPRANO_EXPORT
Error
78
{
79
public
:
83
Error
();
84
93
Error
(
const
QString
& message,
int
code =
ErrorUnknown
);
94
98
Error
(
const
Error
& );
99
103
virtual
~
Error
();
104
105
Error
& operator=(
const
Error
& );
106
121
operator
bool()
const
{
return
code() !=
ErrorNone
; }
122
131
QString
message()
const
;
132
147
int
code()
const
;
148
153
bool
isParserError()
const
;
154
167
ParserError
toParserError()
const
;
168
169
protected
:
171
Error
( ErrorData* );
172
QSharedDataPointer<ErrorData>
d;
174
};
175
176
class
Locator;
177
200
class
SOPRANO_EXPORT
ParserError
:
public
Error
201
{
202
public
:
206
ParserError
();
207
208
ParserError
(
const
Locator
&,
const
QString
& message =
QString
(),
int
code =
ErrorParsingFailed
);
209
210
ParserError
(
const
Error
& );
211
212
~
ParserError
();
213
214
ParserError
& operator=(
const
Error
& );
215
216
Locator
locator()
const
;
217
};
218
234
class
SOPRANO_EXPORT
ErrorCache
235
{
236
public
:
237
virtual
~
ErrorCache
();
238
242
virtual
Error
lastError()
const
;
243
244
protected
:
245
ErrorCache
();
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
272
class
QDebug;
273
class
QTextStream
;
274
275
SOPRANO_EXPORT
QDebug
operator<<
( QDebug s,
const
Soprano::Error::Error
& );
276
SOPRANO_EXPORT
QTextStream
&
operator<<
(
QTextStream
& s,
const
Soprano::Error::Error
& );
277
278
#endif
soprano_export.h
Soprano::Error::ErrorTimeout
@ ErrorTimeout
Definition:
error.h:47
Soprano::Error::ErrorInvalidArgument
@ ErrorInvalidArgument
Definition:
error.h:42
QSharedDataPointer
SOPRANO_EXPORT
#define SOPRANO_EXPORT
Definition:
soprano_export.h:37
Soprano::Error::ErrorCache
Core class of Soprano's exception system.
Definition:
error.h:234
Soprano::Error::ErrorNotSupported
@ ErrorNotSupported
Definition:
error.h:44
Soprano::Node::operator<<
SOPRANO_EXPORT QDebug operator<<(QDebug s, const Soprano::Node &)
Soprano::Error::ErrorPermissionDenied
@ ErrorPermissionDenied
Definition:
error.h:46
Soprano::Error::Error
Represents an error in Soprano.
Definition:
error.h:77
QTextStream
Soprano::Error::ErrorUnknown
@ ErrorUnknown
Definition:
error.h:48
Soprano::Error::ErrorNone
@ ErrorNone
Definition:
error.h:41
Soprano::Error::ParserError
Represents a parser error in Soprano.
Definition:
error.h:200
Soprano::Error::ErrorParsingFailed
@ ErrorParsingFailed
Definition:
error.h:45
Soprano::Error::Locator
Details of a parser Error.
Definition:
locator.h:41
Soprano
Definition:
backend.h:35
Soprano::Error::convertErrorCode
SOPRANO_EXPORT ErrorCode convertErrorCode(int code)
Soprano::Error::ErrorCode
ErrorCode
Definition:
error.h:40
Soprano::Error::ErrorInvalidStatement
@ ErrorInvalidStatement
Definition:
error.h:43
QString
Soprano::Error::errorMessage
SOPRANO_EXPORT QString errorMessage(ErrorCode)
Generated by
1.8.17