Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
xmlparser.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef XMLPARSER_H
5#define XMLPARSER_H
6
7#include <QtCore/qglobal.h>
8#include <QtCore/qxmlstream.h>
9
11
13{
14public:
15 XmlParser(QXmlStreamReader &r, bool whitespaceOnlyData = false)
16 : reader(r), reportWhitespaceOnlyData(whitespaceOnlyData)
17 {
18 }
19 virtual ~XmlParser() = default;
20
21 bool parse();
22
23protected:
24 virtual bool startElement(QStringView namespaceURI, QStringView localName,
25 QStringView qName, const QXmlStreamAttributes &atts);
26 virtual bool endElement(QStringView namespaceURI, QStringView localName,
27 QStringView qName);
28 virtual bool characters(QStringView text);
29 virtual bool endDocument();
30 virtual bool fatalError(qint64 line, qint64 column, const QString &message);
31
34};
35
36QT_END_NAMESPACE
37
38#endif // XMLPARSER_H
void append(Phrase *phrase)
Definition phrase.cpp:269
QString friendlyPhraseBookName() const
Definition phrase.cpp:300
bool load(const QString &fileName, bool *langGuessed)
Definition phrase.cpp:195
bool save(const QString &fileName)
Definition phrase.cpp:237
void remove(Phrase *phrase)
Definition phrase.cpp:277
void setPhraseBook(PhraseBook *book)
Definition phrase.h:36
PhraseBook * phraseBook() const
Definition phrase.h:35
void setDefinition(const QString &nd)
Definition phrase.cpp:64
void setSource(const QString &ns)
Definition phrase.cpp:46
Phrase()
Definition phrase.cpp:28
Phrase(const QString &source, const QString &target, const QString &definition, PhraseBook *phraseBook)
Definition phrase.cpp:39
Phrase(const QString &source, const QString &target, const QString &definition, const Candidate &candidate, int sc=-1)
Definition phrase.cpp:33
void setTarget(const QString &nt)
Definition phrase.cpp:55
bool fatalError(qint64 line, qint64 column, const QString &message) override
Definition phrase.cpp:151
QphHandler(PhraseBook *phraseBook, QXmlStreamReader &reader)
Definition phrase.cpp:82
QString sourceLanguage() const
Definition phrase.cpp:89
bool endElement(QStringView namespaceURI, QStringView localName, QStringView qName) override
Definition phrase.cpp:128
~QphHandler() override=default
bool startElement(QStringView namespaceURI, QStringView localName, QStringView qName, const QXmlStreamAttributes &atts) override
Definition phrase.cpp:110
QString language() const
Definition phrase.cpp:88
bool characters(QStringView ch) override
Definition phrase.cpp:145
QXmlStreamReader & reader
Definition xmlparser.h:32
virtual bool characters(QStringView text)
Definition xmlparser.cpp:65
virtual bool endElement(QStringView namespaceURI, QStringView localName, QStringView qName)
Definition xmlparser.cpp:56
bool parse()
Definition xmlparser.cpp:8
virtual bool endDocument()
Definition xmlparser.cpp:79
virtual bool startElement(QStringView namespaceURI, QStringView localName, QStringView qName, const QXmlStreamAttributes &atts)
Definition xmlparser.cpp:46
XmlParser(QXmlStreamReader &r, bool whitespaceOnlyData=false)
Definition xmlparser.h:15
virtual bool fatalError(qint64 line, qint64 column, const QString &message)
Definition xmlparser.cpp:71
bool reportWhitespaceOnlyData
Definition xmlparser.h:33
virtual ~XmlParser()=default
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE QString xmlProtect(const QString &str)
Definition phrase.cpp:17
bool operator==(const Phrase &p, const Phrase &q)
Definition phrase.cpp:73