summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-09-27 10:18:39 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-09-27 10:12:07 +0200
commit8623ce7cc634574f3f1294bc855ecd8dd32d661a (patch)
treeb1e5bc6b19295fc9674802bac977dd983b029ae6 /include/svl
parentf01d7029601f01b591f8b36fb19d7c46742da880 (diff)
A bit of cosmetics
Change-Id: If7440ea4e99ce33948a1c040f9f0345b18d18c42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140635 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/sharedstring.hxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
index 880427d662f1..09261dd5addb 100644
--- a/include/svl/sharedstring.hxx
+++ b/include/svl/sharedstring.hxx
@@ -13,18 +13,20 @@
#include <svl/svldllapi.h>
#include <rtl/ustring.hxx>
+#include <utility>
+
namespace svl {
class SVL_DLLPUBLIC SharedString
{
- rtl_uString* mpData;
- rtl_uString* mpDataIgnoreCase;
+ rtl_uString* mpData = nullptr;
+ rtl_uString* mpDataIgnoreCase = nullptr;
public:
static const SharedString & getEmptyString();
static const OUString EMPTY_STRING;
- SharedString();
+ SharedString() = default;
SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase );
explicit SharedString( const OUString& rStr );
SharedString( const SharedString& r );
@@ -52,8 +54,6 @@ public:
sal_Int32 getLength() const;
};
-inline SharedString::SharedString() : mpData(nullptr), mpDataIgnoreCase(nullptr) {}
-
inline SharedString::SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase ) :
mpData(pData), mpDataIgnoreCase(pDataIgnoreCase)
{
@@ -63,7 +63,7 @@ inline SharedString::SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreC
rtl_uString_acquire(mpDataIgnoreCase);
}
-inline SharedString::SharedString( const OUString& rStr ) : mpData(rStr.pData), mpDataIgnoreCase(nullptr)
+inline SharedString::SharedString( const OUString& rStr ) : mpData(rStr.pData)
{
rtl_uString_acquire(mpData);
}
@@ -76,10 +76,10 @@ inline SharedString::SharedString( const SharedString& r ) : mpData(r.mpData), m
rtl_uString_acquire(mpDataIgnoreCase);
}
-inline SharedString::SharedString(SharedString&& r) noexcept : mpData(r.mpData), mpDataIgnoreCase(r.mpDataIgnoreCase)
+inline SharedString::SharedString(SharedString&& r) noexcept
+ : mpData(std::exchange(r.mpData, nullptr))
+ , mpDataIgnoreCase(std::exchange(r.mpDataIgnoreCase, nullptr))
{
- r.mpData = nullptr;
- r.mpDataIgnoreCase = nullptr;
}
inline SharedString::~SharedString()
@@ -99,11 +99,8 @@ inline SharedString& SharedString::operator=(SharedString&& r) noexcept
if (mpDataIgnoreCase)
rtl_uString_release(mpDataIgnoreCase);
- mpData = r.mpData;
- mpDataIgnoreCase = r.mpDataIgnoreCase;
-
- r.mpData = nullptr;
- r.mpDataIgnoreCase = nullptr;
+ mpData = std::exchange(r.mpData, nullptr);
+ mpDataIgnoreCase = std::exchange(r.mpDataIgnoreCase, nullptr);
return *this;
}