comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexercmake.h @ 31537:5ceb4bfcdb0f stable

add tools and files for updating the gui's language files for translation * libgui/languages/build_ts/README.md: readme for updating language files * libgui/languages/build_ts/octave-qsci: QScintilla source files for languages without translation provided by QScintilla * libgui/languages/build_ts/octave-qt: Qt source files for languages without translation provided by Qt
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 24 Nov 2022 06:48:25 +0100
parents
children dd5ece3664ed
comparison
equal deleted inserted replaced
31535:4b80982e0af8 31537:5ceb4bfcdb0f
1 // This defines the interface to the QsciLexerCMake class.
2 //
3 // Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com>
4 //
5 // This file is part of QScintilla.
6 //
7 // This file may be used under the terms of the GNU General Public License
8 // version 3.0 as published by the Free Software Foundation and appearing in
9 // the file LICENSE included in the packaging of this file. Please review the
10 // following information to ensure the GNU General Public License version 3.0
11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 //
13 // If you do not wish to use this file under the terms of the GPL version 3.0
14 // then you may purchase a commercial license. For more information contact
15 // info@riverbankcomputing.com.
16 //
17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19
20
21 #ifndef QSCILEXERCMAKE_H
22 #define QSCILEXERCMAKE_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerCMake class encapsulates the Scintilla CMake lexer.
31 class QSCINTILLA_EXPORT QsciLexerCMake : public QsciLexer
32 {
33 Q_OBJECT
34
35 public:
36 //! This enum defines the meanings of the different styles used by the
37 //! CMake lexer.
38 enum {
39 //! The default.
40 Default = 0,
41
42 //! A comment.
43 Comment = 1,
44
45 //! A string.
46 String = 2,
47
48 //! A left quoted string.
49 StringLeftQuote = 3,
50
51 //! A right quoted string.
52 StringRightQuote = 4,
53
54 //! A function. (Defined by keyword set number 1.)
55 Function = 5,
56
57 //! A variable. (Defined by keyword set number 2.)
58 Variable = 6,
59
60 //! A label.
61 Label = 7,
62
63 //! A keyword defined in keyword set number 3. The class must be
64 //! sub-classed and re-implement keywords() to make use of this style.
65 KeywordSet3 = 8,
66
67 //! A WHILE block.
68 BlockWhile = 9,
69
70 //! A FOREACH block.
71 BlockForeach = 10,
72
73 //! An IF block.
74 BlockIf = 11,
75
76 //! A MACRO block.
77 BlockMacro = 12,
78
79 //! A variable within a string.
80 StringVariable = 13,
81
82 //! A number.
83 Number = 14
84 };
85
86 //! Construct a QsciLexerCMake with parent \a parent. \a parent is
87 //! typically the QsciScintilla instance.
88 QsciLexerCMake(QObject *parent = 0);
89
90 //! Destroys the QsciLexerCMake instance.
91 virtual ~QsciLexerCMake();
92
93 //! Returns the name of the language.
94 const char *language() const;
95
96 //! Returns the name of the lexer. Some lexers support a number of
97 //! languages.
98 const char *lexer() const;
99
100 //! Returns the foreground colour of the text for style number \a style.
101 //!
102 //! \sa defaultPaper()
103 QColor defaultColor(int style) const;
104
105 //! Returns the font for style number \a style.
106 QFont defaultFont(int style) const;
107
108 //! Returns the background colour of the text for style number \a style.
109 //!
110 //! \sa defaultColor()
111 QColor defaultPaper(int style) const;
112
113 //! Returns the set of keywords for the keyword set \a set recognised
114 //! by the lexer as a space separated string.
115 const char *keywords(int set) const;
116
117 //! Returns the descriptive name for style number \a style. If the
118 //! style is invalid for this language then an empty QString is returned.
119 //! This is intended to be used in user preference dialogs.
120 QString description(int style) const;
121
122 //! Causes all properties to be refreshed by emitting the propertyChanged()
123 //! signal as required.
124 void refreshProperties();
125
126 //! Returns true if ELSE blocks can be folded.
127 //!
128 //! \sa setFoldAtElse()
129 bool foldAtElse() const;
130
131 public slots:
132 //! If \a fold is true then ELSE blocks can be folded. The default is
133 //! false.
134 //!
135 //! \sa foldAtElse()
136 virtual void setFoldAtElse(bool fold);
137
138 protected:
139 //! The lexer's properties are read from the settings \a qs. \a prefix
140 //! (which has a trailing '/') should be used as a prefix to the key of
141 //! each setting. true is returned if there is no error.
142 //!
143 bool readProperties(QSettings &qs,const QString &prefix);
144
145 //! The lexer's properties are written to the settings \a qs.
146 //! \a prefix (which has a trailing '/') should be used as a prefix to
147 //! the key of each setting. true is returned if there is no error.
148 //!
149 bool writeProperties(QSettings &qs,const QString &prefix) const;
150
151 private:
152 void setAtElseProp();
153
154 bool fold_atelse;
155
156 QsciLexerCMake(const QsciLexerCMake &);
157 QsciLexerCMake &operator=(const QsciLexerCMake &);
158 };
159
160 #endif