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
92261a33
Kaydet (Commit)
92261a33
authored
Nis 03, 2013
tarafından
Thomas Arnhold
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#62525: use cow_wrapper for StrokeAttribute
Change-Id: Icf5daca279902b90da98069338638c3ad432e69a
üst
8ee042bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
63 deletions
+24
-63
strokeattribute.hxx
drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx
+5
-2
strokeattribute.cxx
drawinglayer/source/attribute/strokeattribute.cxx
+19
-61
No files found.
drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx
Dosyayı görüntüle @
92261a33
...
...
@@ -21,7 +21,7 @@
#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
#include <drawinglayer/drawinglayerdllapi.h>
#include <o3tl/cow_wrapper.hxx>
#include <vector>
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -39,8 +39,11 @@ namespace drawinglayer
{
class
DRAWINGLAYER_DLLPUBLIC
StrokeAttribute
{
public
:
typedef
o3tl
::
cow_wrapper
<
ImpStrokeAttribute
>
ImplType
;
private
:
Imp
StrokeAttribute
*
mpStrokeAttribute
;
Imp
lType
mpStrokeAttribute
;
public
:
/// constructors/assignmentoperator/destructor
...
...
drawinglayer/source/attribute/strokeattribute.cxx
Dosyayı görüntüle @
92261a33
...
...
@@ -18,6 +18,7 @@
*/
#include <drawinglayer/attribute/strokeattribute.hxx>
#include <rtl/instance.hxx>
#include <numeric>
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -29,9 +30,6 @@ namespace drawinglayer
class
ImpStrokeAttribute
{
public
:
// refcounter
sal_uInt32
mnRefCount
;
// data definitions
::
std
::
vector
<
double
>
maDotDashArray
;
// array of double which defines the dot-dash pattern
double
mfFullDotDashLen
;
// sum of maDotDashArray (for convenience)
...
...
@@ -39,12 +37,17 @@ namespace drawinglayer
ImpStrokeAttribute
(
const
::
std
::
vector
<
double
>&
rDotDashArray
,
double
fFullDotDashLen
)
:
mnRefCount
(
0
),
maDotDashArray
(
rDotDashArray
),
:
maDotDashArray
(
rDotDashArray
),
mfFullDotDashLen
(
fFullDotDashLen
)
{
}
ImpStrokeAttribute
()
:
maDotDashArray
(
std
::
vector
<
double
>
()),
mfFullDotDashLen
(
0.0
)
{
}
// data read access
const
::
std
::
vector
<
double
>&
getDotDashArray
()
const
{
return
maDotDashArray
;
}
double
getFullDotDashLen
()
const
...
...
@@ -64,95 +67,50 @@ namespace drawinglayer
return
(
getDotDashArray
()
==
rCandidate
.
getDotDashArray
()
&&
getFullDotDashLen
()
==
rCandidate
.
getFullDotDashLen
());
}
static
ImpStrokeAttribute
*
get_global_default
()
{
static
ImpStrokeAttribute
*
pDefault
=
0
;
if
(
!
pDefault
)
{
pDefault
=
new
ImpStrokeAttribute
(
std
::
vector
<
double
>
(),
0.0
);
// never delete; start with RefCount 1, not 0
pDefault
->
mnRefCount
++
;
}
return
pDefault
;
}
};
namespace
{
struct
theGlobalDefault
:
public
rtl
::
Static
<
StrokeAttribute
::
ImplType
,
theGlobalDefault
>
{};
}
StrokeAttribute
::
StrokeAttribute
(
const
::
std
::
vector
<
double
>&
rDotDashArray
,
double
fFullDotDashLen
)
:
mpStrokeAttribute
(
new
ImpStrokeAttribute
(
:
mpStrokeAttribute
(
ImpStrokeAttribute
(
rDotDashArray
,
fFullDotDashLen
))
{
}
StrokeAttribute
::
StrokeAttribute
()
:
mpStrokeAttribute
(
ImpStrokeAttribute
::
get_global_defaul
t
())
:
mpStrokeAttribute
(
theGlobalDefault
::
ge
t
())
{
mpStrokeAttribute
->
mnRefCount
++
;
}
StrokeAttribute
::
StrokeAttribute
(
const
StrokeAttribute
&
rCandidate
)
:
mpStrokeAttribute
(
rCandidate
.
mpStrokeAttribute
)
{
mpStrokeAttribute
->
mnRefCount
++
;
}
StrokeAttribute
::~
StrokeAttribute
()
{
if
(
mpStrokeAttribute
->
mnRefCount
)
{
mpStrokeAttribute
->
mnRefCount
--
;
}
else
{
delete
mpStrokeAttribute
;
}
}
bool
StrokeAttribute
::
isDefault
()
const
{
return
mpStrokeAttribute
==
ImpStrokeAttribute
::
get_global_default
(
);
return
mpStrokeAttribute
.
same_object
(
theGlobalDefault
::
get
()
);
}
StrokeAttribute
&
StrokeAttribute
::
operator
=
(
const
StrokeAttribute
&
rCandidate
)
{
if
(
rCandidate
.
mpStrokeAttribute
!=
mpStrokeAttribute
)
{
if
(
mpStrokeAttribute
->
mnRefCount
)
{
mpStrokeAttribute
->
mnRefCount
--
;
}
else
{
delete
mpStrokeAttribute
;
}
mpStrokeAttribute
=
rCandidate
.
mpStrokeAttribute
;
mpStrokeAttribute
->
mnRefCount
++
;
}
mpStrokeAttribute
=
rCandidate
.
mpStrokeAttribute
;
return
*
this
;
}
bool
StrokeAttribute
::
operator
==
(
const
StrokeAttribute
&
rCandidate
)
const
{
if
(
rCandidate
.
mpStrokeAttribute
==
mpStrokeAttribute
)
{
return
true
;
}
if
(
rCandidate
.
isDefault
()
!=
isDefault
())
{
return
false
;
}
return
(
*
rCandidate
.
mpStrokeAttribute
==
*
mpStrokeAttribute
);
return
rCandidate
.
mpStrokeAttribute
==
mpStrokeAttribute
;
}
const
::
std
::
vector
<
double
>&
StrokeAttribute
::
getDotDashArray
()
const
...
...
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