Sfoglia il codice sorgente

Replace QXmlInputSource with QString

Arkadiy Illarionov 2 anni fa
parent
commit
03d71f9c75
6 ha cambiato i file con 16 aggiunte e 19 eliminazioni
  1. 1 3
      source/fb2code.cpp
  2. 1 2
      source/fb2page.cpp
  3. 3 3
      source/fb2read.cpp
  4. 4 4
      source/fb2read.hpp
  5. 5 5
      source/fb2xml2.cpp
  6. 2 2
      source/fb2xml2.h

+ 1 - 3
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;
 }
 

+ 1 - 2
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;
 }

+ 3 - 3
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);

+ 4 - 4
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);

+ 5 - 5
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);
 

+ 2 - 2
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: