From c53af84c9ca1a1d5090d72b03a8c483d7485f7db Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 23 Sep 2016 18:33:34 +0200 Subject: cid#1371196: Add move semantics Change-Id: I7bf2d6f5e5b1d10cde210c814567017680c6a74e --- include/uno/environment.hxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/uno') diff --git a/include/uno/environment.hxx b/include/uno/environment.hxx index 8a836148677a..e8b99a6ec14d 100644 --- a/include/uno/environment.hxx +++ b/include/uno/environment.hxx @@ -94,6 +94,11 @@ public: */ inline Environment( const Environment & rEnv ); +#if defined LIBO_INTERNAL_ONLY + Environment(Environment && other): _pEnv(other._pEnv) + { other._pEnv = nullptr; } +#endif + /** Destructor: releases a set environment. */ inline ~Environment(); @@ -112,6 +117,17 @@ public: inline Environment & SAL_CALL operator = ( const Environment & rEnv ) { return operator = ( rEnv._pEnv ); } +#if defined LIBO_INTERNAL_ONLY + Environment & operator =(Environment && other) { + if (_pEnv != nullptr) { + (*_pEnv->release)(_pEnv); + } + _pEnv = other._pEnv; + other._pEnv = nullptr; + return *this; + } +#endif + /** Provides UNacquired pointer to the set C environment. @return UNacquired pointer to the C environment struct -- cgit