Kaydet (Commit) ad103b9a authored tarafından Joseph Powers's avatar Joseph Powers

Remove DECLARE_LIST( SvSlotElementList, SvSlotElement* )

Passed: make distclean && make && make check
üst 31b16308
...@@ -44,7 +44,7 @@ struct SvSlotElement ...@@ -44,7 +44,7 @@ struct SvSlotElement
, aPrefix( rPrefix ) , aPrefix( rPrefix )
{} {}
}; };
DECLARE_LIST( SvSlotElementList, SvSlotElement* ) typedef std::vector< SvSlotElement* > SvSlotElementList;
class SvMetaClass; class SvMetaClass;
typedef ::std::vector< SvMetaClass* > SvMetaClassList; typedef ::std::vector< SvMetaClass* > SvMetaClassList;
......
...@@ -82,6 +82,7 @@ class SvMetaSlot : public SvMetaAttribute ...@@ -82,6 +82,7 @@ class SvMetaSlot : public SvMetaAttribute
void WriteSlot( const ByteString & rShellName, void WriteSlot( const ByteString & rShellName,
sal_uInt16 nCount, const ByteString & rSlotId, sal_uInt16 nCount, const ByteString & rSlotId,
SvSlotElementList &rList, SvSlotElementList &rList,
size_t nStart,
const ByteString & rPrefix, const ByteString & rPrefix,
SvIdlDataBase & rBase, SvStream & rOutStm ); SvIdlDataBase & rBase, SvStream & rOutStm );
virtual void Write( SvIdlDataBase & rBase, virtual void Write( SvIdlDataBase & rBase,
...@@ -255,6 +256,7 @@ public: ...@@ -255,6 +256,7 @@ public:
sal_uInt16 WriteSlotMap( const ByteString & rShellName, sal_uInt16 WriteSlotMap( const ByteString & rShellName,
sal_uInt16 nCount, sal_uInt16 nCount,
SvSlotElementList&, SvSlotElementList&,
size_t nStart,
const ByteString &, const ByteString &,
SvIdlDataBase & rBase, SvIdlDataBase & rBase,
SvStream & rOutStm ); SvStream & rOutStm );
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <tools/ref.hxx> #include <tools/ref.hxx>
#include <basobj.hxx> #include <basobj.hxx>
class SvSlotElementList;
struct SvSlotElement; struct SvSlotElement;
typedef std::vector< SvSlotElement* > SvSlotElementList;
SV_DECL_REF(SvMetaType) SV_DECL_REF(SvMetaType)
SV_DECL_REF(SvMetaAttribute) SV_DECL_REF(SvMetaAttribute)
......
...@@ -443,9 +443,9 @@ sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase, ...@@ -443,9 +443,9 @@ sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
SvStream & rOutStm ) SvStream & rOutStm )
{ {
sal_uInt16 nCount = 0; sal_uInt16 nCount = 0;
for( sal_uLong n = 0; n < rSlotList.Count(); n++ ) for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
{ {
SvSlotElement *pEle = rSlotList.GetObject( n ); SvSlotElement *pEle = rSlotList[ i ];
SvMetaSlot *pAttr = pEle->xSlot; SvMetaSlot *pAttr = pEle->xSlot;
nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm ); nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm );
} }
...@@ -459,13 +459,12 @@ sal_uInt16 SvMetaClass::WriteSlots( const ByteString & rShellName, ...@@ -459,13 +459,12 @@ sal_uInt16 SvMetaClass::WriteSlots( const ByteString & rShellName,
SvStream & rOutStm ) SvStream & rOutStm )
{ {
sal_uInt16 nSCount = 0; sal_uInt16 nSCount = 0;
for( sal_uLong n = 0; n < rSlotList.Count(); n++ ) for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
{ {
rSlotList.Seek(n); SvSlotElement * pEle = rSlotList[ i ];
SvSlotElement * pEle = rSlotList.GetCurObject();
SvMetaSlot * pAttr = pEle->xSlot; SvMetaSlot * pAttr = pEle->xSlot;
nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount, nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount,
rSlotList, pEle->aPrefix, rBase, rSlotList, i, pEle->aPrefix, rBase,
rOutStm ); rOutStm );
} }
...@@ -561,9 +560,9 @@ void SvMetaClass::WriteSlotStubs( const ByteString & rShellName, ...@@ -561,9 +560,9 @@ void SvMetaClass::WriteSlotStubs( const ByteString & rShellName,
SvStream & rOutStm ) SvStream & rOutStm )
{ {
// write all attributes // write all attributes
for( sal_uLong n = 0; n < rSlotList.Count(); n++ ) for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
{ {
SvSlotElement *pEle = rSlotList.GetObject( n ); SvSlotElement *pEle = rSlotList[ i ];
SvMetaSlot *pAttr = pEle->xSlot; SvMetaSlot *pAttr = pEle->xSlot;
pAttr->WriteSlotStubs( rShellName, rList, rOutStm ); pAttr->WriteSlotStubs( rShellName, rList, rOutStm );
} }
...@@ -592,14 +591,14 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) ...@@ -592,14 +591,14 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
SvMetaClassList classList; SvMetaClassList classList;
SvSlotElementList aSlotList; SvSlotElementList aSlotList;
InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase); InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase);
for (sal_uInt32 n=0; n<aSlotList.Count(); n++ ) for ( size_t i = 0, n = aSlotList.size(); i < n; ++i )
{ {
SvSlotElement *pEle = aSlotList.GetObject( n ); SvSlotElement *pEle = aSlotList[ i ];
SvMetaSlot *pSlot = pEle->xSlot; SvMetaSlot *pSlot = pEle->xSlot;
pSlot->SetListPos(n); pSlot->SetListPos( i );
} }
sal_uLong nSlotCount = aSlotList.Count(); size_t nSlotCount = aSlotList.size();
// write all attributes // write all attributes
sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm ); sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm );
...@@ -641,16 +640,16 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) ...@@ -641,16 +640,16 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
} }
rOutStm << endl << "};" << endl << "#endif" << endl << endl; rOutStm << endl << "};" << endl << "#endif" << endl << endl;
for( sal_uLong n=0; n<aSlotList.Count(); n++ ) for( size_t i = 0, n = aSlotList.size(); i < n; ++i )
{ {
aSlotList.Seek(n); SvSlotElement* pEle = aSlotList[ i ];
SvSlotElement* pEle = aSlotList.GetCurObject();
SvMetaSlot* pAttr = pEle->xSlot; SvMetaSlot* pAttr = pEle->xSlot;
pAttr->ResetSlotPointer(); pAttr->ResetSlotPointer();
} }
for ( sal_uLong n=0; n<aSlotList.Count(); n++ ) for( size_t i = 0, n = aSlotList.size(); i < n; ++i )
delete aSlotList.GetObject(n); delete aSlotList[ i ];
aSlotList.clear();
} }
void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
......
...@@ -936,14 +936,14 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix, ...@@ -936,14 +936,14 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
{ {
// get insert position through binary search in slotlist // get insert position through binary search in slotlist
sal_uInt16 nId = (sal_uInt16) GetSlotId().GetValue(); sal_uInt16 nId = (sal_uInt16) GetSlotId().GetValue();
sal_uInt16 nListCount = (sal_uInt16) rList.Count(); sal_uInt16 nListCount = (sal_uInt16) rList.size();
sal_uInt16 nPos; sal_uInt16 nPos;
sal_uLong m; // for inner "for" loop sal_uLong m; // for inner "for" loop
if ( !nListCount ) if ( !nListCount )
nPos = 0; nPos = 0;
else if ( nListCount == 1 ) else if ( nListCount == 1 )
nPos = rList.GetObject(0)->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1; nPos = rList[ 0 ]->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1;
else else
{ {
sal_uInt16 nMid = 0, nLow = 0; sal_uInt16 nMid = 0, nLow = 0;
...@@ -953,7 +953,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix, ...@@ -953,7 +953,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
{ {
nMid = (nLow + nHigh) >> 1; nMid = (nLow + nHigh) >> 1;
DBG_ASSERT( nMid < nListCount, "bsearch ist buggy" ); DBG_ASSERT( nMid < nListCount, "bsearch ist buggy" );
int nDiff = (int) nId - (int) rList.GetObject(nMid)->xSlot->GetSlotId().GetValue(); int nDiff = (int) nId - (int) rList[ nMid ]->xSlot->GetSlotId().GetValue();
if ( nDiff < 0) if ( nDiff < 0)
{ {
if ( nMid == 0 ) if ( nMid == 0 )
...@@ -977,16 +977,25 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix, ...@@ -977,16 +977,25 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
DBG_ASSERT( nPos <= nListCount, DBG_ASSERT( nPos <= nListCount,
"nPos too large" ); "nPos too large" );
DBG_ASSERT( nPos == nListCount || nId <= DBG_ASSERT( nPos == nListCount || nId <=
(sal_uInt16) rList.GetObject(nPos)->xSlot->GetSlotId().GetValue(), (sal_uInt16) rList[ nPos ]->xSlot->GetSlotId().GetValue(),
"Successor has lower SlotId" ); "Successor has lower SlotId" );
DBG_ASSERT( nPos == 0 || nId > DBG_ASSERT( nPos == 0 || nId >
(sal_uInt16) rList.GetObject(nPos-1)->xSlot->GetSlotId().GetValue(), (sal_uInt16) rList[ nPos-1 ]->xSlot->GetSlotId().GetValue(),
"Predecessor has higher SlotId" ); "Predecessor has higher SlotId" );
DBG_ASSERT( nPos+1 >= nListCount || nId < DBG_ASSERT( nPos+1 >= nListCount || nId <
(sal_uInt16) rList.GetObject(nPos+1)->xSlot->GetSlotId().GetValue(), (sal_uInt16) rList[ nPos+1 ]->xSlot->GetSlotId().GetValue(),
"Successor has lower SlotId" ); "Successor has lower SlotId" );
rList.Insert( new SvSlotElement( this, rPrefix ), nPos ); if ( nPos < rList.size() )
{
SvSlotElementList::iterator it = rList.begin();
std::advance( it, nPos );
rList.insert( it, new SvSlotElement( this, rPrefix ) );
}
else
{
rList.push_back( new SvSlotElement( this, rPrefix ) );
}
// iron out EnumSlots // iron out EnumSlots
SvMetaTypeEnum * pEnum = NULL; SvMetaTypeEnum * pEnum = NULL;
...@@ -1052,12 +1061,12 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix, ...@@ -1052,12 +1061,12 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
pLinkedSlot = pFirstEnumSlot; pLinkedSlot = pFirstEnumSlot;
// concatenate slaves among themselves // concatenate slaves among themselves
rList.Seek((sal_uLong)0);
xEnumSlot = pFirstEnumSlot; xEnumSlot = pFirstEnumSlot;
size_t i = 0;
SvSlotElement *pEle; SvSlotElement *pEle;
do do
{ {
pEle = rList.Next(); pEle = ( ++i < rList.size() ) ? rList[ i ] : NULL;
if ( pEle && pEle->xSlot->pLinkedSlot == this ) if ( pEle && pEle->xSlot->pLinkedSlot == this )
{ {
xEnumSlot->pNextSlot = pEle->xSlot; xEnumSlot->pNextSlot = pEle->xSlot;
...@@ -1136,6 +1145,7 @@ void SvMetaSlot::WriteSlotStubs( const ByteString & rShellName, ...@@ -1136,6 +1145,7 @@ void SvMetaSlot::WriteSlotStubs( const ByteString & rShellName,
void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount, void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount,
const ByteString & rSlotId, const ByteString & rSlotId,
SvSlotElementList& rSlotList, SvSlotElementList& rSlotList,
size_t nStart,
const ByteString & rPrefix, const ByteString & rPrefix,
SvIdlDataBase & rBase, SvStream & rOutStm ) SvIdlDataBase & rBase, SvStream & rOutStm )
{ {
...@@ -1192,14 +1202,17 @@ void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount, ...@@ -1192,14 +1202,17 @@ void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount,
{ {
// look for the next slot with the same StateMethod like me // look for the next slot with the same StateMethod like me
// the slotlist is set to the current slot // the slotlist is set to the current slot
SvSlotElement * pEle = rSlotList.Next(); size_t i = nStart;
SvSlotElement* pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : NULL;
pNextSlot = pEle ? &pEle->xSlot : NULL; pNextSlot = pEle ? &pEle->xSlot : NULL;
while ( pNextSlot ) while ( pNextSlot )
{ {
if ( !pNextSlot->pNextSlot && if ( !pNextSlot->pNextSlot &&
pNextSlot->GetStateMethod() == GetStateMethod() ) pNextSlot->GetStateMethod() == GetStateMethod()
) {
break; break;
pEle = rSlotList.Next(); }
pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : NULL;
pNextSlot = pEle ? &pEle->xSlot : NULL; pNextSlot = pEle ? &pEle->xSlot : NULL;
} }
...@@ -1207,14 +1220,15 @@ void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount, ...@@ -1207,14 +1220,15 @@ void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount,
{ {
// There is no slot behind me that has the same ExecMethod. // There is no slot behind me that has the same ExecMethod.
// So I search for the first slot with it (could be myself). // So I search for the first slot with it (could be myself).
pEle = rSlotList.First(); i = 0;
pEle = rSlotList.empty() ? NULL : rSlotList[ i ];
pNextSlot = pEle ? &pEle->xSlot : NULL; pNextSlot = pEle ? &pEle->xSlot : NULL;
while ( pNextSlot != this ) while ( pNextSlot != this )
{ {
if ( !pNextSlot->pEnumValue && if ( !pNextSlot->pEnumValue &&
pNextSlot->GetStateMethod() == GetStateMethod() ) pNextSlot->GetStateMethod() == GetStateMethod() )
break; break;
pEle = rSlotList.Next(); pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : NULL;
pNextSlot = pEle ? &pEle->xSlot : NULL; pNextSlot = pEle ? &pEle->xSlot : NULL;
} }
} }
...@@ -1436,6 +1450,7 @@ sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rO ...@@ -1436,6 +1450,7 @@ sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rO
sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 nCount, sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 nCount,
SvSlotElementList& rSlotList, SvSlotElementList& rSlotList,
size_t nStart,
const ByteString & rPrefix, const ByteString & rPrefix,
SvIdlDataBase & rBase, SvIdlDataBase & rBase,
SvStream & rOutStm ) SvStream & rOutStm )
...@@ -1456,7 +1471,7 @@ sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 n ...@@ -1456,7 +1471,7 @@ sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 n
nSCount = (sal_uInt16)pType->GetAttrCount(); nSCount = (sal_uInt16)pType->GetAttrCount();
} }
WriteSlot( rShellName, nCount, slotId, rSlotList, rPrefix, rBase, rOutStm ); WriteSlot( rShellName, nCount, slotId, rSlotList, nStart, rPrefix, rBase, rOutStm );
return nSCount; return nSCount;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment