Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-xmlstreamreadererror.h
1#ifndef QX_STREAMREADERERROR_H
2#define QX_STREAMREADERERROR_H
3
4// Shared Lib Support
5#include "qx/xml/qx_xml_export.h"
6
7// Qt Includes
8#include <QXmlStreamReader>
9#include <QHash>
10
11using namespace Qt::Literals::StringLiterals;
12
13namespace Qx
14{
15
16class QX_XML_EXPORT XmlStreamReaderError
17{
18//-Class Members--------------------------------------------------------------------------------------------------
19private:
20 static inline const QHash<QXmlStreamReader::Error, QString> STD_ERR_TXT = {
21 {QXmlStreamReader::NoError, u"No error has occurred."_s},
22 {QXmlStreamReader::CustomError, u"A custom error has been raised with raiseError()."_s},
23 {QXmlStreamReader::NotWellFormedError, u"The parser internally raised an error due to the read XML not being well-formed."_s},
24 {QXmlStreamReader::PrematureEndOfDocumentError, u"The input stream ended before a well-formed XML document was parsed."_s},
25 {QXmlStreamReader::UnexpectedElementError, u"The parser encountered an element that was different to those it expected."_s}
26 };
27 //TODO: See if there is a better way to get strings of these errors, but it seems doubtful (there's a slight chance
28 // that calling device().errorString() on the reader might give these)
29
30//-Instance Members----------------------------------------------------------------------------------------------
31private:
32 QXmlStreamReader::Error mErrorType;
33 QString mErrorText;
34
35//-Constructor---------------------------------------------------------------------------------------------------
36public:
39 XmlStreamReaderError(QString customError);
40 XmlStreamReaderError(const QXmlStreamReader& streamReader);
41
42//-Instance Functions--------------------------------------------------------------------------------------------
43public:
44 bool isValid();
46 QString text();
47};
48
49}
50
51#endif // QX_STREAMREADERERROR_H
The XmlStreamReaderError class provides a full error object for QXmlStreamReader, similar to other Qt...
Definition qx-xmlstreamreadererror.h:17
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5