summaryrefslogtreecommitdiff
path: root/include/rtl/ustring.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-09 12:22:17 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-09 12:22:17 +0100
commit9d3cb71115cfb34adde975f66f394303982f85be (patch)
treeadf872556cd90007038c9cf22f7a0aac630395f1 /include/rtl/ustring.hxx
parent53352be12cb6a191934b8107559ea47171868718 (diff)
Prevent += called on temporary O[U]String instances
...found regression e31205f3ec1f941ab5a188bfde6329edf2acc55b "EditUndoRemoveChars::GetStr must return a reference" and dubious code 0e23f7b0839df68d277186b4df54ba391ac3406a "Lets assume this doesn't want to update m_pForcedPrefix->GetText() anyway" in addition to the apparent sillies directly fixed in this commit. Introduces HAVE_CXX11_REF_QUALIFIER. Change-Id: I564e98254fd53c1dd9b34193d7057c59721ee24c
Diffstat (limited to 'include/rtl/ustring.hxx')
-rw-r--r--include/rtl/ustring.hxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index ee96da1722fc..398dd93fbfd3 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -34,6 +34,7 @@
#include <sal/log.hxx>
#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
+#include <config_global.h>
#include <rtl/stringconcat.hxx>
#endif
@@ -419,10 +420,16 @@ public:
@param str a OUString.
*/
OUString & operator+=( const OUString & str )
+#if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
+ &
+#endif
{
rtl_uString_newConcat( &pData, pData, str.pData );
return *this;
}
+#if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
+ void operator+=(OUString const &) && = delete;
+#endif
/** Append an ASCII string literal to this string.
@@ -432,7 +439,11 @@ public:
*/
template<typename T>
typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
- operator +=(T & literal) {
+ operator +=(T & literal)
+#if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
+ &
+#endif
+ {
assert(
libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
rtl_uString_newConcatAsciiL(
@@ -441,6 +452,11 @@ public:
libreoffice_internal::ConstCharArrayDetector<T>::length);
return *this;
}
+#if defined LIBO_INTERNAL_ONLY && HAVE_CXX11_REF_QUALIFIER
+ template<typename T>
+ typename libreoffice_internal::ConstCharArrayDetector<T, OUString &>::Type
+ operator +=(T &) && = delete;
+#endif
#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
/**
@@ -449,6 +465,9 @@ public:
*/
template< typename T1, typename T2 >
OUString& operator+=( const OUStringConcat< T1, T2 >& c )
+#if HAVE_CXX11_REF_QUALIFIER
+ &
+#endif
{
sal_Int32 l = c.length();
if( l == 0 )
@@ -460,6 +479,10 @@ public:
pData->length = l;
return *this;
}
+#if HAVE_CXX11_REF_QUALIFIER
+ template<typename T1, typename T2> void operator +=(
+ OUStringConcat<T1, T2> const &) && = delete;
+#endif
#endif
/**