Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJS::Dom::FormatPartialStatus Class Reference

#include <qqmldomcodeformatter_p.h>

+ Collaboration diagram for QQmlJS::Dom::FormatPartialStatus:

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
 
FormatPartialStatusoperator= (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 TokentokenAt (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< TokenlineTokens
 
int tokenIndex = 0
 

Detailed Description

Definition at line 203 of file qqmldomcodeformatter_p.h.

Member Typedef Documentation

◆ OnEnterCallback

Definition at line 208 of file qqmldomcodeformatter_p.h.

Constructor & Destructor Documentation

◆ FormatPartialStatus() [1/3]

QQmlJS::Dom::FormatPartialStatus::FormatPartialStatus ( )
default

◆ FormatPartialStatus() [2/3]

QQmlJS::Dom::FormatPartialStatus::FormatPartialStatus ( const FormatPartialStatus o)
default

◆ FormatPartialStatus() [3/3]

QQmlJS::Dom::FormatPartialStatus::FormatPartialStatus ( QStringView  line,
const FormatOptions options,
const FormatTextStatus initialStatus 
)
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().

+ Here is the call graph for this function:

Member Function Documentation

◆ column()

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.

+ Here is the call graph for this function:

◆ defaultOnEnter()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enterState()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleTokens()

◆ indentForNewLineAfter()

int QQmlJS::Dom::FormatPartialStatus::indentForNewLineAfter ( ) const

Definition at line 1168 of file qqmldomcodeformatter.cpp.

References currentIndent, currentStatus, QQmlJS::Dom::indentForLineStartingWithToken(), and options.

+ Here is the call graph for this function:

◆ indentLine()

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().

+ Here is the call graph for this function:

◆ leaveState()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

FormatPartialStatus & QQmlJS::Dom::FormatPartialStatus::operator= ( const FormatPartialStatus o)
default

◆ recalculateWithIndent()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tokenAt()

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().

+ Here is the caller graph for this function:

◆ tokenCount()

int QQmlJS::Dom::FormatPartialStatus::tokenCount ( ) const
inline

Definition at line 238 of file qqmldomcodeformatter_p.h.

Referenced by QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().

+ Here is the caller graph for this function:

◆ tokenText()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tryInsideExpression()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tryStatement()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ turnIntoState()

void QQmlJS::Dom::FormatPartialStatus::turnIntoState ( FormatTextStatus::StateType  newState)

Definition at line 83 of file qqmldomcodeformatter.cpp.

References enterState(), leaveState(), and newState().

Referenced by handleTokens().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ currentIndent

int QQmlJS::Dom::FormatPartialStatus::currentIndent = 0

◆ currentStatus

◆ indentOffset

int QQmlJS::Dom::FormatPartialStatus::indentOffset = 0

Definition at line 259 of file qqmldomcodeformatter_p.h.

Referenced by column(), and recalculateWithIndent().

◆ initialStatus

FormatTextStatus QQmlJS::Dom::FormatPartialStatus::initialStatus

Definition at line 257 of file qqmldomcodeformatter_p.h.

Referenced by indentLine(), and recalculateWithIndent().

◆ line

QStringView QQmlJS::Dom::FormatPartialStatus::line

Definition at line 255 of file qqmldomcodeformatter_p.h.

Referenced by column(), handleTokens(), recalculateWithIndent(), and tokenText().

◆ lineTokens

QList<Token> QQmlJS::Dom::FormatPartialStatus::lineTokens

◆ options

FormatOptions QQmlJS::Dom::FormatPartialStatus::options

◆ tokenIndex

int QQmlJS::Dom::FormatPartialStatus::tokenIndex = 0

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