diff options
author | Noel Grandin <noel@peralex.com> | 2015-12-15 11:23:14 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-12-17 06:59:50 +0000 |
commit | c9f6e12e7eb6a49389360626d206191147a174fb (patch) | |
tree | e74c709a59b6350afe77134bbac5561dda1d875a /include/rtl | |
parent | 15614c847dde4c52a4974022e5523c9c4fea856b (diff) |
OString/OUString: move constructors and operator=
Change-Id: Icdc5f7137cca8360f116d5d4c7b0bf4a4c526e1d
Reviewed-on: https://gerrit.libreoffice.org/20712
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/rtl')
-rw-r--r-- | include/rtl/string.hxx | 32 | ||||
-rw-r--r-- | include/rtl/ustring.hxx | 32 |
2 files changed, 64 insertions, 0 deletions
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index ca0d1d114053..57784885e773 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -114,6 +114,21 @@ public: rtl_string_acquire( pData ); } +#if defined LIBO_INTERNAL_ONLY + /** + Move constructor. + + @param str a OString. + @since LibreOffice 5.2 + */ + OString( OString && str ) + { + pData = str.pData; + str.pData = nullptr; + rtl_string_new( &str.pData ); + } +#endif + /** New string from OString data. @@ -281,6 +296,23 @@ public: return *this; } +#if defined LIBO_INTERNAL_ONLY + /** + Move assign a new string. + + @param str a OString. + @since LibreOffice 5.2 + */ + OString & operator=( OString && str ) + { + rtl_string_release( pData ); + pData = str.pData; + str.pData = nullptr; + rtl_string_new( &str.pData ); + return *this; + } +#endif + /** @overload This function accepts an ASCII string literal as its argument. diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 2337e322c6d4..3ede5973d016 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -130,6 +130,21 @@ public: rtl_uString_acquire( pData ); } +#if defined LIBO_INTERNAL_ONLY + /** + Move constructor. + + @param str a OUString. + @since LibreOffice 5.2 + */ + OUString( OUString && str ) + { + pData = str.pData; + str.pData = nullptr; + rtl_uString_new( &str.pData ); + } +#endif + /** New string from OUString data. @@ -386,6 +401,23 @@ public: return *this; } +#if defined LIBO_INTERNAL_ONLY + /** + Move assign a new string. + + @param str a OString. + @since LibreOffice 5.2 + */ + OUString & operator=( OUString && str ) + { + rtl_uString_release( pData ); + pData = str.pData; + str.pData = nullptr; + rtl_uString_new( &str.pData ); + return *this; + } +#endif + /** Assign a new string from an 8-Bit string literal that is expected to contain only characters in the ASCII set (i.e. first 128 characters). This operator |