QCodeEdit  2.2
Public Types | Public Member Functions | List of all members
QLanguageDefinition Class Referenceabstract

Interface for language definition. More...

Inheritance diagram for QLanguageDefinition:
Inheritance graph
[legend]

Public Types

enum  CollapseFlag {
  None = 0x00000000, Collapsible = 0x10000000, Collapsed = 0x20000000, Closure = 0x40000000,
  CloseMask = 0x00fff000, OpenMask = 0x00000fff
}
 Collapse state of a line. More...
 

Public Member Functions

 Q_DECLARE_FLAGS (CollapseState, CollapseFlag)
 
 QLanguageDefinition ()
 Empty constructor.
 
virtual ~QLanguageDefinition ()
 Empty destructor.
 
virtual QString language () const =0
 
virtual QStringList extensions () const =0
 
virtual int tokenize (QDocument *d, int line, int count)
 Entry point for syntax highlighting.
 
virtual QString singleLineComment () const
 Return the string starting a single line comment, if any offered by the language.
 
virtual QString defaultLineMark () const
 Let language specify which line mark should be toggled by left clicking a line mark panel.
 
virtual void match (QDocumentCursor &c)
 Brace matching entry point.
 
virtual void clearMatches (QDocument *d)
 Brace matching entry point.
 
virtual QString indent (const QDocumentCursor &c)
 Return the indent to use when inserting a line at a given cursor position.
 
virtual bool unindent (const QDocumentCursor &c, const QString &ktxt)
 Determines whether the given key event at the given position should cause unindent to happen.
 
virtual void expand (QDocument *d, int line)
 Expand a collapsed block at a given line.
 
virtual void collapse (QDocument *d, int line)
 Collapse a text block at a given line.
 
virtual int blockFlags (QDocument *d, int line, int depth=0) const
 Compute the collapse state of a line.
 

Detailed Description

Interface for language definition.

This class is meant to be subclassed, see

See also
QGenericDefinition for more informations, and added to a QLanguageFactory.

A language definition is a wrapper that creates interfaces for a given file extension from internally handled data (XML files in the case of QGenericDefinition)

See also
QLanguageFactory

Member Enumeration Documentation

◆ CollapseFlag

Collapse state of a line.

Enumerator
None 

The line cannot be collapsed nor expanded.

Collapsible 

The line is expanded and can thus be collapsed.

Collapsed 

The line is collapsed and can thus be expanded.

Closure 

The line is expanded and mark the end of a block.

CloseMask 

Number of actual closing fold mark.

OpenMask 

Number of actual open fold mark.

Member Function Documentation

◆ extensions()

QLanguageDefinition::extensions ( ) const
pure virtual
Returns
the file extensions corrseponding to the supported language
See also
language()
QFileInfo::completeSuffix()

Implemented in QNFADefinition.

◆ language()

QLanguageDefinition::language ( ) const
pure virtual
Returns
The language supported by this definition

Implemented in QNFADefinition.


The documentation for this class was generated from the following files: