diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-09 09:05:07 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-09 09:43:53 +0200 |
commit | 8bbcbcec91f723a3839bd80aa1d28e0420dfd1e6 (patch) | |
tree | f4a8ad644f900ce74e0ae4dc064502b39e21e3ad /idl/source | |
parent | 8d6e4896d9485aec0def2d23b90d02c750ffce01 (diff) |
simplify SvSlotElement
Change-Id: I4699dca35c0197944df97005ff032e1d16139e5f
Diffstat (limited to 'idl/source')
-rw-r--r-- | idl/source/objects/object.cxx | 17 | ||||
-rw-r--r-- | idl/source/objects/slot.cxx | 32 |
2 files changed, 21 insertions, 28 deletions
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index eedc6ebbe07a..4f29c9419212 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -201,8 +201,7 @@ sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase, sal_uInt16 nCount = 0; for ( size_t i = 0, n = rSlotList.size(); i < n; ++i ) { - SvSlotElement *pEle = rSlotList[ i ]; - SvMetaSlot *pAttr = pEle->xSlot; + SvMetaSlot *pAttr = rSlotList[ i ]; nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm ); } @@ -217,8 +216,7 @@ sal_uInt16 SvMetaClass::WriteSlots( const OString& rShellName, sal_uInt16 nSCount = 0; for ( size_t i = 0, n = rSlotList.size(); i < n; ++i ) { - SvSlotElement * pEle = rSlotList[ i ]; - SvMetaSlot * pAttr = pEle->xSlot; + SvMetaSlot * pAttr = rSlotList[ i ]; nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount, rSlotList, i, rBase, rOutStm ); @@ -319,8 +317,7 @@ void SvMetaClass::WriteSlotStubs( const OString& rShellName, // write all attributes for ( size_t i = 0, n = rSlotList.size(); i < n; ++i ) { - SvSlotElement *pEle = rSlotList[ i ]; - SvMetaSlot *pAttr = pEle->xSlot; + SvMetaSlot *pAttr = rSlotList[ i ]; pAttr->WriteSlotStubs( rShellName, rList, rOutStm ); } } @@ -350,8 +347,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) InsertSlots(aSlotList, aSuperList, classList, OString(), rBase); for ( size_t i = 0, n = aSlotList.size(); i < n; ++i ) { - SvSlotElement *pEle = aSlotList[ i ]; - SvMetaSlot *pSlot = pEle->xSlot; + SvMetaSlot *pSlot = aSlotList[ i ]; pSlot->SetListPos( i ); } @@ -402,13 +398,10 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) for( size_t i = 0, n = aSlotList.size(); i < n; ++i ) { - SvSlotElement* pEle = aSlotList[ i ]; - SvMetaSlot* pAttr = pEle->xSlot; + SvMetaSlot* pAttr = aSlotList[ i ]; pAttr->ResetSlotPointer(); } - for( size_t i = 0, n = aSlotList.size(); i < n; ++i ) - delete aSlotList[ i ]; aSlotList.clear(); } diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 5ed8b11b5d80..06b06955c1d8 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -423,7 +423,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const OString& rPrefix, if ( !nListCount ) nPos = 0; else if ( nListCount == 1 ) - nPos = rList[ 0 ]->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1; + nPos = rList[ 0 ]->GetSlotId().GetValue() >= nId ? 0 : 1; else { sal_uInt16 nMid = 0, nLow = 0; @@ -433,7 +433,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const OString& rPrefix, { nMid = (nLow + nHigh) >> 1; DBG_ASSERT( nMid < nListCount, "bsearch ist buggy" ); - int nDiff = (int) nId - (int) rList[ nMid ]->xSlot->GetSlotId().GetValue(); + int nDiff = (int) nId - (int) rList[ nMid ]->GetSlotId().GetValue(); if ( nDiff < 0) { if ( nMid == 0 ) @@ -457,24 +457,24 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const OString& rPrefix, DBG_ASSERT( nPos <= nListCount, "nPos too large" ); DBG_ASSERT( nPos == nListCount || nId <= - (sal_uInt16) rList[ nPos ]->xSlot->GetSlotId().GetValue(), + (sal_uInt16) rList[ nPos ]->GetSlotId().GetValue(), "Successor has lower SlotId" ); DBG_ASSERT( nPos == 0 || nId > - (sal_uInt16) rList[ nPos-1 ]->xSlot->GetSlotId().GetValue(), + (sal_uInt16) rList[ nPos-1 ]->GetSlotId().GetValue(), "Predecessor has higher SlotId" ); DBG_ASSERT( nPos+1 >= nListCount || nId < - (sal_uInt16) rList[ nPos+1 ]->xSlot->GetSlotId().GetValue(), + (sal_uInt16) rList[ nPos+1 ]->GetSlotId().GetValue(), "Successor has lower SlotId" ); if ( nPos < rList.size() ) { SvSlotElementList::iterator it = rList.begin(); std::advance( it, nPos ); - rList.insert( it, new SvSlotElement( this ) ); + rList.insert( it, this ); } else { - rList.push_back( new SvSlotElement( this ) ); + rList.push_back( this ); } // iron out EnumSlots @@ -547,14 +547,14 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const OString& rPrefix, // concatenate slaves among themselves xEnumSlot = pFirstEnumSlot; size_t i = 0; - SvSlotElement *pEle; + SvMetaSlot* pEle; do { pEle = ( ++i < rList.size() ) ? rList[ i ] : nullptr; - if ( pEle && pEle->xSlot->pLinkedSlot == this ) + if ( pEle && pEle->pLinkedSlot == this ) { - xEnumSlot->pNextSlot = pEle->xSlot; - xEnumSlot = pEle->xSlot; + xEnumSlot->pNextSlot = pEle; + xEnumSlot = pEle; } } while ( pEle ); @@ -685,8 +685,8 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, // look for the next slot with the same StateMethod like me // the slotlist is set to the current slot size_t i = nStart; - SvSlotElement* pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : nullptr; - pNextSlot = pEle ? &pEle->xSlot : nullptr; + SvMetaSlot* pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : nullptr; + pNextSlot = pEle; while ( pNextSlot ) { if ( !pNextSlot->pNextSlot && @@ -695,7 +695,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, break; } pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : nullptr; - pNextSlot = pEle ? &pEle->xSlot : nullptr; + pNextSlot = pEle; } if ( !pNextSlot ) @@ -704,14 +704,14 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, // So I search for the first slot with it (could be myself). i = 0; pEle = rSlotList.empty() ? nullptr : rSlotList[ i ]; - pNextSlot = pEle ? &pEle->xSlot : nullptr; + pNextSlot = pEle; while ( pNextSlot != this ) { if ( !pNextSlot->pEnumValue && pNextSlot->GetStateMethod() == GetStateMethod() ) break; pEle = ( ++i < rSlotList.size() ) ? rSlotList[ i ] : nullptr; - pNextSlot = pEle ? &pEle->xSlot : nullptr; + pNextSlot = pEle; } } |