QCodeEdit
2.2
|
A class managing language definitions. More...
Classes | |
struct | LangData |
Public Member Functions | |
QFormatScheme * | defaultFormatScheme () const |
QLanguageFactory (QFormatScheme *fmt, QObject *p=0) | |
Empty constructor. | |
virtual | ~QLanguageFactory () |
Empty destructor. | |
QStringList | languages () const |
QStringList | fileFilters () const |
const LangData & | languageData (const QString &lang) |
Lookup language data for a matching language. | |
void | addDefinitionPath (const QString &path) |
Fetches syntax definitions from files in path. | |
void | addLanguage (const LangData &d) |
Adds a language to the factory. | |
void | addLanguageDefinition (QLanguageDefinition *l) |
Registers a new completion engine. | |
void | addCompletionEngine (QCodeCompletionEngine *e) |
Registers a new completion engine. | |
virtual void | setLanguage (QEditor *e, const QString &f) |
A class managing language definitions.
It stores language definitions, added programmatically or found in XML files, in specified locations and only if generic components are built-in. From these definitions, QLanguageFactory generates matchers, indenters and highlighters for a text editor, according to a file name.
|
slot |
Registers a new completion engine.
|
slot |
Adds a language to the factory.
d | language data |
Referenced by addDefinitionPath().
|
slot |
Registers a new completion engine.
QStringList QLanguageFactory::fileFilters | ( | ) | const |
const QLanguageFactory::LangData & QLanguageFactory::languageData | ( | const QString & | lang | ) |
Lookup language data for a matching language.
The primary purpose of this function is to make it easy to create configuration dialogs (mainly for format schemes). Beware though : some language may use the default format scheme. It is recommended to check for that before modifying a format scheme or users might be surprised...
QStringList QLanguageFactory::languages | ( | ) | const |
|
virtualslot |
e | target editor |
file | filename displayed by the editor |
The file parameter may actuall be either a filename, an extension or the name of the language, checked in that order.
If it is a filename, complete extension as higher priority than simple extension (see QFileInfo suffix() and completeSuffix()).
Matches are first done case-sensitively.
If no matching language definition is found for all three possible interpretations of the file parameter, the same search is done case-insensitively.
If no matching language is found the previous language definition/completion engine of the editor are removed, leaving it blank, and the format scheme of the document is set to the defaultFormatScheme()
References QEditor::document(), QEditor::highlight(), QEditor::languageDefinition(), QEditor::setCompletionEngine(), QDocument::setFormatScheme(), and QEditor::setLanguageDefinition().