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
8f501827
Kaydet (Commit)
8f501827
authored
Haz 22, 2012
tarafından
Noel Grandin
Kaydeden (comit)
Michael Stahl
Haz 25, 2012
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convert class SwOLELRUCache from Svptrarr to std::deque
Change-Id: I9c63a346db6b8ba3d463d5a9d78ccc21b7f6be5f
üst
64fff617
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
ndole.cxx
sw/source/core/ole/ndole.cxx
+19
-20
No files found.
sw/source/core/ole/ndole.cxx
Dosyayı görüntüle @
8f501827
...
@@ -68,7 +68,7 @@ using namespace utl;
...
@@ -68,7 +68,7 @@ using namespace utl;
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
com
::
sun
::
star
::
uno
;
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
;
class
SwOLELRUCache
:
private
SvPtrarr
,
private
utl
::
ConfigItem
class
SwOLELRUCache
:
private
std
::
deque
<
SwOLEObj
*>
,
private
utl
::
ConfigItem
{
{
sal_uInt16
nLRU_InitSize
;
sal_uInt16
nLRU_InitSize
;
sal_Bool
bInUnload
;
sal_Bool
bInUnload
;
...
@@ -83,16 +83,15 @@ public:
...
@@ -83,16 +83,15 @@ public:
void
Load
();
void
Load
();
void
SetInUnload
(
sal_Bool
bFlag
)
{
bInUnload
=
bFlag
;
}
void
SetInUnload
(
sal_Bool
bFlag
)
{
bInUnload
=
bFlag
;
}
using
SvPtrarr
::
Count
;
void
InsertObj
(
SwOLEObj
&
rObj
);
void
InsertObj
(
SwOLEObj
&
rObj
);
void
RemoveObj
(
SwOLEObj
&
rObj
);
void
RemoveObj
(
SwOLEObj
&
rObj
);
void
RemovePtr
(
SwOLEObj
*
pObj
)
void
RemovePtr
(
SwOLEObj
*
pObj
)
{
{
sal_uInt16
nPos
=
SvPtrarr
::
GetPos
(
pObj
);
iterator
it
=
std
::
find
(
begin
(),
end
(),
pObj
);
if
(
USHRT_MAX
!=
nPos
)
if
(
it
!=
end
()
)
SvPtrarr
::
Remove
(
nPos
);
erase
(
it
);
}
}
};
};
...
@@ -898,7 +897,7 @@ String SwOLEObj::GetDescription()
...
@@ -898,7 +897,7 @@ String SwOLEObj::GetDescription()
SwOLELRUCache
::
SwOLELRUCache
()
SwOLELRUCache
::
SwOLELRUCache
()
:
SvPtrarr
(
64
),
:
std
::
deque
<
SwOLEObj
*>
(
),
utl
::
ConfigItem
(
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"Office.Common/Cache"
))),
utl
::
ConfigItem
(
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"Office.Common/Cache"
))),
nLRU_InitSize
(
20
),
nLRU_InitSize
(
20
),
bInUnload
(
sal_False
)
bInUnload
(
sal_False
)
...
@@ -939,13 +938,13 @@ void SwOLELRUCache::Load()
...
@@ -939,13 +938,13 @@ void SwOLELRUCache::Load()
if
(
nVal
<
nLRU_InitSize
)
if
(
nVal
<
nLRU_InitSize
)
{
{
// size of cache has been changed
// size of cache has been changed
sal_uInt16
nCount
=
SvPtrarr
::
Count
();
sal_uInt16
nCount
=
size
();
sal_uInt16
nPos
=
nCount
;
sal_uInt16
nPos
=
nCount
;
// try to remove the last entries until new maximum size is reached
// try to remove the last entries until new maximum size is reached
while
(
nCount
>
nVal
)
while
(
nCount
>
nVal
)
{
{
SwOLEObj
*
pObj
=
(
SwOLEObj
*
)
SvPtrarr
::
GetObject
(
--
nPos
);
SwOLEObj
*
pObj
=
operator
[]
(
--
nPos
);
if
(
pObj
->
UnloadObject
()
)
if
(
pObj
->
UnloadObject
()
)
nCount
--
;
nCount
--
;
if
(
!
nPos
)
if
(
!
nPos
)
...
@@ -961,21 +960,21 @@ void SwOLELRUCache::Load()
...
@@ -961,21 +960,21 @@ void SwOLELRUCache::Load()
void
SwOLELRUCache
::
InsertObj
(
SwOLEObj
&
rObj
)
void
SwOLELRUCache
::
InsertObj
(
SwOLEObj
&
rObj
)
{
{
SwOLEObj
*
pObj
=
&
rObj
;
SwOLEObj
*
pObj
=
&
rObj
;
sal_uInt16
nPos
=
SvPtrarr
::
GetPos
(
pObj
);
iterator
it
=
std
::
find
(
begin
(),
end
(),
pObj
);
if
(
nPos
)
if
(
it
!=
begin
()
)
{
{
// object is currently not the first in cache
// object is currently not the first in cache
if
(
USHRT_MAX
!=
nPos
)
if
(
it
!=
end
()
)
SvPtrarr
::
Remove
(
nPos
);
erase
(
it
);
SvPtrarr
::
Insert
(
pObj
,
0
);
push_front
(
pObj
);
// try to remove objects if necessary (of course not the freshly inserted one at nPos=0)
// try to remove objects if necessary (of course not the freshly inserted one at nPos=0)
sal_uInt16
nCount
=
SvPtrarr
::
Count
();
sal_uInt16
nCount
=
size
();
nPos
=
nCount
-
1
;
sal_uInt16
nPos
=
nCount
-
1
;
while
(
nPos
&&
nCount
>
nLRU_InitSize
)
while
(
nPos
&&
nCount
>
nLRU_InitSize
)
{
{
pObj
=
(
SwOLEObj
*
)
SvPtrarr
::
GetObject
(
nPos
--
);
pObj
=
operator
[]
(
nPos
--
);
if
(
pObj
->
UnloadObject
()
)
if
(
pObj
->
UnloadObject
()
)
nCount
--
;
nCount
--
;
}
}
...
@@ -984,10 +983,10 @@ void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
...
@@ -984,10 +983,10 @@ void SwOLELRUCache::InsertObj( SwOLEObj& rObj )
void
SwOLELRUCache
::
RemoveObj
(
SwOLEObj
&
rObj
)
void
SwOLELRUCache
::
RemoveObj
(
SwOLEObj
&
rObj
)
{
{
sal_uInt16
nPos
=
SvPtrarr
::
GetPos
(
&
rObj
);
iterator
it
=
std
::
find
(
begin
(),
end
(),
&
rObj
);
if
(
nPos
!=
0xFFFF
)
if
(
it
!=
end
()
)
SvPtrarr
::
Remove
(
nPos
);
erase
(
it
);
if
(
!
Count
()
)
if
(
empty
()
)
DELETEZ
(
pOLELRU_Cache
);
DELETEZ
(
pOLELRU_Cache
);
}
}
...
...
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