# QsciLexerCPP Class Reference

The QsciLexerCPP class encapsulates the Scintilla C++ lexer. More...

`#include <qscilexercpp.h>`

Inherits QsciLexer.

Inherited by QsciLexerCSharp, QsciLexerIDL, QsciLexerJava, and QsciLexerJavaScript.

List of all members.

## Public Types

- enum {
  Default = 0, Comment = 1, CommentLine = 2,
  CommentDoc = 3, Number = 4, Keyword = 5,
  DoubleQuotedString = 6, SingleQuotedString = 7, UUID = 8,
  PreProcessor = 9, Operator = 10, Identifier = 11,
  UnclosedString = 12, VerbatimString = 13, Regex = 14,
  CommentLineDoc = 15, KeywordSet2 = 16, CommentDocKeyword = 17,
  CommentDocKeywordError = 18, GlobalClass = 19
  }

## Public Slots

- virtual void setFoldAtElse (bool fold)
- virtual void setFoldComments (bool fold)
- virtual void setFoldCompact (bool fold)
- virtual void setFoldPreprocessor (bool fold)
- virtual void setStylePreprocessor (bool style)

## Public Member Functions

- QsciLexerCPP (QObject *parent=0, bool caseInsensitiveKeywords=false)
- virtual ~QsciLexerCPP ()
- const char * language () const
- const char * lexer () const
- QStringList autoCompletionWordSeparators () const
- const char * blockEnd (int *style=0) const
- const char * blockStart (int *style=0) const
- const char * blockStartKeyword (int *style=0) const
- int braceStyle () const
- const char * wordCharacters () const
- QColor defaultColor (int style) const
- bool defaultEolFill (int style) const
- QFont defaultFont (int style) const
- QColor defaultPaper (int style) const
- const char * keywords (int set) const
- QString description (int style) const
- void refreshProperties ()
- bool foldAtElse () const
- bool foldComments () const
- bool foldCompact () const
- bool foldPreprocessor () const
- bool stylePreprocessor () const
- void setDollarsAllowed (bool allowed)
- bool dollarsAllowed () const

## Protected Member Functions

- bool readProperties (QSettings &qs, const QString &prefix)
- bool writeProperties (QSettings &qs, const QString &prefix) const

## Detailed Description

The QsciLexerCPP class encapsulates the Scintilla C++ lexer.

## Member Enumeration Documentation

anonymous enum

This enum defines the meanings of the different styles used by the C++ lexer.

Enumerator:

  Default | The default.
  Comment | A C comment.
  CommentLine | A C++ comment line.
  CommentDoc | A JavaDoc/Doxygen style C comment.
  Number | A number.
  Keyword | A keyword.
  DoubleQuotedString | A double-quoted string.
  SingleQuotedString | A single-quoted string.
  UUID | An IDL UUID.
  PreProcessor | A pre-processor block.
  Operator | An operator.
  Identifier | An identifier.
  UnclosedString | The end of a line where a string is not closed.
  VerbatimString | A C# verbatim string.
  Regex | A JavaScript regular expression.
  CommentLineDoc | A JavaDoc/Doxygen style C++ comment line.
  KeywordSet2 | A keyword defined in keyword set number 2. The class must be sub-classed and re-implement keywords() to make use of this style.
  CommentDocKeyword | A JavaDoc/Doxygen keyword.
  CommentDocKeywordError | A JavaDoc/Doxygen keyword error.
  GlobalClass | A global class or typedef defined in keyword set number 4. The class must be sub-classed and re-implement keywords() to make use of this style.

## Constructor & Destructor Documentation

QsciLexerCPP::QsciLexerCPP | ( | QObject * | parent = `0`,
|  | bool | caseInsensitiveKeywords = `false` |
| ) |  |  |

Construct a QsciLexerCPP with parent parent. parent is typically the QsciScintilla instance. caseInsensitiveKeywords is true if the lexer ignores the case of keywords.

## Member Function Documentation

const char* QsciLexerCPP::lexer | ( |  | ) | const`[virtual]`

Returns the name of the lexer. Some lexers support a number of languages.

Reimplemented from QsciLexer.

QColor QsciLexerCPP::defaultColor | ( | int | style | ) | const`[virtual]`

Returns the foreground colour of the text for style number style.

See also:
  defaultPaper()

