Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmlJS::Dom::IndentingLineWriter Class Reference

#include <qqmldomindentinglinewriter_p.h>

Inheritance diagram for QQmlJS::Dom::IndentingLineWriter:
Collaboration diagram for QQmlJS::Dom::IndentingLineWriter:

Public Member Functions

 IndentingLineWriter (const SinkF &innerSink, const QString &fileName, const LineWriterOptions &options=LineWriterOptions(), const FormatTextStatus &initialStatus=FormatTextStatus::initialStatus(), int lineNr=0, int columnNr=0, int utf16Offset=0, QString currentLine=QString())
void reindentAndSplit (const QString &eol, bool eof=false) override
void handleTrailingSpace ()
FormatPartialStatusfStatus ()
void lineChanged () override
void willCommit () override
bool reindent () const
void setReindent (bool v)
void splitOnMaxLength (const QString &eol, bool eof)
Public Member Functions inherited from QQmlJS::Dom::LineWriter
 LineWriter (const SinkF &innerSink, const QString &fileName, const LineWriterOptions &options=LineWriterOptions(), int lineNr=0, int columnNr=0, int utf16Offset=0, const QString &currentLine=QString())
std::function< void(QStringView)> sink ()
virtual ~LineWriter ()
QList< SinkFinnerSinks ()
void addInnerSink (const SinkF &s)
LineWriterensureNewline (int nNewlines=1, TextAddType t=TextAddType::Extra)
LineWriterensureSpace (TextAddType t=TextAddType::Extra)
LineWriterensureSpace (QStringView space, TextAddType t=TextAddType::Extra)
LineWriterensureSemicolon (TextAddType t=TextAddType::Extra)
LineWriternewline ()
LineWriterwrite (QStringView v, TextAddType tType=TextAddType::Normal)
void commitLine (const QString &eol, TextAddType t=TextAddType::Normal, int untilChar=-1)
void flush ()
void eof (bool ensureNewline=true)
SourceLocation committedLocation () const
quint32 counter () const
int addTextAddCallback (std::function< bool(LineWriter &, TextAddType)> callback)
bool removeTextAddCallback (int i)
int addNewlinesAutospacerCallback (int nLines)
void handleTrailingSpace (LineWriterOptions::TrailingSpace s)
void setLineIndent (int indentAmount)
QString fileName () const
const QStringcurrentLine () const
const LineWriterOptionsoptions () const

Protected Attributes

FormatTextStatus m_preCachedStatus
bool m_fStatusValid = false
FormatPartialStatus m_fStatus
Protected Attributes inherited from QQmlJS::Dom::LineWriter
QList< SinkFm_innerSinks
QString m_fileName
int m_lineNr = 0
int m_columnNr = 0
int m_lineUtf16Offset = 0
int m_currentColumnNr = 0
int m_utf16Offset = 0
QString m_currentLine
LineWriterOptions m_options
QAtomicInt m_lastCallbackId
QMap< int, std::function< bool(LineWriter &, TextAddType)> > m_textAddCallbacks
quint32 m_counter = 0
quint32 m_committedEmptyLines = 0x7FFFFFFF
bool m_reindent = true

Additional Inherited Members

Public Types inherited from QQmlJS::Dom::LineWriter
enum class  TextAddType {
  Normal , Extra , Newline , NewlineSplit ,
  NewlineExtra , PartialCommit , Eof
}
Protected Member Functions inherited from QQmlJS::Dom::LineWriter
QString eolToWrite () const
SourceLocation currentSourceLocation () const
int column (int localIndex)
void textAddCallback (TextAddType t)

Detailed Description

Definition at line 30 of file qqmldomindentinglinewriter_p.h.

Constructor & Destructor Documentation

◆ IndentingLineWriter()

QQmlJS::Dom::IndentingLineWriter::IndentingLineWriter ( const SinkF & innerSink,
const QString & fileName,
const LineWriterOptions & options = LineWriterOptions(),
const FormatTextStatus & initialStatus = FormatTextStatus::initialStatus(),
int lineNr = 0,
int columnNr = 0,
int utf16Offset = 0,
QString currentLine = QString() )
inline

Definition at line 34 of file qqmldomindentinglinewriter_p.h.

Member Function Documentation

◆ fStatus()

FormatPartialStatus & QQmlJS::Dom::IndentingLineWriter::fStatus ( )

Definition at line 31 of file qqmldomindentinglinewriter.cpp.

References m_fStatusValid.

Referenced by handleTrailingSpace(), reindentAndSplit(), and splitOnMaxLength().

Here is the caller graph for this function:

◆ handleTrailingSpace()

void QQmlJS::Dom::IndentingLineWriter::handleTrailingSpace ( )

Definition at line 63 of file qqmldomindentinglinewriter.cpp.

References fStatus(), QQmlJS::Dom::Scanner::State::isMultiline(), QQmlJS::Dom::Scanner::State::isMultilineComment(), and QQmlJS::Dom::Token::lexKindIsComment().

Referenced by reindentAndSplit().

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

◆ lineChanged()

void QQmlJS::Dom::IndentingLineWriter::lineChanged ( )
inlineoverridevirtual

Reimplemented from QQmlJS::Dom::LineWriter.

Definition at line 47 of file qqmldomindentinglinewriter_p.h.

References m_fStatusValid.

Referenced by splitOnMaxLength().

Here is the caller graph for this function:

◆ reindent()

bool QQmlJS::Dom::IndentingLineWriter::reindent ( ) const
inline

◆ reindentAndSplit()

void QQmlJS::Dom::IndentingLineWriter::reindentAndSplit ( const QString & eol,
bool eof = false )
overridevirtual

Reimplemented from QQmlJS::Dom::LineWriter.

Definition at line 45 of file qqmldomindentinglinewriter.cpp.

References fStatus(), handleTrailingSpace(), QQmlJS::Dom::FormatPartialStatus::indentLine(), QQmlJS::Dom::LineWriter::m_columnNr, QQmlJS::Dom::LineWriter::m_reindent, and QQmlJS::Dom::LineWriter::setLineIndent().

Here is the call graph for this function:

◆ setReindent()

void QQmlJS::Dom::IndentingLineWriter::setReindent ( bool v)
inline

Definition at line 50 of file qqmldomindentinglinewriter_p.h.

References QQmlJS::Dom::LineWriter::m_reindent.

Referenced by splitOnMaxLength().

Here is the caller graph for this function:

◆ splitOnMaxLength()

void QQmlJS::Dom::IndentingLineWriter::splitOnMaxLength ( const QString & eol,
bool eof )

Definition at line 126 of file qqmldomindentinglinewriter.cpp.

References fStatus(), lineChanged(), and setReindent().

Here is the call graph for this function:

◆ willCommit()

void QQmlJS::Dom::IndentingLineWriter::willCommit ( )
overridevirtual

Reimplemented from QQmlJS::Dom::LineWriter.

Definition at line 40 of file qqmldomindentinglinewriter.cpp.

Member Data Documentation

◆ m_fStatus

FormatPartialStatus QQmlJS::Dom::IndentingLineWriter::m_fStatus
protected

Definition at line 60 of file qqmldomindentinglinewriter_p.h.

◆ m_fStatusValid

bool QQmlJS::Dom::IndentingLineWriter::m_fStatusValid = false
protected

Definition at line 59 of file qqmldomindentinglinewriter_p.h.

Referenced by fStatus(), and lineChanged().

◆ m_preCachedStatus

FormatTextStatus QQmlJS::Dom::IndentingLineWriter::m_preCachedStatus
protected

Definition at line 58 of file qqmldomindentinglinewriter_p.h.


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