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::LineWriter Class Reference

#include <qqmldomlinewriter_p.h>

Inheritance diagram for QQmlJS::Dom::LineWriter:
Collaboration diagram for QQmlJS::Dom::LineWriter:

Public Types

enum class  TextAddType {
  Normal , Extra , Newline , NewlineSplit ,
  NewlineExtra , PartialCommit , Eof
}

Public Member Functions

 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
virtual void lineChanged ()
virtual void reindentAndSplit (const QString &eol, bool eof=false)
virtual void willCommit ()

Protected Member Functions

QString eolToWrite () const
SourceLocation currentSourceLocation () const
int column (int localIndex)
void textAddCallback (TextAddType t)

Protected Attributes

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

Detailed Description

Definition at line 110 of file qqmldomlinewriter_p.h.

Member Enumeration Documentation

◆ TextAddType

Enumerator
Normal 
Extra 
Newline 
NewlineSplit 
NewlineExtra 
PartialCommit 
Eof 

Definition at line 114 of file qqmldomlinewriter_p.h.

Constructor & Destructor Documentation

◆ LineWriter()

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

Definition at line 12 of file qqmldomlinewriter.cpp.

References LineWriter().

Referenced by LineWriter().

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

◆ ~LineWriter()

virtual QQmlJS::Dom::LineWriter::~LineWriter ( )
inlinevirtual

Definition at line 132 of file qqmldomlinewriter_p.h.

Member Function Documentation

◆ addInnerSink()

void QQmlJS::Dom::LineWriter::addInnerSink ( const SinkF & s)
inline

Definition at line 135 of file qqmldomlinewriter_p.h.

◆ addNewlinesAutospacerCallback()

int QQmlJS::Dom::LineWriter::addNewlinesAutospacerCallback ( int nLines)

Definition at line 188 of file qqmldomlinewriter.cpp.

References addTextAddCallback().

Here is the call graph for this function:

◆ addTextAddCallback()

int QQmlJS::Dom::LineWriter::addTextAddCallback ( std::function< bool(LineWriter &, TextAddType)> callback)

Definition at line 179 of file qqmldomlinewriter.cpp.

Referenced by addNewlinesAutospacerCallback().

Here is the caller graph for this function:

◆ column()

int QQmlJS::Dom::LineWriter::column ( int localIndex)
protected

Definition at line 265 of file qqmldomlinewriter.cpp.

References QQmlJS::Dom::IndentInfo::column.

Referenced by commitLine(), and setLineIndent().

Here is the caller graph for this function:

◆ commitLine()

void QQmlJS::Dom::LineWriter::commitLine ( const QString & eol,
TextAddType t = TextAddType::Normal,
int untilChar = -1 )

Definition at line 290 of file qqmldomlinewriter.cpp.

References column(), lineChanged(), m_columnNr, m_lineNr, m_lineUtf16Offset, m_utf16Offset, and willCommit().

Here is the call graph for this function:

◆ committedLocation()

SourceLocation QQmlJS::Dom::LineWriter::committedLocation ( ) const

Definition at line 174 of file qqmldomlinewriter.cpp.

References m_lineNr, m_lineUtf16Offset, and m_utf16Offset.

◆ counter()

quint32 QQmlJS::Dom::LineWriter::counter ( ) const
inline

Definition at line 151 of file qqmldomlinewriter_p.h.

◆ currentLine()

const QString & QQmlJS::Dom::LineWriter::currentLine ( ) const
inline

Definition at line 158 of file qqmldomlinewriter_p.h.

◆ currentSourceLocation()

SourceLocation QQmlJS::Dom::LineWriter::currentSourceLocation ( ) const
protected

Definition at line 259 of file qqmldomlinewriter.cpp.

◆ ensureNewline()

LineWriter & QQmlJS::Dom::LineWriter::ensureNewline ( int nNewlines = 1,
TextAddType t = TextAddType::Extra )

Definition at line 26 of file qqmldomlinewriter.cpp.

◆ ensureSemicolon()

LineWriter & QQmlJS::Dom::LineWriter::ensureSemicolon ( TextAddType t = TextAddType::Extra)

Definition at line 49 of file qqmldomlinewriter.cpp.

◆ ensureSpace() [1/2]

LineWriter & QQmlJS::Dom::LineWriter::ensureSpace ( QStringView space,
TextAddType t = TextAddType::Extra )

Definition at line 56 of file qqmldomlinewriter.cpp.

References QQmlJS::Dom::IndentInfo::column, lineChanged(), and m_currentColumnNr.

Here is the call graph for this function:

◆ ensureSpace() [2/2]

LineWriter & QQmlJS::Dom::LineWriter::ensureSpace ( TextAddType t = TextAddType::Extra)

Definition at line 42 of file qqmldomlinewriter.cpp.

◆ eof()

void QQmlJS::Dom::LineWriter::eof ( bool ensureNewline = true)

Definition at line 167 of file qqmldomlinewriter.cpp.

Referenced by QQmlJS::Dom::MethodInfo::signature().

Here is the caller graph for this function:

◆ eolToWrite()

QString QQmlJS::Dom::LineWriter::eolToWrite ( ) const
protected

Definition at line 91 of file qqmldomlinewriter.cpp.

◆ fileName()

QString QQmlJS::Dom::LineWriter::fileName ( ) const
inline

Definition at line 157 of file qqmldomlinewriter_p.h.

◆ flush()

void QQmlJS::Dom::LineWriter::flush ( )

Definition at line 161 of file qqmldomlinewriter.cpp.

Referenced by testing.tools.encode_pdf_filter._SinkPdfStream::close().

Here is the caller graph for this function:

◆ handleTrailingSpace()

void QQmlJS::Dom::LineWriter::handleTrailingSpace ( LineWriterOptions::TrailingSpace s)

Definition at line 231 of file qqmldomlinewriter.cpp.

◆ innerSinks()

QList< SinkF > QQmlJS::Dom::LineWriter::innerSinks ( )
inline

Definition at line 134 of file qqmldomlinewriter_p.h.

◆ lineChanged()

virtual void QQmlJS::Dom::LineWriter::lineChanged ( )
inlinevirtual

Reimplemented in QQmlJS::Dom::IndentingLineWriter.

Definition at line 160 of file qqmldomlinewriter_p.h.

Referenced by commitLine(), ensureSpace(), setLineIndent(), and write().

Here is the caller graph for this function:

◆ newline()

LineWriter & QQmlJS::Dom::LineWriter::newline ( )
inline

Definition at line 141 of file qqmldomlinewriter_p.h.

◆ options()

const LineWriterOptions & QQmlJS::Dom::LineWriter::options ( ) const
inline

◆ reindentAndSplit()

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

Reimplemented in QQmlJS::Dom::IndentingLineWriter.

Definition at line 250 of file qqmldomlinewriter.cpp.

◆ removeTextAddCallback()

bool QQmlJS::Dom::LineWriter::removeTextAddCallback ( int i)
inline

Definition at line 153 of file qqmldomlinewriter_p.h.

◆ setLineIndent()

void QQmlJS::Dom::LineWriter::setLineIndent ( int indentAmount)

Definition at line 207 of file qqmldomlinewriter.cpp.

References column(), lineChanged(), and m_currentColumnNr.

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

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

◆ sink()

std::function< void(QStringView)> QQmlJS::Dom::LineWriter::sink ( )
inline

Definition at line 127 of file qqmldomlinewriter_p.h.

◆ textAddCallback()

void QQmlJS::Dom::LineWriter::textAddCallback ( LineWriter::TextAddType t)
protected

Definition at line 274 of file qqmldomlinewriter.cpp.

◆ willCommit()

virtual void QQmlJS::Dom::LineWriter::willCommit ( )
inlinevirtual

Reimplemented in QQmlJS::Dom::IndentingLineWriter.

Definition at line 162 of file qqmldomlinewriter_p.h.

Referenced by commitLine().

Here is the caller graph for this function:

◆ write()

LineWriter & QQmlJS::Dom::LineWriter::write ( QStringView v,
TextAddType tType = TextAddType::Normal )

Definition at line 111 of file qqmldomlinewriter.cpp.

References lineChanged().

Here is the call graph for this function:

Member Data Documentation

◆ m_columnNr

int QQmlJS::Dom::LineWriter::m_columnNr = 0
protected

◆ m_committedEmptyLines

quint32 QQmlJS::Dom::LineWriter::m_committedEmptyLines = 0x7FFFFFFF
protected

Definition at line 185 of file qqmldomlinewriter_p.h.

◆ m_counter

quint32 QQmlJS::Dom::LineWriter::m_counter = 0
protected

Definition at line 184 of file qqmldomlinewriter_p.h.

◆ m_currentColumnNr

int QQmlJS::Dom::LineWriter::m_currentColumnNr = 0
protected

Definition at line 178 of file qqmldomlinewriter_p.h.

Referenced by ensureSpace(), and setLineIndent().

◆ m_currentLine

QString QQmlJS::Dom::LineWriter::m_currentLine
protected

Definition at line 180 of file qqmldomlinewriter_p.h.

◆ m_fileName

QString QQmlJS::Dom::LineWriter::m_fileName
protected

Definition at line 173 of file qqmldomlinewriter_p.h.

◆ m_innerSinks

QList<SinkF> QQmlJS::Dom::LineWriter::m_innerSinks
protected

Definition at line 172 of file qqmldomlinewriter_p.h.

◆ m_lastCallbackId

QAtomicInt QQmlJS::Dom::LineWriter::m_lastCallbackId
protected

Definition at line 182 of file qqmldomlinewriter_p.h.

◆ m_lineNr

int QQmlJS::Dom::LineWriter::m_lineNr = 0
protected

Definition at line 174 of file qqmldomlinewriter_p.h.

Referenced by commitLine(), and committedLocation().

◆ m_lineUtf16Offset

int QQmlJS::Dom::LineWriter::m_lineUtf16Offset = 0
protected

Definition at line 176 of file qqmldomlinewriter_p.h.

Referenced by commitLine(), and committedLocation().

◆ m_options

LineWriterOptions QQmlJS::Dom::LineWriter::m_options
protected

Definition at line 181 of file qqmldomlinewriter_p.h.

◆ m_reindent

bool QQmlJS::Dom::LineWriter::m_reindent = true
protected

◆ m_textAddCallbacks

QMap<int, std::function<bool(LineWriter &, TextAddType)> > QQmlJS::Dom::LineWriter::m_textAddCallbacks
protected

Definition at line 183 of file qqmldomlinewriter_p.h.

◆ m_utf16Offset

int QQmlJS::Dom::LineWriter::m_utf16Offset = 0
protected

Definition at line 179 of file qqmldomlinewriter_p.h.

Referenced by commitLine(), and committedLocation().


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