diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-09-20 11:28:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-09-20 11:28:06 +0200 |
commit | 9dbb9f9a07d43841473770e9d8c4d4f1f5ffba9a (patch) | |
tree | 8f803c2e838bd4386a280a1aa98264b950ba4213 /include | |
parent | 49f11e4a5cb60993e1421ccae831c810d494c4d7 (diff) |
cid#1371291: Add move semantics
Change-Id: I9bca3413e023b6909fbf75e567ed75739189bc43
Diffstat (limited to 'include')
-rw-r--r-- | include/osl/pipe.hxx | 15 | ||||
-rw-r--r-- | include/osl/pipe_decl.hxx | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/osl/pipe.hxx b/include/osl/pipe.hxx index 04a971b9d09d..743dec393f57 100644 --- a/include/osl/pipe.hxx +++ b/include/osl/pipe.hxx @@ -50,6 +50,11 @@ namespace osl osl_acquirePipe( m_handle ); } +#if defined LIBO_INTERNAL_ONLY + Pipe::Pipe(Pipe && other): m_handle(other.m_handle) { + other.m_handle = nullptr; + } +#endif inline Pipe::Pipe( oslPipe pipe, __sal_NoAcquire ) : m_handle ( pipe ) @@ -91,6 +96,16 @@ namespace osl return *this; } +#if defined LIBO_INTERNAL_ONLY + Pipe & Pipe::operator =(Pipe && other) { + if (m_handle != nullptr) { + osl_releasePipe(m_handle); + } + m_handle = other.m_handle; + other.m_handle = nullptr; + return *this; + } +#endif inline Pipe & SAL_CALL Pipe::operator=( oslPipe pipe) { diff --git a/include/osl/pipe_decl.hxx b/include/osl/pipe_decl.hxx index 0c0430ebb518..738332456313 100644 --- a/include/osl/pipe_decl.hxx +++ b/include/osl/pipe_decl.hxx @@ -58,6 +58,10 @@ public: */ inline Pipe(const Pipe& pipe); +#if defined LIBO_INTERNAL_ONLY + inline Pipe(Pipe && other); +#endif + /** Constructs a Pipe reference without acquiring the handle */ inline Pipe( oslPipe pipe, __sal_NoAcquire noacquire ); @@ -103,6 +107,10 @@ public: */ inline Pipe& SAL_CALL operator= (const Pipe& pipe); +#if defined LIBO_INTERNAL_ONLY + inline Pipe & operator =(Pipe && other); +#endif + /** Assignment operator. If pipe was already created, the old one will be discarded. */ |