Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
#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 |
PendingSourceLocationIdAtomic | 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 126 of file qqmldomlinewriter_p.h.
|
strong |
Enumerator | |
---|---|
Normal | |
Extra | |
Newline | |
NewlineSplit | |
NewlineExtra | |
PartialCommit | |
Eof |
Definition at line 130 of file qqmldomlinewriter_p.h.
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 53 of file qqmldomlinewriter.cpp.
|
inlinevirtual |
Definition at line 148 of file qqmldomlinewriter_p.h.
Definition at line 151 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::OutWriter::OutWriter().
int QQmlJS::Dom::LineWriter::addNewlinesAutospacerCallback | ( | int | nLines | ) |
Definition at line 258 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 249 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 339 of file qqmldomlinewriter.cpp.
References i, and m_pendingSourceLocations.
Referenced by commitLine(), ensureSpace(), handleTrailingSpace(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and setLineIndent().
|
protected |
Definition at line 349 of file qqmldomlinewriter.cpp.
References QQmlJS::Dom::LineWriterOptions::formatOptions, m_columnNr, m_currentLine, m_options, QString::size(), and QQmlJS::Dom::FormatOptions::tabSize.
void QQmlJS::Dom::LineWriter::commitLine | ( | const QString & | eol, |
TextAddType | t = TextAddType::Normal, | ||
int | untilChar = -1 ) |
Definition at line 374 of file qqmldomlinewriter.cpp.
References changeAtOffset(), QString::clear(), Eof, Extra, i, QString::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(), and willCommit().
Referenced by flush(), reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
SourceLocation QQmlJS::Dom::LineWriter::committedLocation | ( | ) | const |
Definition at line 210 of file qqmldomlinewriter.cpp.
References m_lineNr, m_lineUtf16Offset, and m_utf16Offset.
|
inline |
Definition at line 181 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::OutWriter::counter(), and ensureSpace().
|
inline |
Definition at line 188 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::OutWriter::OutWriter().
|
protected |
Definition at line 333 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 235 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 67 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 90 of file qqmldomlinewriter.cpp.
References QString::at(), changeAtOffset(), QQmlJS::Dom::IndentInfo::column, counter(), ensureNewline(), QQmlJS::Dom::LineWriterOptions::formatOptions, i, QString::isEmpty(), 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 83 of file qqmldomlinewriter.cpp.
References QString::at(), QString::isEmpty(), 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 203 of file qqmldomlinewriter.cpp.
References ensureNewline(), and reindentAndSplit().
Referenced by QQmlJS::Dom::OutWriter::eof(), reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
|
protected |
Definition at line 127 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 187 of file qqmldomlinewriter_p.h.
void QQmlJS::Dom::LineWriter::flush | ( | ) |
Definition at line 197 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 303 of file qqmldomlinewriter.cpp.
References QString::at(), changeAtOffset(), 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 150 of file qqmldomlinewriter_p.h.
|
inlinevirtual |
Reimplemented in QQmlJS::Dom::IndentingLineWriter.
Definition at line 190 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), ensureSpace(), handleTrailingSpace(), setLineIndent(), and write().
|
inline |
Definition at line 156 of file qqmldomlinewriter_p.h.
References write().
Referenced by QQmlJS::Dom::OutWriter::newline().
|
inline |
Definition at line 189 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 324 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 183 of file qqmldomlinewriter_p.h.
References i.
Referenced by QQmlJS::Dom::OutWriter::removeTextAddCallback().
void QQmlJS::Dom::LineWriter::setLineIndent | ( | int | indentAmount | ) |
Definition at line 277 of file qqmldomlinewriter.cpp.
References QString::at(), changeAtOffset(), QQmlJS::Dom::LineWriterOptions::formatOptions, 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 143 of file qqmldomlinewriter_p.h.
References write().
Referenced by commitLine().
|
inline |
Definition at line 161 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 215 of file qqmldomlinewriter.cpp.
References currentSourceLocation(), QQmlJS::Dom::PendingSourceLocation::id, 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 225 of file qqmldomlinewriter.cpp.
References currentSourceLocation(), QQmlJS::Dom::PendingSourceLocation::id, m_lastSourceLocationId, and m_pendingSourceLocations.
|
protected |
Definition at line 358 of file qqmldomlinewriter.cpp.
References it, and m_textAddCallbacks.
Referenced by commitLine(), and write().
|
inlinevirtual |
Reimplemented in QQmlJS::Dom::IndentingLineWriter.
Definition at line 192 of file qqmldomlinewriter_p.h.
Referenced by commitLine().
|
inline |
Definition at line 167 of file qqmldomlinewriter_p.h.
References write().
LineWriter & QQmlJS::Dom::LineWriter::write | ( | QStringView | v, |
TextAddType | tType = TextAddType::Normal ) |
Definition at line 147 of file qqmldomlinewriter.cpp.
References QString::append(), QQmlJS::Dom::IndentInfo::column, eolToWrite(), QQmlJS::Dom::LineWriterOptions::formatOptions, i, QString::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(), 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 206 of file qqmldomlinewriter_p.h.
Referenced by column(), commitLine(), ensureSpace(), and QQmlJS::Dom::IndentingLineWriter::reindentAndSplit().
|
protected |
Definition at line 218 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), and ensureNewline().
|
protected |
Definition at line 217 of file qqmldomlinewriter_p.h.
Referenced by write().
|
protected |
Definition at line 209 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), ensureSpace(), handleTrailingSpace(), setLineIndent(), and write().
|
protected |
Definition at line 211 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 204 of file qqmldomlinewriter_p.h.
Definition at line 203 of file qqmldomlinewriter_p.h.
Referenced by commitLine().
|
protected |
Definition at line 215 of file qqmldomlinewriter_p.h.
Referenced by addTextAddCallback().
|
protected |
Definition at line 213 of file qqmldomlinewriter_p.h.
Referenced by startSourceLocation(), and startSourceLocation().
|
protected |
Definition at line 205 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), committedLocation(), and currentSourceLocation().
|
protected |
Definition at line 207 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), committedLocation(), and currentSourceLocation().
|
protected |
Definition at line 212 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 214 of file qqmldomlinewriter_p.h.
Referenced by changeAtOffset(), commitLine(), endSourceLocation(), startSourceLocation(), and startSourceLocation().
|
protected |
Definition at line 219 of file qqmldomlinewriter_p.h.
Referenced by QQmlJS::Dom::IndentingLineWriter::reindent(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and QQmlJS::Dom::IndentingLineWriter::setReindent().
|
protected |
Definition at line 216 of file qqmldomlinewriter_p.h.
Referenced by addTextAddCallback(), and textAddCallback().
|
protected |
Definition at line 210 of file qqmldomlinewriter_p.h.
Referenced by commitLine(), committedLocation(), currentSourceLocation(), endSourceLocation(), handleTrailingSpace(), QQmlJS::Dom::IndentingLineWriter::reindentAndSplit(), and setLineIndent().