File indexing completed on 2024-04-28 16:26:27

0001 /**************************************************************************
0002 *   Copyright (C) 2011-2014 by Michel Ludwig (michel.ludwig@kdemail.net)  *
0003 ***************************************************************************/
0004 
0005 /***************************************************************************
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or modify  *
0008  *   it under the terms of the GNU General Public License as published by  *
0009  *   the Free Software Foundation; either version 2 of the License, or     *
0010  *   (at your option) any later version.                                   *
0011  *                                                                         *
0012  ***************************************************************************/
0013 
0014 #ifndef PARSERMANAGER_H
0015 #define PARSERMANAGER_H
0016 
0017 #include <QList>
0018 #include <QMultiHash>
0019 #include <QObject>
0020 #include <QQueue>
0021 
0022 #include <QUrl>
0023 
0024 class KileInfo;
0025 
0026 namespace KileDocument {
0027 class Info;
0028 class TextInfo;
0029 }
0030 
0031 namespace KileTool {
0032 class Base;
0033 }
0034 
0035 namespace KileParser {
0036 
0037 class ParserOutput;
0038 class DocumentParserThread;
0039 class OutputParserThread;
0040 
0041 class Manager : public QObject
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046     explicit Manager(KileInfo *ki, QObject *parent = 0);
0047     ~Manager();
0048 
0049     void parseDocument(KileDocument::TextInfo* textInfo);
0050 
0051     void parseOutput(KileTool::Base *tool, const QString& fileName, const QString& sourceFile,
0052                      // for QuickPreview
0053                      const QString& texFileName = "", int selrow = -1, int docrow = -1);
0054 
0055     bool isDocumentParsingComplete();
0056 
0057     void stopDocumentParsing(const QUrl &url);
0058 
0059 Q_SIGNALS:
0060     void documentParsingComplete();
0061     void documentParsingStarted();
0062 
0063 protected Q_SLOTS:
0064     void handleOutputParsingComplete(const QUrl &url, KileParser::ParserOutput *output);
0065 
0066     void removeToolFromUrlHash(KileTool::Base *tool);
0067 
0068 private:
0069     KileInfo *m_ki;
0070     DocumentParserThread *m_documentParserThread;
0071     OutputParserThread *m_outputParserThread;
0072     QMultiHash<QUrl, KileTool::Base*> m_urlToToolHash;
0073 };
0074 
0075 }
0076 
0077 #endif