Port QXmlStreamPrivateTagStack::addToStringStorage to QAnyStringView

This is a prerequisite of porting the QXmlStreamWriter API to
QAnyStringView.

Task-number: QTBUG-103302
Change-Id: I48eca902a7b8f0e0a52202936947a2b60353f08c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mate Barany 2022-11-28 17:08:00 +01:00
parent 7741665a9c
commit 1a1fd1566c

View File

@ -195,13 +195,13 @@ public:
qsizetype initialTagStackStringStorageSize;
bool tagsDone;
XmlStringRef addToStringStorage(QStringView s)
XmlStringRef addToStringStorage(QAnyStringView s)
{
qsizetype pos = tagStackStringStorageSize;
qsizetype sz = s.size();
if (pos != tagStackStringStorage.size())
tagStackStringStorage.resize(pos);
tagStackStringStorage.append(s.data(), sz);
s.visit([&](auto s) { tagStackStringStorage.append(s); });
qsizetype sz = (tagStackStringStorage.size() - pos);
tagStackStringStorageSize += sz;
return XmlStringRef(&tagStackStringStorage, pos, sz);
}