diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-28 12:29:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-28 13:25:27 +0200 |
commit | 1705fbe9daac56ee9bea8d8fd7c7f57e2bec49b5 (patch) | |
tree | aaf39244173a4cf20df6568140ebdbe5ec055656 /include/sax | |
parent | dfa8e18e8e6c7ad87e423393f8293a20188de1fd (diff) |
move the castToFastAttributeList function
to the slightly higher namespace, to make it easy and more readable to
use directly in a for-loop-range expression.
And make it return a reference rather than a pointer, since it is never
allowed to be nullptr.
Change-Id: I15d0b32493ef65cfc601b247c272b318f1eadfd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93049
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/sax')
-rw-r--r-- | include/sax/fastattribs.hxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx index 60090f88f2f5..1c89afeb04cb 100644 --- a/include/sax/fastattribs.hxx +++ b/include/sax/fastattribs.hxx @@ -70,6 +70,7 @@ class SAX_DLLPUBLIC FastTokenHandlerBase : const char *pStr, size_t nLength ); }; + class SAX_DLLPUBLIC FastAttributeList final : public cppu::WeakImplHelper< css::xml::sax::XFastAttributeList > { public: @@ -118,13 +119,6 @@ public: return -1; } - static FastAttributeList* castToFastAttributeList( - const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) - { - assert( dynamic_cast <FastAttributeList *> ( xAttrList.get() ) != nullptr ); - return static_cast <FastAttributeList *> ( xAttrList.get() ); - } - /// Use for fast iteration and conversion of attributes class FastAttributeIter { const FastAttributeList &mrList; @@ -210,6 +204,13 @@ private: FastTokenHandlerBase * mpTokenHandler; }; +inline FastAttributeList& castToFastAttributeList( + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) +{ + assert( dynamic_cast <FastAttributeList *> ( xAttrList.get() ) != nullptr ); + return *static_cast <FastAttributeList *> ( xAttrList.get() ); +} + } #endif |