[Libreoffice-commits] core.git: include/osl
Stephan Bergmann
sbergman at redhat.com
Tue Sep 20 09:31:27 UTC 2016
include/osl/socket.hxx | 16 ++++++++++++++++
include/osl/socket_decl.hxx | 8 ++++++++
2 files changed, 24 insertions(+)
New commits:
commit f0f600751feb5615499010c31e5a577568a88e7f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Sep 20 11:29:40 2016 +0200
cid#1371245: Add move semantics
Change-Id: I35daf9030478831262521497a1977bdfbe661dd8
diff --git a/include/osl/socket.hxx b/include/osl/socket.hxx
index b4012cc..190a7d7 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 1913956..760096b 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
More information about the Libreoffice-commits
mailing list