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
433ae0f6
Kaydet (Commit)
433ae0f6
authored
Agu 15, 2011
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove WordArr and DECL_2BYTEARRAY, used only once.
Instead that, use std::basic_string.
üst
fa77c78a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
315 deletions
+15
-315
minarray.hxx
sfx2/inc/sfx2/minarray.hxx
+0
-65
msgpool.hxx
sfx2/inc/sfx2/msgpool.hxx
+4
-1
minarray.cxx
sfx2/source/bastyp/minarray.cxx
+0
-233
msgpool.cxx
sfx2/source/control/msgpool.cxx
+11
-15
unusedcode.easy
unusedcode.easy
+0
-1
No files found.
sfx2/inc/sfx2/minarray.hxx
Dosyayı görüntüle @
433ae0f6
...
...
@@ -390,71 +390,6 @@ public:\
void Clear() { Remove( 0, Count() ); }\
};
class
WordArr
{
private
:
short
*
pData
;
sal_uInt16
nUsed
;
sal_uInt8
nGrow
;
sal_uInt8
nUnused
;
public
:
WordArr
(
sal_uInt8
nInitSize
=
0
,
sal_uInt8
nGrowSize
=
8
);
WordArr
(
const
WordArr
&
rOrig
);
~
WordArr
();
WordArr
&
operator
=
(
const
WordArr
&
rOrig
);
short
GetObject
(
sal_uInt16
nPos
)
const
{
return
operator
[](
nPos
);
}
short
&
GetObject
(
sal_uInt16
nPos
)
{
return
operator
[](
nPos
);
}
void
Insert
(
sal_uInt16
nPos
,
short
rElem
);
void
Append
(
short
rElem
);
sal_Bool
Remove
(
short
rElem
);
sal_uInt16
Remove
(
sal_uInt16
nPos
,
sal_uInt16
nLen
);
sal_uInt16
Count
()
const
{
return
nUsed
;
}
short
*
operator
*
();
short
operator
[](
sal_uInt16
nPos
)
const
;
short
&
operator
[](
sal_uInt16
nPos
);
sal_Bool
Contains
(
const
short
rItem
)
const
;
void
Clear
()
{
Remove
(
0
,
Count
()
);
}
};
inline
short
*
WordArr
::
operator
*
()
{
return
(
nUsed
==
0
?
0
:
pData
);
}
#define DECL_2BYTEARRAY(ARR, T, nI, nG)\
class ARR: public WordArr\
{\
public:\
ARR( sal_uInt8 nIni=nI, sal_uInt8 nGrowValue=nG ):\
WordArr(nIni,nGrowValue) \
{}\
ARR( const ARR& rOrig ):\
WordArr(rOrig) \
{}\
T GetObject( sal_uInt16 nPos ) const { return operator[](nPos); } \
T& GetObject( sal_uInt16 nPos ) { return operator[](nPos); } \
void Insert( sal_uInt16 nPos, T aElement ) {\
WordArr::Insert(nPos,(short)aElement);\
}\
void Append( T aElement ) {\
WordArr::Append((short)aElement);\
}\
void Remove( T aElement ) {\
WordArr::Remove((short)aElement);\
}\
void Remove( sal_uInt16 nPos, sal_uInt16 nLen = 1 ) {\
WordArr::Remove( nPos, nLen ); \
}\
T* operator *() {\
return (T*) WordArr::operator*();\
}\
T operator[]( sal_uInt16 nPos ) const { \
return (T) WordArr::operator[](nPos); } \
T& operator[]( sal_uInt16 nPos ) { \
return (T&) WordArr::operator[](nPos); } \
void Clear() { Remove( 0, Count() ); }\
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sfx2/inc/sfx2/msgpool.hxx
Dosyayı görüntüle @
433ae0f6
...
...
@@ -36,13 +36,16 @@
#include <tools/string.hxx>
#include <svl/svarray.hxx>
#include <string>
class
SfxInterface
;
class
SfxSlot
;
class
SfxInterfaceArr_Impl
;
class
SfxSlotGroupArr_Impl
;
class
SfxSlotTypeArr_Impl
;
class
SfxSlotArr_Impl
;
typedef
std
::
basic_string
<
sal_uInt16
>
SfxSlotGroupArr_Impl
;
//=========================================================================
class
SFX2_DLLPUBLIC
SfxSlotPool
...
...
sfx2/source/bastyp/minarray.cxx
Dosyayı görüntüle @
433ae0f6
...
...
@@ -267,237 +267,4 @@ void SfxPtrArr::Insert( sal_uInt16 nPos, void* rElem )
nUnused
-=
1
;
}
// class WordArr ---------------------------------------------------------
WordArr
::
WordArr
(
sal_uInt8
nInitSize
,
sal_uInt8
nGrowSize
)
:
nUsed
(
0
),
nGrow
(
nGrowSize
?
nGrowSize
:
1
),
nUnused
(
nInitSize
)
{
DBG_MEMTEST
();
sal_uInt16
nMSCBug
=
nInitSize
;
if
(
nInitSize
>
0
)
pData
=
new
short
[
nMSCBug
];
else
pData
=
0
;
}
// -----------------------------------------------------------------------
WordArr
::
WordArr
(
const
WordArr
&
rOrig
)
{
DBG_MEMTEST
();
nUsed
=
rOrig
.
nUsed
;
nGrow
=
rOrig
.
nGrow
;
nUnused
=
rOrig
.
nUnused
;
if
(
rOrig
.
pData
!=
0
)
{
pData
=
new
short
[
nUsed
+
nUnused
];
memcpy
(
pData
,
rOrig
.
pData
,
nUsed
*
sizeof
(
short
)
);
}
else
pData
=
0
;
}
// -----------------------------------------------------------------------
WordArr
::~
WordArr
()
{
DBG_MEMTEST
();
delete
[]
pData
;
}
// -----------------------------------------------------------------------
WordArr
&
WordArr
::
operator
=
(
const
WordArr
&
rOrig
)
{
DBG_MEMTEST
();
delete
[]
pData
;
nUsed
=
rOrig
.
nUsed
;
nGrow
=
rOrig
.
nGrow
;
nUnused
=
rOrig
.
nUnused
;
if
(
rOrig
.
pData
!=
0
)
{
pData
=
new
short
[
nUsed
+
nUnused
];
memcpy
(
pData
,
rOrig
.
pData
,
nUsed
*
sizeof
(
short
)
);
}
else
pData
=
0
;
return
*
this
;
}
// -----------------------------------------------------------------------
void
WordArr
::
Append
(
short
aElem
)
{
DBG_MEMTEST
();
// Does the Array need to be copied?
if
(
nUnused
==
0
)
{
sal_uInt16
nNewSize
=
(
nUsed
==
1
)
?
(
nGrow
==
1
?
2
:
nGrow
)
:
nUsed
+
nGrow
;
short
*
pNewData
=
new
short
[
nNewSize
];
if
(
pData
)
{
DBG_ASSERT
(
nUsed
<=
nNewSize
,
" "
);
memmove
(
pNewData
,
pData
,
sizeof
(
short
)
*
nUsed
);
delete
[]
pData
;
}
nUnused
=
sal
::
static_int_cast
<
sal_uInt8
>
(
nNewSize
-
nUsed
);
pData
=
pNewData
;
}
// now write at the back in the open space
pData
[
nUsed
]
=
aElem
;
++
nUsed
;
--
nUnused
;
}
// -----------------------------------------------------------------------
sal_uInt16
WordArr
::
Remove
(
sal_uInt16
nPos
,
sal_uInt16
nLen
)
{
DBG_MEMTEST
();
// Adjust nLen, thus to avoid deleting beyond the end
nLen
=
Min
(
(
sal_uInt16
)(
nUsed
-
nPos
),
nLen
);
// simple problems require simple solutions!
if
(
nLen
==
0
)
return
0
;
// Maybe no one will remain
if
(
(
nUsed
-
nLen
)
==
0
)
{
delete
[]
pData
;
pData
=
0
;
nUsed
=
0
;
nUnused
=
0
;
return
nLen
;
}
// Determine whether the array has physically shrunk...
if
(
(
nUnused
+
nLen
)
>=
nGrow
)
{
// reduce (rounded up) to the next Grow-border
sal_uInt16
nNewUsed
=
nUsed
-
nLen
;
sal_uInt16
nNewSize
=
((
nNewUsed
+
nGrow
-
1
)
/
nGrow
)
*
nGrow
;
DBG_ASSERT
(
nNewUsed
<=
nNewSize
&&
nNewUsed
+
nGrow
>
nNewSize
,
"shrink size computation failed"
);
short
*
pNewData
=
new
short
[
nNewSize
];
if
(
nPos
>
0
)
{
DBG_ASSERT
(
nPos
<=
nNewSize
,
""
);
memmove
(
pNewData
,
pData
,
sizeof
(
short
)
*
nPos
);
}
if
(
nNewUsed
!=
nPos
)
memmove
(
pNewData
+
nPos
,
pData
+
nPos
+
nLen
,
sizeof
(
short
)
*
(
nNewUsed
-
nPos
)
);
delete
[]
pData
;
pData
=
pNewData
;
nUsed
=
nNewUsed
;
nUnused
=
sal
::
static_int_cast
<
sal_uInt8
>
(
nNewSize
-
nNewUsed
);
return
nLen
;
}
// in all other cases, only push together
if
(
nUsed
-
nPos
-
nLen
>
0
)
memmove
(
pData
+
nPos
,
pData
+
nPos
+
nLen
,
(
nUsed
-
nPos
-
nLen
)
*
sizeof
(
short
)
);
nUsed
=
nUsed
-
nLen
;
nUnused
=
sal
::
static_int_cast
<
sal_uInt8
>
(
nUnused
+
nLen
);
return
nLen
;
}
// -----------------------------------------------------------------------
sal_Bool
WordArr
::
Remove
(
short
aElem
)
{
DBG_MEMTEST
();
// simple tasks ...
if
(
nUsed
==
0
)
return
sal_False
;
// backwards, since most of the last is first removed
short
*
pIter
=
pData
+
nUsed
-
1
;
for
(
sal_uInt16
n
=
0
;
n
<
nUsed
;
++
n
,
--
pIter
)
if
(
*
pIter
==
aElem
)
{
Remove
(
nUsed
-
n
-
1
,
1
);
return
sal_True
;
}
return
sal_False
;
}
// -----------------------------------------------------------------------
sal_Bool
WordArr
::
Contains
(
const
short
rItem
)
const
{
DBG_MEMTEST
();
if
(
!
nUsed
)
return
sal_False
;
for
(
sal_uInt16
n
=
0
;
n
<
nUsed
;
++
n
)
{
short
p
=
GetObject
(
n
);
if
(
p
==
rItem
)
return
sal_True
;
}
return
sal_False
;
}
// -----------------------------------------------------------------------
void
WordArr
::
Insert
(
sal_uInt16
nPos
,
short
rElem
)
{
DBG_MEMTEST
();
// Does the Array need to be copied?
if
(
nUnused
==
0
)
{
// increase (rounded up) to the next Grow-border
sal_uInt16
nNewSize
=
nUsed
+
nGrow
;
short
*
pNewData
=
new
short
[
nNewSize
];
if
(
pData
)
{
DBG_ASSERT
(
nUsed
<
nNewSize
,
""
);
memmove
(
pNewData
,
pData
,
sizeof
(
short
)
*
nUsed
);
delete
[]
pData
;
}
nUnused
=
sal
::
static_int_cast
<
sal_uInt8
>
(
nNewSize
-
nUsed
);
pData
=
pNewData
;
}
// Now move the rear part
if
(
nPos
<
nUsed
)
memmove
(
pData
+
nPos
+
1
,
pData
+
nPos
,
(
nUsed
-
nPos
)
*
sizeof
(
short
)
);
// now write at the back in the open space
memmove
(
pData
+
nPos
,
&
rElem
,
sizeof
(
short
)
);
nUsed
+=
1
;
nUnused
-=
1
;
}
// -----------------------------------------------------------------------
short
WordArr
::
operator
[](
sal_uInt16
nPos
)
const
{
DBG_MEMTEST
();
DBG_ASSERT
(
nPos
<
nUsed
,
""
);
return
*
(
pData
+
nPos
);
}
// -----------------------------------------------------------------------
short
&
WordArr
::
operator
[]
(
sal_uInt16
nPos
)
{
DBG_MEMTEST
();
DBG_ASSERT
(
nPos
<
nUsed
,
""
);
return
*
(
pData
+
nPos
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sfx2/source/control/msgpool.cxx
Dosyayı görüntüle @
433ae0f6
...
...
@@ -57,11 +57,9 @@ struct SfxSlotType_Impl
{}
};
DECL_2BYTEARRAY
(
SfxSlotGroupArr_Impl
,
sal_uInt16
,
6
,
4
)
DECL_PTRARRAY
(
SfxInterfaceArr_Impl
,
SfxInterface
*
,
6
,
3
)
DECL_PTRARRAY
(
SfxSlotTypeArr_Impl
,
SfxSlotType_Impl
*
,
8
,
8
)
//====================================================================
SfxSlotPool
::
SfxSlotPool
(
SfxSlotPool
*
pParent
,
ResMgr
*
pResManager
)
...
...
@@ -121,9 +119,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface )
if
(
_pParentPool
)
{
// The Groups in parent Slotpool are also known here
SfxSlotGroupArr_Impl
&
rGroups
=
*
_pParentPool
->
_pGroups
;
for
(
sal_uInt16
n
=
0
;
n
<
rGroups
.
Count
();
n
++
)
_pGroups
->
Append
(
rGroups
[
n
]
);
_pGroups
->
append
(
*
_pParentPool
->
_pGroups
);
}
}
...
...
@@ -133,12 +129,12 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface )
{
SfxSlot
*
pDef
=
rInterface
[
nFunc
];
if
(
pDef
->
GetGroupId
()
&&
/* pDef->GetGroupId() != GID_INTERN && */
!
_pGroups
->
Contains
(
pDef
->
GetGroupId
())
)
_pGroups
->
find
(
pDef
->
GetGroupId
())
==
SfxSlotGroupArr_Impl
::
npos
)
{
if
(
pDef
->
GetGroupId
()
==
GID_INTERN
)
_pGroups
->
Insert
(
0
,
pDef
->
GetGroupId
());
_pGroups
->
insert
(
_pGroups
->
begin
()
,
pDef
->
GetGroupId
());
else
_pGroups
->
Append
(
pDef
->
GetGroupId
());
_pGroups
->
push_back
(
pDef
->
GetGroupId
());
}
}
}
...
...
@@ -193,13 +189,13 @@ String SfxSlotPool::SeekGroup( sal_uInt16 nNo )
DBG_ASSERT
(
_pInterfaces
!=
0
,
"no Interfaces registered"
);
// if the group exists, use it
if
(
_pGroups
&&
nNo
<
_pGroups
->
Count
()
)
if
(
_pGroups
&&
nNo
<
_pGroups
->
size
()
)
{
_nCurGroup
=
nNo
;
if
(
_pParentPool
)
{
// In most cases, the order of the IDs agree
sal_uInt16
nParentCount
=
_pParentPool
->
_pGroups
->
Count
();
sal_uInt16
nParentCount
=
_pParentPool
->
_pGroups
->
size
();
if
(
nNo
<
nParentCount
&&
(
*
_pGroups
)[
nNo
]
==
(
*
_pParentPool
->
_pGroups
)[
nNo
]
)
_pParentPool
->
_nCurGroup
=
nNo
;
else
...
...
@@ -233,7 +229,7 @@ String SfxSlotPool::SeekGroup( sal_uInt16 nNo )
sal_uInt16
SfxSlotPool
::
GetGroupCount
()
{
return
_pGroups
->
Count
();
return
_pGroups
->
size
();
}
...
...
@@ -251,7 +247,7 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface )
// have reached the end of the Parent-Pools?
if
(
nStartInterface
<
nFirstInterface
&&
_pParentPool
->
_nCurGroup
>=
_pParentPool
->
_pGroups
->
Count
()
)
_pParentPool
->
_nCurGroup
>=
_pParentPool
->
_pGroups
->
size
()
)
nStartInterface
=
nFirstInterface
;
// Is the Interface still in the Parent-Pool?
...
...
@@ -274,7 +270,7 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 nStartInterface )
++
_nCurMsg
)
{
const
SfxSlot
*
pMsg
=
(
*
pInterface
)[
_nCurMsg
];
if
(
pMsg
->
GetGroupId
()
==
_pGroups
->
GetObjec
t
(
_nCurGroup
)
)
if
(
pMsg
->
GetGroupId
()
==
_pGroups
->
a
t
(
_nCurGroup
)
)
return
pMsg
;
}
}
...
...
@@ -293,7 +289,7 @@ const SfxSlot* SfxSlotPool::NextSlot()
// The numbering starts at the interfaces of the parent pool
sal_uInt16
nFirstInterface
=
_pParentPool
?
_pParentPool
->
_pInterfaces
->
Count
()
:
0
;
if
(
_nCurInterface
<
nFirstInterface
&&
_nCurGroup
>=
_pParentPool
->
_pGroups
->
Count
()
)
if
(
_nCurInterface
<
nFirstInterface
&&
_nCurGroup
>=
_pParentPool
->
_pGroups
->
size
()
)
_nCurInterface
=
nFirstInterface
;
if
(
_nCurInterface
<
nFirstInterface
)
...
...
@@ -318,7 +314,7 @@ const SfxSlot* SfxSlotPool::NextSlot()
while
(
++
_nCurMsg
<
pInterface
->
Count
()
)
{
SfxSlot
*
pMsg
=
(
*
pInterface
)[
_nCurMsg
];
if
(
pMsg
->
GetGroupId
()
==
_pGroups
->
GetObjec
t
(
_nCurGroup
)
)
if
(
pMsg
->
GetGroupId
()
==
_pGroups
->
a
t
(
_nCurGroup
)
)
return
pMsg
;
}
...
...
unusedcode.easy
Dosyayı görüntüle @
433ae0f6
...
...
@@ -1790,7 +1790,6 @@ WindowArrange::Arrange(unsigned short, Rectangle const&)
WindowArrange::WindowArrange()
WindowArrange::~WindowArrange()
WizardDialog::IsButtonFixedLineVisible()
WordArr::Remove(short)
WrongRanges::Insert(WrongRanges const*, unsigned short, unsigned short, unsigned short)
WrongRanges::Replace(WrongRange const&, unsigned short)
WrongRanges::Replace(WrongRange const*, unsigned short, unsigned short)
...
...
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