Kaydet (Commit) 9dbb9f9a authored tarafından Stephan Bergmann's avatar Stephan Bergmann

cid#1371291: Add move semantics

Change-Id: I9bca3413e023b6909fbf75e567ed75739189bc43
üst 49f11e4a
...@@ -50,6 +50,11 @@ namespace osl ...@@ -50,6 +50,11 @@ namespace osl
osl_acquirePipe( m_handle ); 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 ) inline Pipe::Pipe( oslPipe pipe, __sal_NoAcquire )
: m_handle ( pipe ) : m_handle ( pipe )
...@@ -91,6 +96,16 @@ namespace osl ...@@ -91,6 +96,16 @@ namespace osl
return *this; 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) inline Pipe & SAL_CALL Pipe::operator=( oslPipe pipe)
{ {
......
...@@ -58,6 +58,10 @@ public: ...@@ -58,6 +58,10 @@ public:
*/ */
inline Pipe(const Pipe& pipe); inline Pipe(const Pipe& pipe);
#if defined LIBO_INTERNAL_ONLY
inline Pipe(Pipe && other);
#endif
/** Constructs a Pipe reference without acquiring the handle /** Constructs a Pipe reference without acquiring the handle
*/ */
inline Pipe( oslPipe pipe, __sal_NoAcquire noacquire ); inline Pipe( oslPipe pipe, __sal_NoAcquire noacquire );
...@@ -103,6 +107,10 @@ public: ...@@ -103,6 +107,10 @@ public:
*/ */
inline Pipe& SAL_CALL operator= (const Pipe& pipe); 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 /** Assignment operator. If pipe was already created, the old one will
be discarded. be discarded.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment