summaryrefslogtreecommitdiff
path: root/scripting/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-28 14:53:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-29 17:51:17 +0200
commit3823e81c25ba6f0f9b6a67d77e585426905e1b19 (patch)
treefa61ee28fb91300555b34475379cebc1cff054b8 /scripting/source
parentee50d4152cc4a06367d66808ceba1e74e62f3ed8 (diff)
std::unique_ptr -> std::optional
Change-Id: I15779eca607f27a758575f4f095910277aa85eda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting/source')
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 854dd312bd86..d3c1c1f0b394 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -38,6 +38,7 @@
#include <vector>
#include <algorithm>
#include <memory>
+#include <optional>
#include <string_view>
using namespace ::com::sun::star;
@@ -151,7 +152,7 @@ class LocationBrowseNode :
public ::cppu::WeakImplHelper< browse::XBrowseNode >
{
private:
- std::unique_ptr<std::unordered_map< OUString, Reference< browse::XBrowseNode > >> m_hBNA;
+ std::optional<std::unordered_map< OUString, Reference< browse::XBrowseNode > >> m_hBNA;
std::vector< OUString > m_vStr;
OUString m_sNodeName;
Reference< browse::XBrowseNode > m_origNode;
@@ -175,7 +176,7 @@ public:
virtual Sequence< Reference< browse::XBrowseNode > > SAL_CALL
getChildNodes() override
{
- if ( m_hBNA == nullptr )
+ if ( !m_hBNA )
{
loadChildNodes();
}
@@ -206,7 +207,7 @@ private:
void loadChildNodes()
{
- m_hBNA.reset( new std::unordered_map< OUString, Reference< browse::XBrowseNode > > );
+ m_hBNA.emplace();
const Sequence< Reference< browse::XBrowseNode > > langNodes =
m_origNode->getChildNodes();