| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:57:40 +01:00
										 |  |  | ** Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator. | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							| 
									
										
										
										
											2016-01-15 14:57:40 +01:00
										 |  |  | ** a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | ** and conditions see https://www.qt.io/terms-conditions. For further
 | 
					
						
							|  |  |  | ** information use the contact form at https://www.qt.io/contact-us.
 | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | ** | 
					
						
							| 
									
										
										
										
											2016-01-15 14:57:40 +01:00
										 |  |  | ** GNU General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | ** General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | ** included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | ** information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
 | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | ** | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef BASEEDITORDOCUMENTPROCESSOR_H
 | 
					
						
							|  |  |  | #define BASEEDITORDOCUMENTPROCESSOR_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "baseeditordocumentparser.h"
 | 
					
						
							|  |  |  | #include "cppsemanticinfo.h"
 | 
					
						
							|  |  |  | #include "cpptools_global.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-24 18:26:09 +02:00
										 |  |  | #include <texteditor/codeassist/assistinterface.h>
 | 
					
						
							| 
									
										
										
										
											2014-09-26 09:14:03 +02:00
										 |  |  | #include <texteditor/texteditor.h>
 | 
					
						
							| 
									
										
										
										
											2015-02-26 13:22:35 +01:00
										 |  |  | #include <texteditor/textdocument.h>
 | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <cplusplus/CppDocument.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QTextEdit>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-15 11:59:48 +01:00
										 |  |  | namespace TextEditor { | 
					
						
							|  |  |  | class TextDocument; | 
					
						
							|  |  |  | class QuickFixOperations; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-02-26 13:22:35 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | namespace CppTools { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CPPTOOLS_EXPORT BaseEditorDocumentProcessor : public QObject | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2016-01-11 20:40:05 +01:00
										 |  |  |     BaseEditorDocumentProcessor(QTextDocument *textDocument, const QString &filePath); | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  |     virtual ~BaseEditorDocumentProcessor(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Function interface to implement
 | 
					
						
							|  |  |  |     virtual void run() = 0; | 
					
						
							| 
									
										
										
										
											2015-06-19 14:43:41 +02:00
										 |  |  |     virtual void semanticRehighlight() = 0; | 
					
						
							| 
									
										
										
										
											2015-06-19 14:37:26 +02:00
										 |  |  |     virtual void recalculateSemanticInfoDetached(bool force) = 0; | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  |     virtual CppTools::SemanticInfo recalculateSemanticInfo() = 0; | 
					
						
							| 
									
										
										
										
											2014-11-28 12:03:58 +01:00
										 |  |  |     virtual CPlusPlus::Snapshot snapshot() = 0; | 
					
						
							| 
									
										
										
										
											2015-09-01 17:34:07 +02:00
										 |  |  |     virtual BaseEditorDocumentParser::Ptr parser() = 0; | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  |     virtual bool isParserRunning() const = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-24 18:26:09 +02:00
										 |  |  |     virtual TextEditor::QuickFixOperations | 
					
						
							|  |  |  |     extraRefactoringOperations(const TextEditor::AssistInterface &assistInterface); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | signals: | 
					
						
							|  |  |  |     // Signal interface to implement
 | 
					
						
							|  |  |  |     void codeWarningsUpdated(unsigned revision, | 
					
						
							|  |  |  |                              const QList<QTextEdit::ExtraSelection> selections); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void ifdefedOutBlocksUpdated(unsigned revision, | 
					
						
							|  |  |  |                                  const QList<TextEditor::BlockRange> ifdefedOutBlocks); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void cppDocumentUpdated(const CPlusPlus::Document::Ptr document);    // TODO: Remove me
 | 
					
						
							|  |  |  |     void semanticInfoUpdated(const CppTools::SemanticInfo semanticInfo); // TODO: Remove me
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     static void runParser(QFutureInterface<void> &future, | 
					
						
							| 
									
										
										
										
											2015-09-01 17:34:07 +02:00
										 |  |  |                           BaseEditorDocumentParser::Ptr parser, | 
					
						
							| 
									
										
										
										
											2015-12-15 12:32:01 +01:00
										 |  |  |                           const CppTools::WorkingCopy workingCopy); | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Convenience
 | 
					
						
							| 
									
										
										
										
											2016-01-11 20:40:05 +01:00
										 |  |  |     QString filePath() const { return m_filePath; } | 
					
						
							|  |  |  |     unsigned revision() const { return static_cast<unsigned>(m_textDocument->revision()); } | 
					
						
							|  |  |  |     QTextDocument *textDocument() const { return m_textDocument; } | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2016-01-11 20:40:05 +01:00
										 |  |  |     QString m_filePath; | 
					
						
							|  |  |  |     QTextDocument *m_textDocument; | 
					
						
							| 
									
										
										
										
											2014-08-19 15:59:29 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace CppTools
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // BASEEDITORDOCUMENTPROCESSOR_H
 | 
					
						
							|  |  |  | 
 |