no need to create OString temporaries when calling XmlWriter methods
Change-Id: Ief1101c55a0635dac43a7c4d66dd4ed0d5be70bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154764 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
f8a3126178
commit
2006d7455f
@ -925,7 +925,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
|
||||
for (size_t iDx = 0; iDx < aDx.size(); ++iDx)
|
||||
{
|
||||
OString sName = "dx" + OString::number(iDx);
|
||||
rWriter.attribute(sName, OUString::number(aDx[iDx]));
|
||||
rWriter.attribute(sName, OString::number(aDx[iDx]));
|
||||
}
|
||||
}
|
||||
rWriter.endElement();
|
||||
@ -1207,7 +1207,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
|
||||
|
||||
default:
|
||||
{
|
||||
OString aName("unhandled");
|
||||
const char* aName = "unhandled";
|
||||
switch (nId)
|
||||
{
|
||||
case PRIMITIVE2D_ID_RANGE_SVX | 14: // PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D
|
||||
|
@ -44,21 +44,23 @@ public:
|
||||
bool startDocument(sal_Int32 nIndent = 2, bool bWriteXmlHeader = true);
|
||||
void endDocument();
|
||||
|
||||
void startElement(const char* sName);
|
||||
void startElement(const OString& sName);
|
||||
void startElement(const OString& sPrefix, const OString& sName, const OString& sNamespaceUri);
|
||||
void endElement();
|
||||
|
||||
void attribute(const char* sTagName, const OString& aValue);
|
||||
void attribute(const OString& sTagName, const OString& aValue);
|
||||
void attribute(const OString& sTagName, std::u16string_view aValue);
|
||||
void attribute(const OString& sTagName, sal_Int32 aNumber);
|
||||
void attributeDouble(const OString& sTagName, double aNumber);
|
||||
void attributeBase64(const OString& sTagName, std::vector<sal_uInt8> const& rValueInBytes);
|
||||
void attributeBase64(const OString& sTagName, std::vector<char> const& rValueInBytes);
|
||||
void attribute(const char* sTagName, std::u16string_view aValue);
|
||||
void attribute(const char* sTagName, sal_Int32 aNumber);
|
||||
void attributeDouble(const char* sTagName, double aNumber);
|
||||
void attributeBase64(const char* sTagName, std::vector<sal_uInt8> const& rValueInBytes);
|
||||
void attributeBase64(const char* sTagName, std::vector<char> const& rValueInBytes);
|
||||
|
||||
void content(const OString& sValue);
|
||||
void content(std::u16string_view sValue);
|
||||
|
||||
void element(const OString& sName);
|
||||
void element(const char* sName);
|
||||
};
|
||||
|
||||
} // end tools namespace
|
||||
|
@ -93,28 +93,41 @@ void XmlWriter::startElement(const OString& sPrefix, const OString& sName,
|
||||
(void)xmlTextWriterStartElementNS(mpImpl->mpWriter, xmlPrefix, xmlName, xmlNamespaceUri);
|
||||
}
|
||||
|
||||
void XmlWriter::startElement(const OString& sName)
|
||||
void XmlWriter::startElement(const char* pName)
|
||||
{
|
||||
xmlChar* xmlName = BAD_CAST(sName.getStr());
|
||||
xmlChar* xmlName = BAD_CAST(pName);
|
||||
(void)xmlTextWriterStartElement(mpImpl->mpWriter, xmlName);
|
||||
}
|
||||
|
||||
void XmlWriter::startElement(const OString& rName)
|
||||
{
|
||||
xmlChar* xmlName = BAD_CAST(rName.getStr());
|
||||
(void)xmlTextWriterStartElement(mpImpl->mpWriter, xmlName);
|
||||
}
|
||||
|
||||
void XmlWriter::endElement() { (void)xmlTextWriterEndElement(mpImpl->mpWriter); }
|
||||
|
||||
void XmlWriter::attributeBase64(const OString& rsName, std::vector<sal_uInt8> const& rValueInBytes)
|
||||
void XmlWriter::attributeBase64(const char* pName, std::vector<sal_uInt8> const& rValueInBytes)
|
||||
{
|
||||
std::vector<char> aSignedBytes(rValueInBytes.begin(), rValueInBytes.end());
|
||||
attributeBase64(rsName, aSignedBytes);
|
||||
attributeBase64(pName, aSignedBytes);
|
||||
}
|
||||
|
||||
void XmlWriter::attributeBase64(const OString& rsName, std::vector<char> const& rValueInBytes)
|
||||
void XmlWriter::attributeBase64(const char* pName, std::vector<char> const& rValueInBytes)
|
||||
{
|
||||
xmlChar* xmlName = BAD_CAST(rsName.getStr());
|
||||
xmlChar* xmlName = BAD_CAST(pName);
|
||||
(void)xmlTextWriterStartAttribute(mpImpl->mpWriter, xmlName);
|
||||
(void)xmlTextWriterWriteBase64(mpImpl->mpWriter, rValueInBytes.data(), 0, rValueInBytes.size());
|
||||
(void)xmlTextWriterEndAttribute(mpImpl->mpWriter);
|
||||
}
|
||||
|
||||
void XmlWriter::attribute(const char* name, const OString& value)
|
||||
{
|
||||
xmlChar* xmlName = BAD_CAST(name);
|
||||
xmlChar* xmlValue = BAD_CAST(value.getStr());
|
||||
(void)xmlTextWriterWriteAttribute(mpImpl->mpWriter, xmlName, xmlValue);
|
||||
}
|
||||
|
||||
void XmlWriter::attribute(const OString& name, const OString& value)
|
||||
{
|
||||
xmlChar* xmlName = BAD_CAST(name.getStr());
|
||||
@ -122,17 +135,17 @@ void XmlWriter::attribute(const OString& name, const OString& value)
|
||||
(void)xmlTextWriterWriteAttribute(mpImpl->mpWriter, xmlName, xmlValue);
|
||||
}
|
||||
|
||||
void XmlWriter::attribute(const OString& name, std::u16string_view value)
|
||||
void XmlWriter::attribute(const char* name, std::u16string_view value)
|
||||
{
|
||||
attribute(name, OUStringToOString(value, RTL_TEXTENCODING_UTF8));
|
||||
}
|
||||
|
||||
void XmlWriter::attribute(const OString& name, const sal_Int32 aNumber)
|
||||
void XmlWriter::attribute(const char* name, const sal_Int32 aNumber)
|
||||
{
|
||||
attribute(name, OString::number(aNumber));
|
||||
}
|
||||
|
||||
void XmlWriter::attributeDouble(const OString& name, const double aNumber)
|
||||
void XmlWriter::attributeDouble(const char* name, const double aNumber)
|
||||
{
|
||||
attribute(name, OString::number(aNumber));
|
||||
}
|
||||
@ -148,7 +161,7 @@ void XmlWriter::content(std::u16string_view sValue)
|
||||
content(OUStringToOString(sValue, RTL_TEXTENCODING_UTF8));
|
||||
}
|
||||
|
||||
void XmlWriter::element(const OString& sName)
|
||||
void XmlWriter::element(const char* sName)
|
||||
{
|
||||
startElement(sName);
|
||||
endElement();
|
||||
|
Loading…
x
Reference in New Issue
Block a user