/usr/include/KF5/KSyntaxHighlighting/definition.h is in libkf5syntaxhighlighting-dev 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | /*
Copyright (C) 2016 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KSYNTAXHIGHLIGHTING_DEFINITION_H
#define KSYNTAXHIGHLIGHTING_DEFINITION_H
#include "ksyntaxhighlighting_export.h"
#include <QTypeInfo>
#include <memory>
class QString;
class QStringList;
template <typename T> class QVector;
namespace KSyntaxHighlighting {
class Context;
class Format;
class KeywordList;
class DefinitionData;
/**
* Represents a syntax definition.
*
* @section def_intro Introduction to Definitions
*
* A Definition is the short term for a syntax highlighting definition. It
* typically is defined in terms of an XML syntax highlighting file, containing
* all information about a particular syntax highlighting. This includes the
* highlighting of keywords, information about code folding regions, and
* indentation preferences.
*
* @section def_info General Information
*
* Each Definition contains a non-translated unique name() and a section().
* In addition, for putting this information e.g. into menus, the functions
* translatedName() and translatedSection() are provided. However, if isHidden()
* returns @e true, the Definition should not be visible in the UI. The location
* of the Definition can be obtained through filePath(), which either is the
* location on disk or a path to a compiled-in Qt resource.
*
* The supported files of a Definition are defined by the list of extensions(),
* and additionally by the list of mimeTypes(). Note, that extensions() returns
* wildcards that need to be matched against the filename of the file that
* requires highlighting. If multiple Definition%s match the file, then the one
* with higher priority() wins.
*
* @see Repository
* @since 5.28
*/
class KSYNTAXHIGHLIGHTING_EXPORT Definition
{
public:
/**
* Default constructor, creating an empty (invalid) Definition instance.
* isValid() for this instance returns @e false.
*
* Use the Repository instead to obtain valid instances.
*/
Definition();
/**
* Copy constructor.
* Both this definition as well as @p other share the Definition data.
*/
Definition(const Definition &other);
/**
* Destructor.
*/
~Definition();
/**
* Assignment operator.
* Both this definition as well as @p rhs share the Definition data.
*/
Definition& operator=(const Definition &rhs);
/**
* Checks two definitions for equality.
*/
bool operator==(const Definition &other) const;
/**
* Checks two definitions for inequality.
*/
bool operator!=(const Definition &other) const;
/** Checks whether this object refers to a valid syntax definition. */
bool isValid() const;
/** Returns the full path to the definition XML file containing
* the syntax definition. Note that this can be a path to QRC content.
*/
QString filePath() const;
/** Name of the syntax.
* Used for internal references, prefer translatedName() for display.
*/
QString name() const;
/** Translated name for display. */
QString translatedName() const;
/** The group this syntax definition belongs to.
* For display, consider translatedSection().
*/
QString section() const;
/** Translated group name for display. */
QString translatedSection() const;
/** Mime types associated with this syntax definition. */
QVector<QString> mimeTypes() const;
/**
* File extensions associated with this syntax definition.
* The returned list contains wildcards.
*/
QVector<QString> extensions() const;
/** Returns the definition version. */
int version() const;
/**
* Returns the definition priority.
* A Definition with higher priority wins over Definitions with lower priorities.
*/
int priority() const;
/** Returns @c true if this is an internal definition that should not be
* displayed to the user.
*/
bool isHidden() const;
/** Generalized language style, used for indentation. */
QString style() const;
/** Indentation style to be used for this syntax. */
QString indenter() const;
/** Name and email of the author of this syntax definition. */
QString author() const;
/** License of this syntax definition. */
QString license() const;
/**
* Returns whether indentation-based folding is enabled.
* An example for indentation-based folding is Python.
* When indentation-based folding is enabled, make sure to also check
* foldingIgnoreList() for lines that should be treated as empty.
*
* @see foldingIgnoreList(), State::indentationBasedFoldingEnabled()
*/
bool indentationBasedFoldingEnabled() const;
/**
* If indentationBasedFoldingEnabled() returns @c true, this function returns
* a list of regular expressions that represent empty lines. That is, all
* lines matching entirely one of the regular expressions should be treated
* as empty lines when calculating the indentation-based folding ranges.
*
* @note This list is only of relevance, if indentationBasedFoldingEnabled()
* returns @c true.
*
* @see indentationBasedFoldingEnabled()
*/
QStringList foldingIgnoreList() const;
private:
friend class DefinitionData;
friend class DefinitionRef;
explicit Definition(const std::shared_ptr<DefinitionData> &dd);
std::shared_ptr<DefinitionData> d;
};
}
Q_DECLARE_TYPEINFO(KSyntaxHighlighting::Definition, Q_MOVABLE_TYPE);
#endif
|