diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-06 07:29:56 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-06 23:02:16 +0200 |
commit | d856be879e0b94b36c8f87817de74189a8a04121 (patch) | |
tree | d65ec5f4272bcba1647e0a3a326ee6efa8f619f3 /include/sax | |
parent | a82a294f4681647fa4e11d8b02147d5881d80b0a (diff) |
Use more *string_view
Change-Id: Ic82bbb1b8d6b03066e66f5eb93e9a94b16b1a9f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150072
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/sax')
-rw-r--r-- | include/sax/fastattribs.hxx | 21 | ||||
-rw-r--r-- | include/sax/fshelper.hxx | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 2dc7c3d72420..61eb048e881a 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -62,14 +62,13 @@ class SAX_DLLPUBLIC FastTokenHandlerBase : /** * Client method to attempt the use of this interface if possible. * @xTokenHandler - the token lookup interface - * @pStr - string buffer to lookup - * @nLength - optional length of chars in that buffer + * @str - string buffer to lookup * - * @return Tokenized form of pStr + * @return Tokenized form of str */ static sal_Int32 getTokenFromChars( const FastTokenHandlerBase *pTokenHandler, - const char *pStr, size_t nLength ); + std::string_view str ); }; @@ -88,11 +87,17 @@ public: } void add( const FastAttributeList& ); void add( const css::uno::Reference<css::xml::sax::XFastAttributeList>& ); - void add( sal_Int32 nToken, const char* pValue ); - void add( sal_Int32 nToken, const char* pValue, size_t nValueLength ); - void add( sal_Int32 nToken, const OString& rValue ); + void add( sal_Int32 nToken, std::string_view value ); void add( sal_Int32 nToken, std::u16string_view sValue ); // Converts to UTF-8 - void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue ); + template <typename C, typename T1, typename T2> + void add( sal_Int32 nToken, rtl::StringConcat<C, T1, T2>&& value) { add(nToken, Concat2View(value)); } + template <typename Val, typename... Rest, std::enable_if_t<(sizeof...(Rest) > 0), int> = 0> + void add( sal_Int32 nToken, Val&& val, Rest&&... rest ) + { + add(nToken, std::forward<Val>(val)); + add(std::forward<Rest>(rest)...); + } + void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, std::string_view sValue ); void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, std::u16string_view sValue ); // note: rQName is *namespace-prefixed* void addUnknown( const OUString& rNamespaceURL, const OString& rQName, const OString& value ); diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index 338260861132..74e2ed4e3254 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -126,12 +126,8 @@ public: { endElement( FSNS( namespaceTokenId, elementTokenId ) ); } void singleElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList); - void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference<FastAttributeList> const & xAttrList) - { singleElement(FSNS( namespaceTokenId, elementTokenId), xAttrList); } void startElement(sal_Int32 elementTokenId, const rtl::Reference<FastAttributeList>& xAttrList); - void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, rtl::Reference<FastAttributeList> const & xAttrList) - { startElement( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); } FastSerializerHelper* write(const char* value); FastSerializerHelper* write(const OString& value); |