Extending Qt Creator Manual | CodeFormatter

Extending Qt Creator Manual 4.5.2

# CodeFormatter Class

(QmlJS::CodeFormatter)

- List of all members, including inherited members

## Public Types

enum | StateType { invalid, topmost_intro, top_qml, top_js, ..., case_cont }

## Public Functions

| CodeFormatter()
virtual | ~CodeFormatter()
int | indentFor(const QTextBlock &block)
int | indentForNewLineAfter(const QTextBlock &block)
void | invalidateCache(QTextDocument *document)
void | setTabSize(int tabSize)
void | updateLineStateChange(const QTextBlock &block)
void | updateStateUntil(const QTextBlock &block)

## Protected Types

class | BlockData
class | State
enum | TokenKind { EndOfFile, Keyword, Identifier, String, ..., MinusMinus }

## Protected Functions

virtual void | adjustIndent(const QList<Token> &tokens, int startLexerState, int *indentDepth) const = 0
int | column(int position) const
const Token & | currentToken() const
void | dump() const
TokenKind | extendedTokenKind(const QmlJS::Token &token) const
bool | isBracelessState(int type) const
bool | isExpressionEndState(int type) const
virtual bool | loadBlockData(const QTextBlock &block, BlockData *data) const = 0
virtual int | loadLexerState(const QTextBlock &block) const = 0
const QVector<State> & | newStatesThisLine() const
virtual void | onEnter(int newState, int *indentDepth, int *savedIndentDepth) const = 0
virtual void | saveBlockData(QTextBlock *block, const BlockData &data) const = 0
virtual void | saveLexerState(QTextBlock *block, int state) const = 0
State | state(int belowTop = 0) const
QString | stateToString(int type) const
const Token & | tokenAt(int idx) const
int | tokenCount() const
int | tokenIndex() const

## Member Type Documentation

### enum CodeFormatter::StateType

### enum CodeFormatter::TokenKind

## Member Function Documentation

### CodeFormatter::CodeFormatter()

Default constructs an instance of CodeFormatter.

### `[virtual]` CodeFormatter::~CodeFormatter()

Destroys the instance of CodeFormatter. The destructor is virtual.

### `[pure virtual protected]` void CodeFormatter::adjustIndent(const QList<Token> &tokens, int startLexerState, int *indentDepth) const

### `[protected]` int CodeFormatter::column(int position) const

### `[protected]` const Token &CodeFormatter::currentToken() const

### `[protected]` void CodeFormatter::dump() const

### `[protected]` TokenKind CodeFormatter::extendedTokenKind(const QmlJS::Token &token) const

### int CodeFormatter::indentFor(const QTextBlock &block)

### int CodeFormatter::indentForNewLineAfter(const QTextBlock &block)

### void CodeFormatter::invalidateCache(QTextDocument *document)

### `[protected]` bool CodeFormatter::isBracelessState(int type) const

### `[protected]` bool CodeFormatter::isExpressionEndState(int type) const

### `[pure virtual protected]` bool CodeFormatter::loadBlockData(const QTextBlock &block, BlockData *data) const

### `[pure virtual protected]` int CodeFormatter::loadLexerState(const QTextBlock &block) const

### `[protected]` const QVector<State> &CodeFormatter::newStatesThisLine() const

### `[pure virtual protected]` void CodeFormatter::onEnter(int newState, int *indentDepth, int *savedIndentDepth) const

### `[pure virtual protected]` void CodeFormatter::saveBlockData(QTextBlock *block, const BlockData &data) const

### `[pure virtual protected]` void CodeFormatter::saveLexerState(QTextBlock *block, int state) const

### void CodeFormatter::setTabSize(int tabSize)

### `[protected]` State CodeFormatter::state(int belowTop = 0) const

### `[protected]` QString CodeFormatter::stateToString(int type) const

### `[protected]` const Token &CodeFormatter::tokenAt(int idx) const

### `[protected]` int CodeFormatter::tokenCount() const

### `[protected]` int CodeFormatter::tokenIndex() const

### void CodeFormatter::updateLineStateChange(const QTextBlock &block)

### void CodeFormatter::updateStateUntil(const QTextBlock &block)