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
63de1888
Kaydet (Commit)
63de1888
authored
Tem 20, 2015
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
svtools: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I37cf472e7558ffd7714659436b78851caa187945
üst
1b7ab966
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
26 deletions
+26
-26
treelistentry.hxx
include/svtools/treelistentry.hxx
+4
-3
treelistentry.cxx
svtools/source/contnr/treelistentry.cxx
+22
-23
No files found.
include/svtools/treelistentry.hxx
Dosyayı görüntüle @
63de1888
...
...
@@ -26,7 +26,8 @@
#include <svtools/treelistentries.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <vector>
#include <memory>
// flags related to the model
enum
class
SvTLEntryFlags
...
...
@@ -53,13 +54,13 @@ class SVT_DLLPUBLIC SvTreeListEntry
friend
class
SvListView
;
friend
class
SvTreeListBox
;
typedef
boost
::
ptr_vector
<
SvLBoxItem
>
ItemsType
;
typedef
std
::
vector
<
std
::
unique_ptr
<
SvLBoxItem
>
>
ItemsType
;
SvTreeListEntry
*
pParent
;
SvTreeListEntries
maChildren
;
sal_uLong
nAbsPos
;
sal_uLong
nListPos
;
ItemsType
m
a
Items
;
ItemsType
m
_
Items
;
bool
bIsMarked
;
void
*
pUserData
;
SvTLEntryFlags
nEntryFlags
;
...
...
svtools/source/contnr/treelistentry.cxx
Dosyayı görüntüle @
63de1888
...
...
@@ -82,7 +82,7 @@ SvTreeListEntry::~SvTreeListEntry()
#endif
maChildren
.
clear
();
m
a
Items
.
clear
();
m
_
Items
.
clear
();
}
bool
SvTreeListEntry
::
HasChildren
()
const
...
...
@@ -112,14 +112,13 @@ void SvTreeListEntry::Clone(SvTreeListEntry* pSource)
nListPos
|=
(
pSource
->
nListPos
&
0x7fffffff
);
nAbsPos
=
pSource
->
nAbsPos
;
maItems
.
clear
();
ItemsType
::
iterator
it
=
pSource
->
maItems
.
begin
(),
itEnd
=
pSource
->
maItems
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
m_Items
.
clear
();
for
(
auto
const
&
it
:
pSource
->
m_Items
)
{
SvLBoxItem
*
pItem
=
&
(
*
it
);
SvLBoxItem
*
pNewItem
=
pItem
->
Create
(
);
std
::
unique_ptr
<
SvLBoxItem
>
pNewItem
(
pItem
->
Create
()
);
pNewItem
->
Clone
(
pItem
);
m
aItems
.
push_back
(
pNewItem
);
m
_Items
.
push_back
(
std
::
move
(
pNewItem
)
);
}
pUserData
=
pSource
->
GetUserData
();
...
...
@@ -128,12 +127,12 @@ void SvTreeListEntry::Clone(SvTreeListEntry* pSource)
size_t
SvTreeListEntry
::
ItemCount
()
const
{
return
m
a
Items
.
size
();
return
m
_
Items
.
size
();
}
void
SvTreeListEntry
::
AddItem
(
SvLBoxItem
*
pItem
)
{
m
aItems
.
push_back
(
pItem
);
m
_Items
.
push_back
(
std
::
unique_ptr
<
SvLBoxItem
>
(
pItem
)
);
}
void
SvTreeListEntry
::
EnableChildrenOnDemand
(
bool
bEnable
)
...
...
@@ -147,25 +146,25 @@ void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
void
SvTreeListEntry
::
ReplaceItem
(
SvLBoxItem
*
pNewItem
,
size_t
nPos
)
{
DBG_ASSERT
(
pNewItem
,
"ReplaceItem:No Item"
);
if
(
nPos
>=
m
a
Items
.
size
())
if
(
nPos
>=
m
_
Items
.
size
())
{
// Out of bound. Bail out.
delete
pNewItem
;
return
;
}
m
aItems
.
erase
(
ma
Items
.
begin
()
+
nPos
);
m
aItems
.
insert
(
maItems
.
begin
()
+
nPos
,
pNewItem
);
m
_Items
.
erase
(
m_
Items
.
begin
()
+
nPos
);
m
_Items
.
insert
(
m_Items
.
begin
()
+
nPos
,
std
::
unique_ptr
<
SvLBoxItem
>
(
pNewItem
)
);
}
const
SvLBoxItem
&
SvTreeListEntry
::
GetItem
(
size_t
nPos
)
const
{
return
ma
Items
[
nPos
];
return
*
m_
Items
[
nPos
];
}
SvLBoxItem
&
SvTreeListEntry
::
GetItem
(
size_t
nPos
)
{
return
ma
Items
[
nPos
];
return
*
m_
Items
[
nPos
];
}
namespace
{
...
...
@@ -175,9 +174,9 @@ class FindByType : std::unary_function<SvLBoxItem, void>
sal_uInt16
mnId
;
public
:
explicit
FindByType
(
sal_uInt16
nId
)
:
mnId
(
nId
)
{}
bool
operator
()
(
const
SvLBoxItem
&
r
Item
)
const
bool
operator
()
(
const
std
::
unique_ptr
<
SvLBoxItem
>&
rp
Item
)
const
{
return
r
Item
.
GetType
()
==
mnId
;
return
r
pItem
->
GetType
()
==
mnId
;
}
};
...
...
@@ -186,9 +185,9 @@ class FindByPointer : std::unary_function<SvLBoxItem, void>
const
SvLBoxItem
*
mpItem
;
public
:
explicit
FindByPointer
(
const
SvLBoxItem
*
p
)
:
mpItem
(
p
)
{}
bool
operator
()
(
const
SvLBoxItem
&
r
Item
)
const
bool
operator
()
(
const
std
::
unique_ptr
<
SvLBoxItem
>&
rp
Item
)
const
{
return
&
rItem
==
mpItem
;
return
rpItem
.
get
()
==
mpItem
;
}
};
...
...
@@ -196,20 +195,20 @@ public:
const
SvLBoxItem
*
SvTreeListEntry
::
GetFirstItem
(
sal_uInt16
nId
)
const
{
ItemsType
::
const_iterator
it
=
std
::
find_if
(
m
aItems
.
begin
(),
ma
Items
.
end
(),
FindByType
(
nId
));
return
it
==
maItems
.
end
()
?
NULL
:
&
(
*
it
);
ItemsType
::
const_iterator
it
=
std
::
find_if
(
m
_Items
.
begin
(),
m_
Items
.
end
(),
FindByType
(
nId
));
return
(
it
==
m_Items
.
end
())
?
nullptr
:
(
*
it
).
get
(
);
}
SvLBoxItem
*
SvTreeListEntry
::
GetFirstItem
(
sal_uInt16
nId
)
{
ItemsType
::
iterator
it
=
std
::
find_if
(
m
aItems
.
begin
(),
ma
Items
.
end
(),
FindByType
(
nId
));
return
it
==
maItems
.
end
()
?
NULL
:
&
(
*
it
);
ItemsType
::
iterator
it
=
std
::
find_if
(
m
_Items
.
begin
(),
m_
Items
.
end
(),
FindByType
(
nId
));
return
(
it
==
m_Items
.
end
())
?
nullptr
:
(
*
it
).
get
(
);
}
size_t
SvTreeListEntry
::
GetPos
(
const
SvLBoxItem
*
pItem
)
const
{
ItemsType
::
const_iterator
it
=
std
::
find_if
(
m
aItems
.
begin
(),
ma
Items
.
end
(),
FindByPointer
(
pItem
));
return
it
==
m
aItems
.
end
()
?
ITEM_NOT_FOUND
:
std
::
distance
(
ma
Items
.
begin
(),
it
);
ItemsType
::
const_iterator
it
=
std
::
find_if
(
m
_Items
.
begin
(),
m_
Items
.
end
(),
FindByPointer
(
pItem
));
return
it
==
m
_Items
.
end
()
?
ITEM_NOT_FOUND
:
std
::
distance
(
m_
Items
.
begin
(),
it
);
}
...
...
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