diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-05 17:20:49 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-07-05 22:14:12 +0200 |
commit | 57afeb8d9e35933630568a02fc48a00f5582b261 (patch) | |
tree | e19afc4a88d04e78f0d3f1d92ef469f5e0d5669f /include/sax | |
parent | 01c58c7d6da0a5671460ba4c0e23a2a04d2eb87e (diff) |
Allow use OUString as attribute value in FastSerializerHelper::*Element
Change-Id: Id34d08787d0188d5c7847dcb75958a511a1fef27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98143
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/sax')
-rw-r--r-- | include/sax/fshelper.hxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index b38689a5927f..235181bf9846 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/xml/sax/XFastAttributeList.hpp> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> #include <sax/saxdllapi.h> #include <memory> #include <utility> @@ -62,6 +63,12 @@ public: pushAttributeValue(attribute, value); startElement(elementTokenId, std::forward<Args>(args)...); } + template<typename... Args> + void startElement(sal_Int32 elementTokenId, sal_Int32 attribute, const OUString& value, Args&&... args) + { + // The temporary created by toUtf8() must stay alive until startElement() ends using it + startElement(elementTokenId, attribute, value.toUtf8(), std::forward<Args>(args)...); + } void startElement(sal_Int32 elementTokenId); /// Start an element. After the first two arguments there can be a number of (attribute, value) pairs. @@ -85,6 +92,12 @@ public: pushAttributeValue(attribute, value); singleElement(elementTokenId, std::forward<Args>(args)...); } + template<typename... Args> + void singleElement(sal_Int32 elementTokenId, sal_Int32 attribute, const OUString& value, Args&&... args) + { + // The temporary created by toUtf8() must stay alive until singleElement() ends using it + singleElement(elementTokenId, attribute, value.toUtf8(), std::forward<Args>(args)...); + } void singleElement(sal_Int32 elementTokenId); /// Create a single element. After the first two arguments there can be a number of (attribute, value) pairs. |