aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmldom/qqmldomlinewriter_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmldom/qqmldomlinewriter_p.h')
-rw-r--r--src/qmldom/qqmldomlinewriter_p.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/qmldom/qqmldomlinewriter_p.h b/src/qmldom/qqmldomlinewriter_p.h
index eb858f5b7d..86da8d6f54 100644
--- a/src/qmldom/qqmldomlinewriter_p.h
+++ b/src/qmldom/qqmldomlinewriter_p.h
@@ -88,7 +88,11 @@ public:
int maxLineLength = -1;
int strongMaxLineExtra = 20;
int minContentLength = 10;
+#if defined (Q_OS_WIN)
+ LineEndings lineEndings = LineEndings::Windows;
+#else
LineEndings lineEndings = LineEndings::Unix;
+#endif
TrailingSpace codeTrailingSpace = TrailingSpace::Remove;
TrailingSpace commentTrailingSpace = TrailingSpace::Remove;
TrailingSpace stringTrailingSpace = TrailingSpace::Preserve;
@@ -100,7 +104,8 @@ public:
};
Q_DECLARE_OPERATORS_FOR_FLAGS(LineWriterOptions::Updates)
-using PendingSourceLocationId = QAtomicInt;
+using PendingSourceLocationId = int;
+using PendingSourceLocationIdAtomic = QAtomicInt;
class LineWriter;
class QMLDOM_EXPORT PendingSourceLocation
@@ -132,9 +137,9 @@ public:
Eof
};
- LineWriter(SinkF innerSink, QString fileName,
+ LineWriter(const SinkF &innerSink, const QString &fileName,
const LineWriterOptions &options = LineWriterOptions(), int lineNr = 0,
- int columnNr = 0, int utf16Offset = 0, QString currentLine = QString());
+ int columnNr = 0, int utf16Offset = 0, const QString &currentLine = QString());
std::function<void(QStringView)> sink()
{
return [this](QStringView s) { this->write(s); };
@@ -143,7 +148,7 @@ public:
virtual ~LineWriter() { }
QList<SinkF> innerSinks() { return m_innerSinks; }
- void addInnerSink(SinkF s) { m_innerSinks.append(s); }
+ void addInnerSink(const SinkF &s) { m_innerSinks.append(s); }
LineWriter &ensureNewline(int nNewlines = 1, TextAddType t = TextAddType::Extra);
LineWriter &ensureSpace(TextAddType t = TextAddType::Extra);
LineWriter &ensureSpace(QStringView space, TextAddType t = TextAddType::Extra);
@@ -166,7 +171,7 @@ public:
endSourceLocation(pLoc);
return *this;
}
- void commitLine(QString eol, TextAddType t = TextAddType::Normal, int untilChar = -1);
+ void commitLine(const QString &eol, TextAddType t = TextAddType::Normal, int untilChar = -1);
void flush();
void eof(bool ensureNewline = true);
SourceLocation committedLocation() const;
@@ -183,7 +188,7 @@ public:
const QString &currentLine() const { return m_currentLine; }
const LineWriterOptions &options() const { return m_options; }
virtual void lineChanged() { }
- virtual void reindentAndSplit(QString eol, bool eof = false);
+ virtual void reindentAndSplit(const QString &eol, bool eof = false);
virtual void willCommit() { }
private:
@@ -205,7 +210,7 @@ protected:
int m_utf16Offset = 0; // utf16 offset since start for committed data
QString m_currentLine;
LineWriterOptions m_options;
- PendingSourceLocationId m_lastSourceLocationId;
+ PendingSourceLocationIdAtomic m_lastSourceLocationId;
QMap<PendingSourceLocationId, PendingSourceLocation> m_pendingSourceLocations;
QAtomicInt m_lastCallbackId;
QMap<int, std::function<bool(LineWriter &, TextAddType)>> m_textAddCallbacks;