Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
9bc591fa
Kaydet (Commit)
9bc591fa
authored
Agu 19, 2016
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
cid#1371307: Move semantics for BinaryAny
Change-Id: I30b8bb71f8a9e093183ee85484ccd694f3e1e10d
üst
178153e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
binaryany.cxx
binaryurp/source/binaryany.cxx
+31
-0
binaryany.hxx
binaryurp/source/binaryany.hxx
+4
-0
No files found.
binaryurp/source/binaryany.cxx
Dosyayı görüntüle @
9bc591fa
...
...
@@ -20,6 +20,7 @@
#include "sal/config.h"
#include <cassert>
#include <utility>
#include "typelib/typeclass.h"
#include "typelib/typedescription.hxx"
...
...
@@ -29,6 +30,26 @@
namespace
binaryurp
{
namespace
{
// Cf. com::sun::star::uno::detail::moveAnyInternals in
// include/com/sun/star/uno/Any.hxx:
void
moveInternals
(
uno_Any
&
from
,
uno_Any
&
to
)
{
uno_any_construct
(
&
to
,
nullptr
,
nullptr
,
nullptr
);
std
::
swap
(
from
.
pType
,
to
.
pType
);
std
::
swap
(
from
.
pData
,
to
.
pData
);
std
::
swap
(
from
.
pReserved
,
to
.
pReserved
);
if
(
to
.
pData
==
&
from
.
pReserved
)
{
to
.
pData
=
&
to
.
pReserved
;
}
// This leaves to.pData (where "to" is now VOID) dangling to somewhere (cf.
// CONSTRUCT_EMPTY_ANY, cppu/source/uno/prim.hxx), but what's relevant is
// only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData ->
// _assignData takes a null pSource to mean "construct a default value").
}
}
BinaryAny
::
BinaryAny
()
throw
()
{
uno_any_construct
(
&
data_
,
nullptr
,
nullptr
,
nullptr
);
}
...
...
@@ -52,6 +73,10 @@ BinaryAny::BinaryAny(BinaryAny const & other) throw () {
uno_type_any_construct
(
&
data_
,
other
.
data_
.
pData
,
other
.
data_
.
pType
,
nullptr
);
}
BinaryAny
::
BinaryAny
(
BinaryAny
&&
other
)
throw
()
{
moveInternals
(
other
.
data_
,
data_
);
}
BinaryAny
::~
BinaryAny
()
throw
()
{
uno_any_destruct
(
&
data_
,
nullptr
);
}
...
...
@@ -63,6 +88,12 @@ BinaryAny & BinaryAny::operator =(BinaryAny const & other) throw () {
return
*
this
;
}
BinaryAny
&
BinaryAny
::
operator
=
(
BinaryAny
&&
other
)
throw
()
{
uno_any_destruct
(
&
data_
,
nullptr
);
moveInternals
(
other
.
data_
,
data_
);
return
*
this
;
}
css
::
uno
::
TypeDescription
BinaryAny
::
getType
()
const
throw
()
{
return
css
::
uno
::
TypeDescription
(
data_
.
pType
);
}
...
...
binaryurp/source/binaryany.hxx
Dosyayı görüntüle @
9bc591fa
...
...
@@ -43,10 +43,14 @@ public:
BinaryAny
(
BinaryAny
const
&
other
)
throw
();
BinaryAny
(
BinaryAny
&&
other
)
throw
();
~
BinaryAny
()
throw
();
BinaryAny
&
operator
=
(
BinaryAny
const
&
other
)
throw
();
BinaryAny
&
operator
=
(
BinaryAny
&&
other
)
throw
();
uno_Any
&
get
()
throw
()
{
return
data_
;
}
com
::
sun
::
star
::
uno
::
TypeDescription
getType
()
const
throw
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment