| 1 | /************************************************************************************* |
| 2 | * Copyright (C) 2007 by Aleix Pol <[email protected]> * |
| 3 | * * |
| 4 | * This program is free software; you can redistribute it and/or * |
| 5 | * modify it under the terms of the GNU General Public License * |
| 6 | * as published by the Free Software Foundation; either version 2 * |
| 7 | * of the License, or (at your option) any later version. * |
| 8 | * * |
| 9 | * This program is distributed in the hope that it will be useful, * |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 12 | * GNU General Public License for more details. * |
| 13 | * * |
| 14 | * You should have received a copy of the GNU General Public License * |
| 15 | * along with this program; if not, write to the Free Software * |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * |
| 17 | *************************************************************************************/ |
| 18 | |
| 19 | #ifndef ALGEBRAHIGHLIGHTER_H |
| 20 | #define ALGEBRAHIGHLIGHTER_Hcxx . . $ `analitzagui/algebrahighlighter.h:20:9`! |
| 21 | |
| 22 | #include <QSyntaxHighlighter> |
| 23 | #include "analitzaguiexport.h"cxx . . $ `<file>/build/analitzagui/analitzaguiexport.h`/ |
| 24 | |
| 25 | /** |
| 26 | * The AlgebraHighlighter class is used to highlight the ExpressionEdit text. |
| 27 | * @author <[email protected]> |
| 28 | */ |
| 29 | |
| 30 | namespace Analitzacxx . . $ Analitza/ { class Analyzercxx . . $ Analitza/Analyzer#; } |
| 31 | |
| 32 | class ANALITZAGUI_EXPORTcxx . . $ `build/analitzagui/analitzaguiexport.h:12:15`! AlgebraHighlightercxx . . $ AlgebraHighlighter# : public QSyntaxHighlightercxx . . $ QSyntaxHighlighter# |
| 33 | { |
| 34 | public: |
| 35 | /** Defines the format status that could be used. */ |
| 36 | typedef enumcxx . . $ AlgebraHighlighter#$anonymous_type_0# { |
| 37 | Expressioncxx . . $ AlgebraHighlighter#Expression., /**< String expression format. */ |
| 38 | MathMLcxx . . $ AlgebraHighlighter#MathML., /**< MathML format. */ |
| 39 | Autodetectcxx . . $ AlgebraHighlighter#Autodetect. /**< Try to guess which format is being used. */ |
| 40 | } Modecxx . . $ AlgebraHighlighter#Mode#; |
| 41 | |
| 42 | /** Constructor. Creates an AlgebraHighlighter from a QTextDocument @p doc. */ |
| 43 | explicit AlgebraHighlightercxx . . $ AlgebraHighlighter#AlgebraHighlighter(905949a951cd8f3e).(QTextDocumentcxx . . $ QTextDocument# *doc, const Analitzacxx . . $ Analitza/::Analyzercxx . . $ Analitza/Analyzer#* na=nullptr); |
| 44 | //int highlightParagraph(const QString &text, int endStateOfLastPara); |
| 45 | |
| 46 | /** Returns the currently highlight mode. */ |
| 47 | Modecxx . . $ AlgebraHighlighter#Mode# modecxx . . $ AlgebraHighlighter#mode(5cb1e12201e47c0d).() { return m_modecxx . . $ AlgebraHighlighter#m_mode.; } |
| 48 | |
| 49 | /** Sets the highlight mode. */ |
| 50 | void setModecxx . . $ AlgebraHighlighter#setMode(ca48dca57ffaf5d3).(const Modecxx . . $ AlgebraHighlighter#Mode#& newMode){ m_modecxx . . $ AlgebraHighlighter#m_mode.=newMode; rehighlightcxx . . $ QSyntaxHighlighter#rehighlight(49f6e7a06ebc5aa8).(); } |
| 51 | |
| 52 | /** |
| 53 | * Returns whether something wrong has been found. It is an uncomplete way |
| 54 | * to know if it is correct because doesn't do any recursive check, but could be useful. |
| 55 | * @returns whether it is a lexically correct expression. |
| 56 | */ |
| 57 | bool isCorrectcxx . . $ AlgebraHighlighter#isCorrect(50ce9a9e25b4a850).() const { return m_correctcxx . . $ AlgebraHighlighter#m_correct.; } |
| 58 | |
| 59 | /** Sets the cursor position. */ |
| 60 | void setPoscxx . . $ AlgebraHighlighter#setPos(cb2f890c2fdad230).(uintcxx . . $ uint# p) { m_poscxx . . $ AlgebraHighlighter#m_pos.=p; } |
| 61 | |
| 62 | /** Sets the corresponding Analitza class. */ |
| 63 | void setAnalitzacxx . . $ AlgebraHighlighter#setAnalitza(50b006347d5198dc).(const Analitzacxx . . $ Analitza/::Analyzercxx . . $ Analitza/Analyzer#* na) { acxx . . $ AlgebraHighlighter#a. = na; } |
| 64 | |
| 65 | ///@returns the name of the function that's being edited, if any |
| 66 | QStringcxx . . $ QString# editingNamecxx . . $ AlgebraHighlighter#editingName(6ef7b6c27b00b43d).() const; |
| 67 | |
| 68 | ///@returns the number of the parameter that's being edited |
| 69 | int editingParametercxx . . $ AlgebraHighlighter#editingParameter(455f465bc33b4cdf).() const; |
| 70 | bool editingBoundscxx . . $ AlgebraHighlighter#editingBounds(50ce9a9e25b4a850).() const; |
| 71 | private: |
| 72 | void highlightBlockcxx . . $ AlgebraHighlighter#highlightBlock(3520e46b33348bf6).(const QStringcxx . . $ QString# &text) override; |
| 73 | |
| 74 | enum MMLtokEnumcxx . . $ AlgebraHighlighter#MMLtokEnum# { //For mathml highlighting |
| 75 | gtcxx . . $ AlgebraHighlighter#gt., |
| 76 | ltcxx . . $ AlgebraHighlighter#lt., |
| 77 | tagcxx . . $ AlgebraHighlighter#tag., |
| 78 | valuecxx . . $ AlgebraHighlighter#value. |
| 79 | }; |
| 80 | |
| 81 | bool m_correctcxx . . $ AlgebraHighlighter#m_correct.; |
| 82 | Modecxx . . $ AlgebraHighlighter#Mode# m_modecxx . . $ AlgebraHighlighter#m_mode.; |
| 83 | uintcxx . . $ uint# m_poscxx . . $ AlgebraHighlighter#m_pos.; |
| 84 | int m_editingParametercxx . . $ AlgebraHighlighter#m_editingParameter.; |
| 85 | QStringcxx . . $ QString# m_editingNamecxx . . $ AlgebraHighlighter#m_editingName.; |
| 86 | bool m_editingBoundscxx . . $ AlgebraHighlighter#m_editingBounds.; |
| 87 | QStringcxx . . $ QString# m_aNamecxx . . $ AlgebraHighlighter#m_aName.; |
| 88 | |
| 89 | QTextCharFormatcxx . . $ QTextCharFormat# boldcxx . . $ AlgebraHighlighter#bold.; |
| 90 | const Analitzacxx . . $ Analitza/::Analyzercxx . . $ Analitza/Analyzer#* acxx . . $ AlgebraHighlighter#a.; |
| 91 | }; |
| 92 | |
| 93 | #endif |