Warning, file /office/kile/src/parser/parser.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  *   Copyright (C) 2011-2022 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 PARSER_H
0015 #define PARSER_H
0016 
0017 #include <QObject>
0018 
0019 #include <QUrl>
0020 
0021 class KileInfo;
0022 
0023 namespace KileDocument {
0024 class Info;
0025 class TextInfo;
0026 }
0027 
0028 namespace KileParser {
0029 
0030 struct TodoResult
0031 {
0032     int type;
0033     uint colTag;
0034     uint colComment;
0035     QString comment;
0036 };
0037 
0038 class ParserThread;
0039 
0040 class StructureViewItem {
0041 public:
0042     StructureViewItem(const QString &title, uint line, uint column, int type, int level, uint startline, uint startcol,
0043                       const QString &pix, const QString &folder);
0044     ~StructureViewItem();
0045 
0046     QString title;
0047     uint line;
0048     uint column;
0049     int type;
0050     int level;
0051     uint startline;
0052     uint startcol;
0053     QString pix;
0054     QString folder;
0055 };
0056 
0057 class ParserInput {
0058 public:
0059     explicit ParserInput(const QUrl &url);
0060     virtual ~ParserInput();
0061 
0062     QUrl url;
0063 };
0064 
0065 class ParserOutput {
0066 public:
0067     virtual ~ParserOutput();
0068 
0069     std::list<StructureViewItem*> structureViewItems;
0070 };
0071 
0072 class Parser : public QObject
0073 {
0074     Q_OBJECT
0075 
0076 public:
0077     explicit Parser(ParserThread *parserThread, QObject *parent = Q_NULLPTR);
0078     virtual ~Parser();
0079 
0080     virtual ParserOutput* parse() = 0;
0081 
0082 protected:
0083     ParserThread *m_parserThread;
0084 
0085     QString processTextline(const QString &line, TodoResult &todo);
0086     void searchTodoComment(const QString &s, uint startpos, TodoResult &todo);
0087     QString matchBracket(const QStringList& textLines, QChar obracket, int &l, int &pos);
0088     // for now, we have to emulate the behaviour of 'KTextEditor::Document::line':
0089     // we return an empty string if the given line number is invalid
0090     QString getTextLine(const QStringList& textLines, int line);
0091 };
0092 
0093 }
0094 
0095 #endif