Reimplemented from QsciLexer.

Reimplemented in QsciLexerCSharp, QsciLexerIDL, and QsciLexerJavaScript.

QColor QsciLexerCPP::defaultPaper | ( | int | style | ) | const`[virtual]`

Returns the background colour of the text for style number style.

See also:
  defaultColor()

Reimplemented from QsciLexer.

Reimplemented in QsciLexerCSharp, and QsciLexerJavaScript.

const char* QsciLexerCPP::keywords | ( | int | set | ) | const`[virtual]`

Returns the set of keywords for the keyword set set recognised by the lexer as a space separated string.

Reimplemented from QsciLexer.

Reimplemented in QsciLexerCSharp, QsciLexerIDL, QsciLexerJava, and QsciLexerJavaScript.

QString QsciLexerCPP::description | ( | int | style | ) | const`[virtual]`

Returns the descriptive name for style number style. If the style is invalid for this language then an empty QString is returned. This is intended to be used in user preference dialogs.

Implements QsciLexer.

Reimplemented in QsciLexerCSharp, QsciLexerIDL, and QsciLexerJavaScript.

void QsciLexerCPP::refreshProperties | ( |  | ) | `[virtual]`

Causes all properties to be refreshed by emitting the propertyChanged() signal as required.

Reimplemented from QsciLexer.

bool QsciLexerCPP::foldAtElse | ( |  | ) | const

Returns true if "} else {" lines can be folded.

See also:
  setFoldAtElse()

bool QsciLexerCPP::foldComments | ( |  | ) | const

Returns true if multi-line comment blocks can be folded.

See also:
  setFoldComments()

bool QsciLexerCPP::foldCompact | ( |  | ) | const

Returns true if trailing blank lines are included in a fold block.

See also:
  setFoldCompact()

bool QsciLexerCPP::foldPreprocessor | ( |  | ) | const

Returns true if preprocessor blocks can be folded.

See also:
  setFoldPreprocessor()

bool QsciLexerCPP::stylePreprocessor | ( |  | ) | const

Returns true if preprocessor lines (after the preprocessor directive) are styled.

See also:
  setStylePreprocessor()

void QsciLexerCPP::setDollarsAllowed | ( | bool | allowed | ) |

If allowed is true then '$' characters are allowed in identifier names. The default is true.

See also:
  dollarsAllowed()

bool QsciLexerCPP::dollarsAllowed | ( |  | ) | const

Returns true if '$' characters are allowed in identifier names.

See also:
  setDollarsAllowed()

virtual void QsciLexerCPP::setFoldAtElse | ( | bool | fold | ) | `[virtual, slot]`

If fold is true then "} else {" lines can be folded. The default is false.

See also:
  foldAtElse()

virtual void QsciLexerCPP::setFoldComments | ( | bool | fold | ) | `[virtual, slot]`

If fold is true then multi-line comment blocks can be folded. The default is false.

See also:
  foldComments()

virtual void QsciLexerCPP::setFoldCompact | ( | bool | fold | ) | `[virtual, slot]`

If fold is true then trailing blank lines are included in a fold block. The default is true.

See also:
  foldCompact()

virtual void QsciLexerCPP::setFoldPreprocessor | ( | bool | fold | ) | `[virtual, slot]`

If fold is true then preprocessor blocks can be folded. The default is true.

See also:
  foldPreprocessor()

virtual void QsciLexerCPP::setStylePreprocessor | ( | bool | style | ) | `[virtual, slot]`

If style is true then preprocessor lines (after the preprocessor directive) are styled. The default is false.

See also:
  stylePreprocessor()

bool QsciLexerCPP::readProperties | ( | QSettings & | qs,
|  | const QString & | prefix |
| ) |  |  | `[protected, virtual]`

The lexer's properties are read from the settings qs. prefix (which has a trailing '/') should be used as a prefix to the key of each setting. true is returned if there is no error.

See also:
  writeProperties()

Reimplemented from QsciLexer.

bool QsciLexerCPP::writeProperties | ( | QSettings & | qs,
|  | const QString & | prefix |
| ) |  |  | const`[protected, virtual]`

The lexer's properties are written to the settings qs. prefix (which has a trailing '/') should be used as a prefix to the key of each setting. true is returned if there is no error.

See also:
  readProperties()

Reimplemented from QsciLexer.