include/rtl/string.hxx | 32 ++++++++++++++++++++++++++++++++ include/rtl/ustring.hxx | 32 ++++++++++++++++++++++++++++++++ sal/rtl/strimp.hxx | 2 +- 3 files changed, 65 insertions(+), 1 deletion(-)
New commits: commit c9f6e12e7eb6a49389360626d206191147a174fb Author: Noel Grandin <n...@peralex.com> Date: Tue Dec 15 11:23:14 2015 +0200 OString/OUString: move constructors and operator= Change-Id: Icdc5f7137cca8360f116d5d4c7b0bf4a4c526e1d Reviewed-on: https://gerrit.libreoffice.org/20712 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index ca0d1d1..5778488 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 2337e32..3ede597 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 diff --git a/sal/rtl/strimp.hxx b/sal/rtl/strimp.hxx index b7589cd..5583a82 100644 --- a/sal/rtl/strimp.hxx +++ b/sal/rtl/strimp.hxx @@ -33,7 +33,7 @@ /* ======================================================================= */ /* - * refCount is opaqueincludes 2 bit-fields; + * refCount is opaque and includes 2 bit-fields; * MSB: 'interned' - is stored in the intern hash * MSB-1: 'static' - is a const / static string, * do no ref counting _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits