Changeset View
Changeset View
Standalone View
Standalone View
src/lib/definition.h
Show All 15 Lines | |||||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #ifndef KSYNTAXHIGHLIGHTING_DEFINITION_H | 18 | #ifndef KSYNTAXHIGHLIGHTING_DEFINITION_H | ||
19 | #define KSYNTAXHIGHLIGHTING_DEFINITION_H | 19 | #define KSYNTAXHIGHLIGHTING_DEFINITION_H | ||
20 | 20 | | |||
21 | #include "ksyntaxhighlighting_export.h" | 21 | #include "ksyntaxhighlighting_export.h" | ||
22 | 22 | | |||
23 | #include <QTypeInfo> | 23 | #include <QTypeInfo> | ||
24 | #include <QPair> | ||||
24 | 25 | | |||
25 | #include <memory> | 26 | #include <memory> | ||
26 | 27 | | |||
27 | class QChar; | 28 | class QChar; | ||
28 | class QString; | 29 | class QString; | ||
29 | class QStringList; | 30 | class QStringList; | ||
30 | template <typename T> class QVector; | 31 | template <typename T> class QVector; | ||
31 | 32 | | |||
32 | namespace KSyntaxHighlighting { | 33 | namespace KSyntaxHighlighting { | ||
33 | 34 | | |||
34 | class Context; | 35 | class Context; | ||
35 | class Format; | 36 | class Format; | ||
36 | class KeywordList; | 37 | class KeywordList; | ||
37 | 38 | | |||
38 | class DefinitionData; | 39 | class DefinitionData; | ||
39 | 40 | | |||
40 | /** | 41 | /** | ||
42 | * Defines the insert position when commenting code. | ||||
43 | * @since 5.50 | ||||
44 | * @see Definition::singleLineCommentPosition() | ||||
45 | */ | ||||
46 | enum class CommentPosition | ||||
47 | { | ||||
48 | //! The comment marker is inserted at the beginning of a line at column 0 | ||||
49 | StartOfLine = 0, | ||||
50 | //! The comment marker is inserted after leading whitespaces right befire | ||||
51 | //! the first non-whitespace character. | ||||
52 | AfterWhitespace | ||||
53 | }; | ||||
54 | | ||||
55 | /** | ||||
41 | * Represents a syntax definition. | 56 | * Represents a syntax definition. | ||
42 | * | 57 | * | ||
43 | * @section def_intro Introduction to Definitions | 58 | * @section def_intro Introduction to Definitions | ||
44 | * | 59 | * | ||
45 | * A Definition is the short term for a syntax highlighting definition. It | 60 | * A Definition is the short term for a syntax highlighting definition. It | ||
46 | * typically is defined in terms of an XML syntax highlighting file, containing | 61 | * typically is defined in terms of an XML syntax highlighting file, containing | ||
47 | * all information about a particular syntax highlighting. This includes the | 62 | * all information about a particular syntax highlighting. This includes the | ||
48 | * highlighting of keywords, information about code folding regions, and | 63 | * highlighting of keywords, information about code folding regions, and | ||
▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Line(s) | 86 | public: | |||
253 | * Returns a list of Definitions that are referenced with the IncludeRules rule. | 268 | * Returns a list of Definitions that are referenced with the IncludeRules rule. | ||
254 | * The returned list does not include this Definition. In case no other | 269 | * The returned list does not include this Definition. In case no other | ||
255 | * Definitions are referenced via IncludeRules, the returned list is empty. | 270 | * Definitions are referenced via IncludeRules, the returned list is empty. | ||
256 | * | 271 | * | ||
257 | * @since 5.49 | 272 | * @since 5.49 | ||
258 | */ | 273 | */ | ||
259 | QVector<Definition> includedDefinitions() const; | 274 | QVector<Definition> includedDefinitions() const; | ||
260 | 275 | | |||
276 | /** | ||||
277 | * Returns the marker that starts a single line comment. | ||||
278 | * For instance, in C++ the single line comment marker is "//". | ||||
279 | * @since 5.50 | ||||
280 | * @see singleLineCommentPosition(); | ||||
281 | */ | ||||
282 | QString singleLineCommentMarker() const; | ||||
283 | | ||||
284 | /** | ||||
285 | * Returns the insert position of the comment marker for sinle line | ||||
286 | * comments. | ||||
287 | * @since 5.50 | ||||
288 | * @see singleLineCommentMarker(); | ||||
289 | */ | ||||
290 | CommentPosition singleLineCommentPosition() const; | ||||
291 | | ||||
292 | /** | ||||
293 | * Returns the markers that start and end multiline comments. | ||||
294 | * For instance, in XML this is defined as "<!--" and "-->". | ||||
295 | * @since 5.50 | ||||
296 | */ | ||||
297 | QPair<QString, QString> multiLineCommentMarker() const; | ||||
298 | | ||||
261 | private: | 299 | private: | ||
262 | friend class DefinitionData; | 300 | friend class DefinitionData; | ||
263 | friend class DefinitionRef; | 301 | friend class DefinitionRef; | ||
264 | explicit Definition(const std::shared_ptr<DefinitionData> &dd); | 302 | explicit Definition(const std::shared_ptr<DefinitionData> &dd); | ||
265 | std::shared_ptr<DefinitionData> d; | 303 | std::shared_ptr<DefinitionData> d; | ||
266 | }; | 304 | }; | ||
267 | 305 | | |||
268 | } | 306 | } | ||
269 | 307 | | |||
270 | Q_DECLARE_TYPEINFO(KSyntaxHighlighting::Definition, Q_MOVABLE_TYPE); | 308 | Q_DECLARE_TYPEINFO(KSyntaxHighlighting::Definition, Q_MOVABLE_TYPE); | ||
271 | 309 | | |||
272 | #endif | 310 | #endif |