![]() |
Qt 6.x
The Qt SDK
|
#include <qqmldomcodeformatter_p.h>
Public Types | |
using | OnEnterCallback = function_ref< void(FormatTextStatus::StateType newState, int *indentDepth, int *savedIndentDepth, const FormatPartialStatus &fStatus)> |
Public Member Functions | |
FormatPartialStatus ()=default | |
FormatPartialStatus (const FormatPartialStatus &o)=default | |
FormatPartialStatus & | operator= (const FormatPartialStatus &o)=default |
FormatPartialStatus (QStringView line, const FormatOptions &options, const FormatTextStatus &initialStatus) | |
void | enterState (FormatTextStatus::StateType newState) |
void | leaveState (bool statementDone) |
void | turnIntoState (FormatTextStatus::StateType newState) |
const Token & | tokenAt (int idx) const |
int | tokenCount () const |
int | column (int index) const |
QStringView | tokenText (const Token &token) const |
void | handleTokens () |
bool | tryInsideExpression (bool alsoExpression) |
bool | tryStatement () |
void | defaultOnEnter (FormatTextStatus::StateType newState, int *indentDepth, int *savedIndentDepth) const |
int | indentLine () |
int | indentForNewLineAfter () const |
void | recalculateWithIndent (int indent) |
void | dump () const |
Public Attributes | |
QStringView | line |
FormatOptions | options |
FormatTextStatus | initialStatus |
FormatTextStatus | currentStatus |
int | indentOffset = 0 |
int | currentIndent = 0 |
QList< Token > | lineTokens |
int | tokenIndex = 0 |
Definition at line 203 of file qqmldomcodeformatter_p.h.
using QQmlJS::Dom::FormatPartialStatus::OnEnterCallback = function_ref<void(FormatTextStatus::StateType newState, int *indentDepth, int *savedIndentDepth, const FormatPartialStatus &fStatus)> |
Definition at line 208 of file qqmldomcodeformatter_p.h.
|
default |
|
default |
|
inline |
Definition at line 217 of file qqmldomcodeformatter_p.h.
References QQmlJS::Dom::FormatTextStatus::finalIndent, QQmlJS::Dom::FormatTextStatus::lexerState, line, and QQmlJS::Dom::Scanner::state().
int QQmlJS::Dom::FormatPartialStatus::column | ( | int | index | ) | const |
Definition at line 98 of file qqmldomcodeformatter.cpp.
References QQmlJS::Dom::IndentInfo::column, indentOffset, line, options, QStringView::size(), and QQmlJS::Dom::FormatOptions::tabSize.
void QQmlJS::Dom::FormatPartialStatus::defaultOnEnter | ( | FormatTextStatus::StateType | newState, |
int * | indentDepth, | ||
int * | savedIndentDepth | ||
) | const |
Definition at line 1204 of file qqmldomcodeformatter.cpp.
References QQmlJS::Dom::Token::begin(), begin(), currentStatus, i, QQmlJS::Dom::FormatOptions::indentSize, QQmlJS::Dom::FormatTextStatus::isBracelessState(), QQmlJS::Dom::FormatTextStatus::isExpressionEndState(), QQmlJS::Dom::Token::length, lineTokens, newState(), options, Q_FALLTHROUGH, QQmlJS::Dom::FormatTextStatus::State::savedIndentDepth, QQmlJS::Dom::FormatTextStatus::state(), tokenAt(), tokenIndex, and QQmlJS::Dom::FormatTextStatus::State::type.
Referenced by enterState().
void QQmlJS::Dom::FormatPartialStatus::dump | ( | ) | const |
Definition at line 223 of file qqmldomcodeformatter.cpp.
References currentIndent, currentStatus, QQmlJS::Dom::FormatTextStatus::lexerState, qCDebug, QQmlJS::Dom::Scanner::State::state, QQmlJS::Dom::FormatTextStatus::states, QQmlJS::Dom::FormatTextStatus::stateToString(), and tokenIndex.
Referenced by handleTokens().
void QQmlJS::Dom::FormatPartialStatus::enterState | ( | FormatTextStatus::StateType | newState | ) |
Definition at line 33 of file qqmldomcodeformatter.cpp.
References currentIndent, currentStatus, defaultOnEnter(), enterState(), newState(), QQmlJS::Dom::FormatTextStatus::pushState(), qCDebug, and QQmlJS::Dom::FormatTextStatus::stateToString().
Referenced by enterState(), handleTokens(), leaveState(), tryInsideExpression(), tryStatement(), and turnIntoState().
void QQmlJS::Dom::FormatPartialStatus::handleTokens | ( | ) |
Definition at line 234 of file qqmldomcodeformatter.cpp.
References QStringView::at(), QQmlJS::Dom::Token::begin(), currentIndent, currentStatus, dump(), enterState(), QQmlJS::Dom::FormatTextStatus::finalIndent, QQmlJS::Dom::Scanner::State::isMultiline(), QChar::isUpper(), leave, leaveState(), QQmlJS::Dom::FormatTextStatus::lexerState, QQmlJS::Dom::Token::lexKind, QQmlJS::Dom::Token::lexKindIsComment(), QQmlJS::Dom::Token::lexKindIsDelimiter(), QQmlJS::Dom::Token::lexKindIsIdentifier(), line, lineTokens, newState(), Q_ASSERT, Q_FALLTHROUGH, qCDebug, qWarning, QQmlJS::Dom::FormatTextStatus::state(), QQmlJS::Dom::Scanner::State::state, tokenAt(), tokenIndex, QQmlJS::Lexer::State::tokenKind, tokenText(), tryInsideExpression(), tryStatement(), turnIntoState(), QQmlJS::Dom::FormatTextStatus::State::type, and QQmlJS::Dom::FormatTextStatus::State::typeStr().
Referenced by QQmlJS::Dom::formatCodeLine(), and recalculateWithIndent().
int QQmlJS::Dom::FormatPartialStatus::indentForNewLineAfter | ( | ) | const |
Definition at line 1168 of file qqmldomcodeformatter.cpp.
References currentIndent, currentStatus, QQmlJS::Dom::indentForLineStartingWithToken(), and options.
int QQmlJS::Dom::FormatPartialStatus::indentLine | ( | ) |
Definition at line 1159 of file qqmldomcodeformatter.cpp.
References currentStatus, QQmlJS::Dom::indentForLineStartingWithToken(), initialStatus, QQmlJS::Dom::Token::lexKind, lineTokens, options, Q_ASSERT, recalculateWithIndent(), QQmlJS::Dom::FormatTextStatus::size(), and tokenAt().
void QQmlJS::Dom::FormatPartialStatus::leaveState | ( | bool | statementDone | ) |
Definition at line 44 of file qqmldomcodeformatter.cpp.
References currentIndent, currentStatus, enterState(), QQmlJS::Dom::FormatTextStatus::isExpressionEndState(), leaveState(), QQmlJS::Dom::FormatTextStatus::popState(), Q_ASSERT, qCDebug, QQmlJS::Dom::FormatTextStatus::State::savedIndentDepth, QQmlJS::Dom::FormatTextStatus::size(), QQmlJS::Dom::FormatTextStatus::state(), QQmlJS::Dom::FormatTextStatus::stateToString(), and QQmlJS::Dom::FormatTextStatus::State::type.
Referenced by handleTokens(), leaveState(), tryStatement(), and turnIntoState().
|
default |
void QQmlJS::Dom::FormatPartialStatus::recalculateWithIndent | ( | int | indent | ) |
Definition at line 1177 of file qqmldomcodeformatter.cpp.
References QStringView::at(), currentIndent, currentStatus, QQmlJS::Dom::FormatTextStatus::finalIndent, handleTokens(), i, indentOffset, initialStatus, QChar::isSpace(), QQmlJS::Dom::FormatTextStatus::lexerState, line, QStringView::size(), and tokenIndex.
Referenced by indentLine().
const Token & QQmlJS::Dom::FormatPartialStatus::tokenAt | ( | int | idx | ) | const |
Definition at line 89 of file qqmldomcodeformatter.cpp.
References lineTokens.
Referenced by defaultOnEnter(), handleTokens(), indentLine(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), tryInsideExpression(), and tryStatement().
|
inline |
Definition at line 238 of file qqmldomcodeformatter_p.h.
Referenced by QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
QStringView QQmlJS::Dom::FormatPartialStatus::tokenText | ( | const Token & | token | ) | const |
Definition at line 106 of file qqmldomcodeformatter.cpp.
References line, QStringView::mid(), and token.
Referenced by handleTokens().
bool QQmlJS::Dom::FormatPartialStatus::tryInsideExpression | ( | bool | alsoExpression | ) |
Definition at line 111 of file qqmldomcodeformatter.cpp.
References enterState(), QQmlJS::Dom::Token::lexKind, newState(), tokenAt(), and tokenIndex.
Referenced by handleTokens().
bool QQmlJS::Dom::FormatPartialStatus::tryStatement | ( | ) |
Definition at line 143 of file qqmldomcodeformatter.cpp.
References enterState(), leaveState(), QQmlJS::Dom::Token::lexKindIsDelimiter(), QQmlJS::Dom::Token::lexKindIsIdentifier(), QQmlJS::Dom::Token::lexKindIsStringType(), tokenAt(), and tokenIndex.
Referenced by handleTokens().
void QQmlJS::Dom::FormatPartialStatus::turnIntoState | ( | FormatTextStatus::StateType | newState | ) |
Definition at line 83 of file qqmldomcodeformatter.cpp.
References enterState(), leaveState(), and newState().
Referenced by handleTokens().
int QQmlJS::Dom::FormatPartialStatus::currentIndent = 0 |
Definition at line 260 of file qqmldomcodeformatter_p.h.
Referenced by dump(), enterState(), handleTokens(), indentForNewLineAfter(), leaveState(), and recalculateWithIndent().
FormatTextStatus QQmlJS::Dom::FormatPartialStatus::currentStatus |
Definition at line 258 of file qqmldomcodeformatter_p.h.
Referenced by defaultOnEnter(), dump(), enterState(), handleTokens(), indentForNewLineAfter(), indentLine(), leaveState(), recalculateWithIndent(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::willCommit().
int QQmlJS::Dom::FormatPartialStatus::indentOffset = 0 |
Definition at line 259 of file qqmldomcodeformatter_p.h.
Referenced by column(), and recalculateWithIndent().
FormatTextStatus QQmlJS::Dom::FormatPartialStatus::initialStatus |
Definition at line 257 of file qqmldomcodeformatter_p.h.
Referenced by indentLine(), and recalculateWithIndent().
QStringView QQmlJS::Dom::FormatPartialStatus::line |
Definition at line 255 of file qqmldomcodeformatter_p.h.
Referenced by column(), handleTokens(), recalculateWithIndent(), and tokenText().
Definition at line 261 of file qqmldomcodeformatter_p.h.
Referenced by defaultOnEnter(), handleTokens(), indentLine(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and tokenAt().
FormatOptions QQmlJS::Dom::FormatPartialStatus::options |
Definition at line 256 of file qqmldomcodeformatter_p.h.
Referenced by column(), defaultOnEnter(), indentForNewLineAfter(), and indentLine().
int QQmlJS::Dom::FormatPartialStatus::tokenIndex = 0 |
Definition at line 262 of file qqmldomcodeformatter_p.h.
Referenced by defaultOnEnter(), dump(), handleTokens(), recalculateWithIndent(), tryInsideExpression(), and tryStatement().