summaryrefslogtreecommitdiff
path: root/include/osl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-09-20 11:29:40 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-09-20 11:29:40 +0200
commitf0f600751feb5615499010c31e5a577568a88e7f (patch)
tree7ecd295c02210d107e7ccd133b035a1603258165 /include/osl
parent9dbb9f9a07d43841473770e9d8c4d4f1f5ffba9a (diff)
cid#1371245: Add move semantics
Change-Id: I35daf9030478831262521497a1977bdfbe661dd8
Diffstat (limited to 'include/osl')
-rw-r--r--include/osl/socket.hxx16
-rw-r--r--include/osl/socket_decl.hxx8
2 files changed, 24 insertions, 0 deletions
diff --git a/include/osl/socket.hxx b/include/osl/socket.hxx
index b4012cca76f8..190a7d7ea558 100644
--- a/include/osl/socket.hxx
+++ b/include/osl/socket.hxx
@@ -34,6 +34,11 @@ namespace osl
{
}
+#if defined LIBO_INTERNAL_ONLY
+ SocketAddr::SocketAddr(SocketAddr && other): m_handle(other.m_handle) {
+ other.m_handle = nullptr;
+ }
+#endif
inline SocketAddr::SocketAddr(oslSocketAddr Addr)
: m_handle( osl_copySocketAddr( Addr ) )
@@ -135,6 +140,17 @@ namespace osl
return *this;
}
+#if defined LIBO_INTERNAL_ONLY
+ SocketAddr & SocketAddr::operator =(SocketAddr && other) {
+ if (m_handle != nullptr) {
+ osl_destroySocketAddr(m_handle);
+ }
+ m_handle = other.m_handle;
+ other.m_handle = nullptr;
+ return *this;
+ }
+#endif
+
inline SocketAddr & SAL_CALL SocketAddr::assign( oslSocketAddr Addr, __osl_socket_NoCopy )
{
if( m_handle )
diff --git a/include/osl/socket_decl.hxx b/include/osl/socket_decl.hxx
index 1913956da191..760096bab113 100644
--- a/include/osl/socket_decl.hxx
+++ b/include/osl/socket_decl.hxx
@@ -50,6 +50,10 @@ namespace osl
*/
inline SocketAddr(const SocketAddr& Addr);
+#if defined LIBO_INTERNAL_ONLY
+ inline SocketAddr(SocketAddr && other);
+#endif
+
/** The SocketAddr takes over the responsibility of the handle ( which means,
that the handle gets destructed by the destructor of this reference)
@param Addr a handle
@@ -119,6 +123,10 @@ namespace osl
*/
inline SocketAddr & SAL_CALL operator= (const SocketAddr& Addr);
+#if defined LIBO_INTERNAL_ONLY
+ inline SocketAddr & operator =(SocketAddr && other);
+#endif
+
/** Assigns the socket addr without copyconstructing it.
@param Addr the socket address.
@param nocopy use SAL_NO_COPY