![]() |
Qt 6.x
The Qt SDK
|
#include <qqmldomlinewriter_p.h>
Public Types | |
enum class | TextAddType { Normal , Extra , Newline , NewlineSplit , NewlineExtra , PartialCommit , Eof } |
Protected Member Functions | |
void | changeAtOffset (quint32 offset, qint32 change, qint32 colChange, qint32 lineChange) |
QString | eolToWrite () const |
SourceLocation | currentSourceLocation () const |
int | column (int localIndex) |
void | textAddCallback (TextAddType t) |
Protected Attributes | |
QList< SinkF > | m_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 |
PendingSourceLocationId | m_lastSourceLocationId |
QMap< PendingSourceLocationId, PendingSourceLocation > | m_pendingSourceLocations |
QAtomicInt | m_lastCallbackId |
QMap< int, std::function< bool(LineWriter &, TextAddType)> > | m_textAddCallbacks |
quint32 | m_counter = 0 |
quint32 | m_committedEmptyLines = 0x7FFFFFFF |
bool | m_reindent = true |
Definition at line 121 of file qqmldomlinewriter_p.h.
|
strong |
Enumerator | |
---|---|
Normal | |
Extra | |
Newline | |
NewlineSplit | |
NewlineExtra | |
PartialCommit | |
Eof |
Definition at line 125 of file qqmldomlinewriter_p.h.
QQmlJS::Dom::LineWriter::LineWriter | ( | SinkF | innerSink, |
QString | fileName, | ||
const LineWriterOptions & | options = LineWriterOptions() , |
||
int | lineNr = 0 , |
||
int | columnNr = 0 , |
||
int | utf16Offset = 0 , |
||
QString | currentLine = QString() |
||
) |
Definition at line 53 of file qqmldomlinewriter.cpp.
|
inlinevirtual |
Definition at line 143 of file qqmldomlinewriter_p.h.
Definition at line 146 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::OutWriter::OutWriter().
int QQmlJS::Dom::LineWriter::addNewlinesAutospacerCallback | ( | int | nLines | ) |
Definition at line 257 of file qqmldomlinewriter.cpp.
References addTextAddCallback(), Extra, QString::isEmpty(), QStringView::isEmpty(), Normal, and QStringView::trimmed().
Referenced by QQmlJS::Dom::OutWriter::addNewlinesAutospacerCallback().
int QQmlJS::Dom::LineWriter::addTextAddCallback | ( | std::function< bool(LineWriter &, TextAddType)> | callback | ) |
Definition at line 248 of file qqmldomlinewriter.cpp.
References m_lastCallbackId, m_textAddCallbacks, nextId, and Q_ASSERT.
Referenced by QQmlJS::Dom::OutWriter::OutWriter(), addNewlinesAutospacerCallback(), and QQmlJS::Dom::OutWriter::addTextAddCallback().
|
protected |
Definition at line 338 of file qqmldomlinewriter.cpp.
References i, and m_pendingSourceLocations.
Referenced by commitLine(), ensureSpace(), handleTrailingSpace(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and setLineIndent().
|
protected |
Definition at line 348 of file qqmldomlinewriter.cpp.
References QQmlJS::Dom::IndentInfo::column, QQmlJS::Dom::LineWriterOptions::formatOptions, m_columnNr, m_currentLine, m_options, QString::size(), and QQmlJS::Dom::FormatOptions::tabSize.
void QQmlJS::Dom::LineWriter::commitLine | ( | QString | eol, |
TextAddType | t = TextAddType::Normal , |
||
int | untilChar = -1 |
||
) |
Definition at line 373 of file qqmldomlinewriter.cpp.
References changeAtOffset(), QString::clear(), Eof, Extra, i, QString::isEmpty(), QStringView::isEmpty(), lineChanged(), m_columnNr, m_committedEmptyLines, m_currentColumnNr, m_currentLine, m_innerSinks, m_lineNr, m_lineUtf16Offset, m_pendingSourceLocations, m_utf16Offset, QStringView::mid(), QString::mid(), Newline, NewlineExtra, NewlineSplit, Normal, PartialCommit, sink(), QString::size(), textAddCallback(), QStringView::trimmed(), and willCommit().
Referenced by flush(), reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
SourceLocation QQmlJS::Dom::LineWriter::committedLocation | ( | ) | const |
Definition at line 209 of file qqmldomlinewriter.cpp.
References m_lineNr, m_lineUtf16Offset, and m_utf16Offset.
|
inline |
Definition at line 176 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::OutWriter::counter(), and ensureSpace().
|
inline |
Definition at line 183 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::OutWriter::OutWriter().
|
protected |
Definition at line 332 of file qqmldomlinewriter.cpp.
References m_currentLine, m_lineNr, m_lineUtf16Offset, m_utf16Offset, and QString::size().
Referenced by startSourceLocation(), and startSourceLocation().
void QQmlJS::Dom::LineWriter::endSourceLocation | ( | PendingSourceLocationId | slId | ) |
Definition at line 234 of file qqmldomlinewriter.cpp.
References m_currentLine, m_pendingSourceLocations, m_utf16Offset, qWarning, and QString::size().
Referenced by QQmlJS::Dom::OutWriter::regionEnd(), and QQmlJS::Dom::Comment::write().
LineWriter & QQmlJS::Dom::LineWriter::ensureNewline | ( | int | nNewlines = 1 , |
TextAddType | t = TextAddType::Extra |
||
) |
Definition at line 66 of file qqmldomlinewriter.cpp.
References i, QString::isEmpty(), m_committedEmptyLines, m_currentLine, QString::trimmed(), and write().
Referenced by QQmlJS::Dom::OutWriter::ensureNewline(), ensureSpace(), and eof().
LineWriter & QQmlJS::Dom::LineWriter::ensureSpace | ( | QStringView | space, |
TextAddType | t = TextAddType::Extra |
||
) |
Definition at line 89 of file qqmldomlinewriter.cpp.
References QString::at(), changeAtOffset(), QQmlJS::Dom::IndentInfo::column, counter(), ensureNewline(), QQmlJS::Dom::LineWriterOptions::formatOptions, i, QString::isEmpty(), QChar::isSpace(), lineChanged(), m_columnNr, m_currentColumnNr, m_currentLine, m_options, QStringView::mid(), QQmlJS::Dom::IndentInfo::nNewlines, QStringLiteral, QString::replace(), QString::size(), QStringView::size(), space(), QQmlJS::Dom::FormatOptions::tabSize, QStringView::toString(), QQmlJS::Dom::IndentInfo::trailingString, and write().
LineWriter & QQmlJS::Dom::LineWriter::ensureSpace | ( | TextAddType | t = TextAddType::Extra | ) |
Definition at line 82 of file qqmldomlinewriter.cpp.
References QString::at(), QString::isEmpty(), QChar::isSpace(), m_currentLine, QString::size(), and write().
Referenced by QQmlJS::Dom::OutWriter::ensureSpace(), and QQmlJS::Dom::OutWriter::ensureSpace().
void QQmlJS::Dom::LineWriter::eof | ( | bool | ensureNewline = true | ) |
Definition at line 202 of file qqmldomlinewriter.cpp.
References ensureNewline(), and reindentAndSplit().
Referenced by QQmlJS::Dom::OutWriter::eof(), reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
|
protected |
Definition at line 126 of file qqmldomlinewriter.cpp.
References QQmlJS::Dom::LineWriterOptions::lineEndings, m_options, QQmlJS::Dom::LineWriterOptions::OldMacOs, Q_ASSERT, QStringLiteral, QQmlJS::Dom::LineWriterOptions::Unix, and QQmlJS::Dom::LineWriterOptions::Windows.
Referenced by QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and write().
|
inline |
Definition at line 182 of file qqmldomlinewriter_p.h.
void QQmlJS::Dom::LineWriter::flush | ( | ) |
Definition at line 196 of file qqmldomlinewriter.cpp.
References commitLine(), m_currentLine, and QString::size().
Referenced by QQmlJS::Dom::OutWriter::flush().
void QQmlJS::Dom::LineWriter::handleTrailingSpace | ( | LineWriterOptions::TrailingSpace | s | ) |
Definition at line 302 of file qqmldomlinewriter.cpp.
References QString::at(), changeAtOffset(), QChar::isSpace(), lineChanged(), m_currentColumnNr, m_currentLine, m_utf16Offset, QString::mid(), QQmlJS::Dom::LineWriterOptions::Preserve, QQmlJS::Dom::LineWriterOptions::Remove, and QString::size().
Referenced by reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
Definition at line 145 of file qqmldomlinewriter_p.h.
|
inlinevirtual |
Reimplemented in QQmlJS::Dom::IndentingLineWriter.
Definition at line 185 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), ensureSpace(), handleTrailingSpace(), setLineIndent(), and write().
|
inline |
Definition at line 151 of file qqmldomlinewriter_p.h.
References write().
Referenced by QQmlJS::Dom::OutWriter::newline().
|
inline |
Definition at line 184 of file qqmldomlinewriter_p.h.
References m_options.
Referenced by QQmlJS::Dom::OutWriter::decreaseIndent(), QQmlJS::Dom::OutWriter::increaseIndent(), QQmlJS::Dom::OutWriter::itemStart(), QQmlJS::Dom::OutWriter::regionEnd(), and QQmlJS::Dom::OutWriter::regionStart().
Reimplemented in QQmlJS::Dom::IndentingLineWriter.
Definition at line 323 of file qqmldomlinewriter.cpp.
References QQmlJS::Dom::LineWriterOptions::codeTrailingSpace, commitLine(), eof(), handleTrailingSpace(), QString::isEmpty(), and m_options.
Referenced by eof(), and write().
|
inline |
Definition at line 178 of file qqmldomlinewriter_p.h.
References i.
Referenced by QQmlJS::Dom::OutWriter::removeTextAddCallback().
void QQmlJS::Dom::LineWriter::setLineIndent | ( | int | indentAmount | ) |
Definition at line 276 of file qqmldomlinewriter.cpp.
References QString::at(), changeAtOffset(), QQmlJS::Dom::LineWriterOptions::formatOptions, QChar::isSpace(), lineChanged(), m_currentColumnNr, m_currentLine, m_options, m_utf16Offset, QString::mid(), QStringLiteral, QString::size(), QQmlJS::Dom::FormatOptions::tabSize, and QQmlJS::Dom::FormatOptions::useTabs.
Referenced by QQmlJS::Dom::OutWriter::OutWriter(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
|
inline |
Definition at line 138 of file qqmldomlinewriter_p.h.
References write().
Referenced by commitLine().
|
inline |
Definition at line 156 of file qqmldomlinewriter_p.h.
References write().
Referenced by ensureSpace(), and QQmlJS::Dom::OutWriter::space().
PendingSourceLocationId QQmlJS::Dom::LineWriter::startSourceLocation | ( | SourceLocation * | toUpdate | ) |
Definition at line 214 of file qqmldomlinewriter.cpp.
References currentSourceLocation(), m_lastSourceLocationId, and m_pendingSourceLocations.
Referenced by QQmlJS::Dom::OutWriter::itemStart(), QQmlJS::Dom::OutWriter::regionStart(), and QQmlJS::Dom::Comment::write().
PendingSourceLocationId QQmlJS::Dom::LineWriter::startSourceLocation | ( | std::function< void(SourceLocation)> | updater | ) |
Definition at line 224 of file qqmldomlinewriter.cpp.
References currentSourceLocation(), m_lastSourceLocationId, and m_pendingSourceLocations.
|
protected |
Definition at line 357 of file qqmldomlinewriter.cpp.
References it, and m_textAddCallbacks.
Referenced by commitLine(), and write().
|
inlinevirtual |
Reimplemented in QQmlJS::Dom::IndentingLineWriter.
Definition at line 187 of file qqmldomlinewriter_p.h.
Referenced by commitLine().
|
inline |
Definition at line 162 of file qqmldomlinewriter_p.h.
References write().
LineWriter & QQmlJS::Dom::LineWriter::write | ( | QStringView | v, |
TextAddType | tType = TextAddType::Normal |
||
) |
Definition at line 146 of file qqmldomlinewriter.cpp.
References QString::append(), QQmlJS::Dom::IndentInfo::column, eolToWrite(), QQmlJS::Dom::LineWriterOptions::formatOptions, i, QString::isEmpty(), QStringView::isEmpty(), lineChanged(), m_counter, m_currentColumnNr, m_currentLine, m_options, QQmlJS::Dom::matchHelper(), QQmlJS::Dom::LineWriterOptions::maxLineLength, QStringView::mid(), reindentAndSplit(), QQmlJS::Dom::FormatOptions::tabSize, textAddCallback(), QStringView::trimmed(), and write().
Referenced by ensureNewline(), ensureSpace(), ensureSpace(), QQmlJS::Dom::OutWriter::write(), QQmlJS::Dom::OutWriter::write(), write(), and QQmlJS::Dom::OutWriter::writeRegion().
|
protected |
Definition at line 201 of file qqmldomlinewriter_p.h.
Referenced by column(), commitLine(), ensureSpace(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
|
protected |
Definition at line 213 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), and ensureNewline().
|
protected |
Definition at line 212 of file qqmldomlinewriter_p.h.
Referenced by write().
|
protected |
Definition at line 204 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), ensureSpace(), handleTrailingSpace(), setLineIndent(), and write().
|
protected |
Definition at line 206 of file qqmldomlinewriter_p.h.
Referenced by column(), commitLine(), currentSourceLocation(), endSourceLocation(), ensureNewline(), ensureSpace(), ensureSpace(), flush(), QQmlJS::Dom::IndentingLineWriter::fStatus(), handleTrailingSpace(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), setLineIndent(), and write().
|
protected |
Definition at line 199 of file qqmldomlinewriter_p.h.
Definition at line 198 of file qqmldomlinewriter_p.h.
Referenced by commitLine().
|
protected |
Definition at line 210 of file qqmldomlinewriter_p.h.
Referenced by addTextAddCallback().
|
protected |
Definition at line 208 of file qqmldomlinewriter_p.h.
Referenced by startSourceLocation(), and startSourceLocation().
|
protected |
Definition at line 200 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), committedLocation(), and currentSourceLocation().
|
protected |
Definition at line 202 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), committedLocation(), and currentSourceLocation().
|
protected |
Definition at line 207 of file qqmldomlinewriter_p.h.
Referenced by column(), ensureSpace(), eolToWrite(), QQmlJS::Dom::IndentingLineWriter::fStatus(), reindentAndSplit(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), setLineIndent(), and write().
|
protected |
Definition at line 209 of file qqmldomlinewriter_p.h.
Referenced by changeAtOffset(), commitLine(), endSourceLocation(), startSourceLocation(), and startSourceLocation().
|
protected |
Definition at line 214 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::IndentingLineWriter::reindent(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::setReindent().
|
protected |
Definition at line 211 of file qqmldomlinewriter_p.h.
Referenced by addTextAddCallback(), and textAddCallback().
|
protected |
Definition at line 205 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), committedLocation(), currentSourceLocation(), endSourceLocation(), handleTrailingSpace(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and setLineIndent().