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
324377ad
Kaydet (Commit)
324377ad
authored
Nis 13, 2015
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
VclPtr - add a templatized ::Create method for better readability.
Change-Id: I2437198709ba4848d975efd1ebb4df1071c6c8f1
üst
5245021a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
vclptr.hxx
include/vcl/vclptr.hxx
+19
-3
lifecycle.cxx
vcl/qa/cppunit/lifecycle.cxx
+1
-1
No files found.
include/vcl/vclptr.hxx
Dosyayı görüntüle @
324377ad
...
@@ -125,6 +125,20 @@ public:
...
@@ -125,6 +125,20 @@ public:
{
{
}
}
/**
* A construction helper for VclPtr. Since VclPtr types are created
* with a reference-count of one - to help fit into the existing
* code-flow; this helps us to construct them easily.
*
* For more details on the design please see vcl/README.lifecycle
*
* @param reference_type must be a subclass of vcl::Window
*/
template
<
typename
...
Arg
>
static
VclPtr
<
reference_type
>
Create
(
Arg
&&
...
arg
)
{
return
VclPtr
<
reference_type
>
(
new
reference_type
(
std
::
forward
<
Arg
>
(
arg
)...),
SAL_NO_ACQUIRE
);
}
/** Probably most common used: handle->someBodyOp().
/** Probably most common used: handle->someBodyOp().
*/
*/
inline
reference_type
*
SAL_CALL
operator
->
()
const
inline
reference_type
*
SAL_CALL
operator
->
()
const
...
@@ -224,9 +238,10 @@ public:
...
@@ -224,9 +238,10 @@ public:
};
// class VclPtr
};
// class VclPtr
/**
/**
* A construction helper for VclPtr. Since VclPtr types are created
* A construction helper for a temporary VclPtr. Since VclPtr types
* with a reference-count of one - to help fit into the existing
* are created with a reference-count of one - to help fit into
* code-flow; this helps us to construct them easily.
* the existing code-flow; this helps us to construct them easily.
* see also VclPtr::Create and ScopedVclPtr
*
*
* For more details on the design please see vcl/README.lifecycle
* For more details on the design please see vcl/README.lifecycle
*
*
...
@@ -295,6 +310,7 @@ public:
...
@@ -295,6 +310,7 @@ public:
VclPtr
<
reference_type
>::
disposeAndClear
();
VclPtr
<
reference_type
>::
disposeAndClear
();
assert
(
VclPtr
<
reference_type
>::
get
()
==
nullptr
);
// make sure there are no lingering references
assert
(
VclPtr
<
reference_type
>::
get
()
==
nullptr
);
// make sure there are no lingering references
}
}
private
:
private
:
// Most likely we don't want this default copy-construtor.
// Most likely we don't want this default copy-construtor.
ScopedVclPtr
(
const
ScopedVclPtr
<
reference_type
>
&
)
SAL_DELETED_FUNCTION
;
ScopedVclPtr
(
const
ScopedVclPtr
<
reference_type
>
&
)
SAL_DELETED_FUNCTION
;
...
...
vcl/qa/cppunit/lifecycle.cxx
Dosyayı görüntüle @
324377ad
...
@@ -59,7 +59,7 @@ void LifecycleTest::testCast()
...
@@ -59,7 +59,7 @@ void LifecycleTest::testCast()
void
LifecycleTest
::
testVirtualDevice
()
void
LifecycleTest
::
testVirtualDevice
()
{
{
VclPtr
Instance
<
VirtualDevice
>
pVDev
;
VclPtr
<
VirtualDevice
>
pVDev
=
VclPtr
<
VirtualDevice
>::
Create
()
;
ScopedVclPtrInstance
<
VirtualDevice
>
pVDev2
;
ScopedVclPtrInstance
<
VirtualDevice
>
pVDev2
;
VclPtrInstance
<
VirtualDevice
>
pVDev3
;
VclPtrInstance
<
VirtualDevice
>
pVDev3
;
VclPtrInstance
<
VirtualDevice
>
pVDev4
(
1
);
VclPtrInstance
<
VirtualDevice
>
pVDev4
(
1
);
...
...
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