diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2022-08-08 23:36:24 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2022-08-08 23:36:24 +0300 |
commit | 03d71f9c75df79d6363bba0da927cffc7cbf14e0 (patch) | |
tree | e07dbbd50884c5ebc756f7944acbdab707e2b7aa | |
parent | af3d1cc078abbc31cc163461d175e997f94868b5 (diff) |
Replace QXmlInputSource with QString
-rw-r--r-- | source/fb2code.cpp | 4 | ||||
-rw-r--r-- | source/fb2page.cpp | 3 | ||||
-rw-r--r-- | source/fb2read.cpp | 6 | ||||
-rw-r--r-- | source/fb2read.hpp | 8 | ||||
-rw-r--r-- | source/fb2xml2.cpp | 10 | ||||
-rw-r--r-- | source/fb2xml2.h | 4 |
6 files changed, 16 insertions, 19 deletions
diff --git a/source/fb2code.cpp b/source/fb2code.cpp index 37afde1..e3ef908 100644 --- a/source/fb2code.cpp +++ b/source/fb2code.cpp @@ -548,9 +548,7 @@ bool FbCodeEdit::read(QIODevice *device) { QByteArray data = device->readAll(); delete device; - QXmlInputSource source; - source.setData(data); - setPlainText(source.data()); + setPlainText(data); return true; } diff --git a/source/fb2page.cpp b/source/fb2page.cpp index 0c27ee6..60d2329 100644 --- a/source/fb2page.cpp +++ b/source/fb2page.cpp @@ -68,8 +68,7 @@ FbNetworkAccessManager *FbTextPage::manager() bool FbTextPage::read(const QString &html) { - QXmlInputSource *source = new QXmlInputSource(); - source->setData(html); + QString *source = new QString(html); FbReadThread::execute(this, source, 0); return true; } diff --git a/source/fb2read.cpp b/source/fb2read.cpp index 242401b..c710dfe 100644 --- a/source/fb2read.cpp +++ b/source/fb2read.cpp @@ -9,14 +9,14 @@ // FbReadThread //--------------------------------------------------------------------------- -void FbReadThread::execute(QObject *parent, QXmlInputSource *source, QIODevice *device) +void FbReadThread::execute(QObject *parent, QString *source, QIODevice *device) { FbReadThread *thread = new FbReadThread(parent, source, device); connect(thread, SIGNAL(html(QString, FbStore*)), parent, SLOT(html(QString, FbStore*))); thread->start(); } -FbReadThread::FbReadThread(QObject *parent, QXmlInputSource *source, QIODevice *device) +FbReadThread::FbReadThread(QObject *parent, QString *source, QIODevice *device) : QThread(parent) , m_device(device) , m_source(source) @@ -367,7 +367,7 @@ void FbReadHandler::BinaryHandler::EndTag(const QString &name) // FbReadHandler //--------------------------------------------------------------------------- -bool FbReadHandler::load(QObject *page, QXmlInputSource &source, QString &html) +bool FbReadHandler::load(QObject *page, QString &source, QString &html) { QXmlStreamWriter writer(&html); FbReadHandler handler(writer); diff --git a/source/fb2read.hpp b/source/fb2read.hpp index affc1bc..19bf6d9 100644 --- a/source/fb2read.hpp +++ b/source/fb2read.hpp @@ -15,7 +15,7 @@ class FbReadThread : public QThread Q_OBJECT public: - static void execute(QObject *parent, QXmlInputSource *source, QIODevice *device); + static void execute(QObject *parent, QString *source, QIODevice *device); virtual ~FbReadThread(); signals: @@ -27,12 +27,12 @@ protected: void run(); private: - explicit FbReadThread(QObject *parent, QXmlInputSource *source, QIODevice *device); + explicit FbReadThread(QObject *parent, QString *source, QIODevice *device); bool parse(); private: QIODevice *m_device; - QXmlInputSource *m_source; + QString *m_source; FbStore *m_store; QString m_html; }; @@ -42,7 +42,7 @@ class FbReadHandler : public FbXmlHandler Q_OBJECT public: - static bool load(QObject *page, QXmlInputSource &source, QString &html); + static bool load(QObject *page, QString &source, QString &html); explicit FbReadHandler(QXmlStreamWriter &writer); virtual ~FbReadHandler(); virtual bool comment(const QString& ch); diff --git a/source/fb2xml2.cpp b/source/fb2xml2.cpp index a107ae5..c234e91 100644 --- a/source/fb2xml2.cpp +++ b/source/fb2xml2.cpp @@ -17,7 +17,7 @@ public: private: XmlReaderPrivate(XmlReader* reader); - bool parse(const QXmlInputSource *input); + bool parse(const QString *input); bool parse(QIODevice *input); bool process(QXmlStreamReader& reader); @@ -76,9 +76,9 @@ bool XmlReaderPrivate::process(QXmlStreamReader &reader) return !reader.isEndDocument(); } -bool XmlReaderPrivate::parse(const QXmlInputSource *input) +bool XmlReaderPrivate::parse(const QString *input) { - QXmlStreamReader reader(input->data().toUtf8()); + QXmlStreamReader reader(*input); return process(reader); } @@ -165,12 +165,12 @@ FbXmlHandler* XmlReader::lexicalHandler(void) const return d->lexicalhandler; } -bool XmlReader::parse(const QXmlInputSource& input) +bool XmlReader::parse(const QString& input) { return this->parse(&input); } -bool XmlReader::parse(const QXmlInputSource* input) +bool XmlReader::parse(const QString* input) { Q_D(XmlReader); diff --git a/source/fb2xml2.h b/source/fb2xml2.h index 95c8f1e..445f91c 100644 --- a/source/fb2xml2.h +++ b/source/fb2xml2.h @@ -31,8 +31,8 @@ public: FbXmlHandler* lexicalHandler(void) const; bool parse(QIODevice *input); - bool parse(const QXmlInputSource&); - bool parse(const QXmlInputSource*); + bool parse(const QString&); + bool parse(const QString*); private: |