summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2011-03-25 16:58:09 -0430
committerNoel Power <noel.power@novell.com>2011-03-28 14:24:30 +0100
commit8ca3d48fc6c8167e75f0c19dd67207d5e5ff75c5 (patch)
tree194b0d660bf89769ea3ab7e2da737d0e0041f47d /idl
parentbadd3569d8bcec0748154fbc14236269ec7f59ce (diff)
Remove DECLARE_LIST( SvSlotElementList, SvSlotElement* )
Diffstat (limited to 'idl')
-rwxr-xr-xidl/inc/object.hxx3
-rwxr-xr-xidl/inc/slot.hxx2
-rwxr-xr-xidl/inc/types.hxx2
-rwxr-xr-xidl/source/objects/object.cxx47
-rwxr-xr-xidl/source/objects/slot.cxx54
5 files changed, 44 insertions, 64 deletions
diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx
index d4483da3f6c9..3cbd75081aba 100755
--- a/idl/inc/object.hxx
+++ b/idl/inc/object.hxx
@@ -29,11 +29,9 @@
#ifndef _OBJECT_HXX
#define _OBJECT_HXX
-#define _SVSTDARR_ULONGS
#include <types.hxx>
#include <slot.hxx>
#include <vector>
-#include <tools/list.hxx>
struct SvSlotElement
{
@@ -44,7 +42,6 @@ struct SvSlotElement
, aPrefix( rPrefix )
{}
};
-DECLARE_LIST( SvSlotElementList, SvSlotElement* )
class SvMetaClass;
typedef ::std::vector< SvMetaClass* > SvMetaClassList;
diff --git a/idl/inc/slot.hxx b/idl/inc/slot.hxx
index 8363b19db5cd..9b3c2d425557 100755
--- a/idl/inc/slot.hxx
+++ b/idl/inc/slot.hxx
@@ -82,6 +82,7 @@ class SvMetaSlot : public SvMetaAttribute
void WriteSlot( const ByteString & rShellName,
sal_uInt16 nCount, const ByteString & rSlotId,
SvSlotElementList &rList,
+ SvSlotElementList::iterator pCurSlot,
const ByteString & rPrefix,
SvIdlDataBase & rBase, SvStream & rOutStm );
virtual void Write( SvIdlDataBase & rBase,
@@ -255,6 +256,7 @@ public:
sal_uInt16 WriteSlotMap( const ByteString & rShellName,
sal_uInt16 nCount,
SvSlotElementList&,
+ SvSlotElementList::iterator pCurSlot,
const ByteString &,
SvIdlDataBase & rBase,
SvStream & rOutStm );
diff --git a/idl/inc/types.hxx b/idl/inc/types.hxx
index 4913c21c4870..b37cfd1242c0 100755
--- a/idl/inc/types.hxx
+++ b/idl/inc/types.hxx
@@ -32,8 +32,8 @@
#include <tools/ref.hxx>
#include <basobj.hxx>
-class SvSlotElementList;
struct SvSlotElement;
+typedef std::vector<SvSlotElement*> SvSlotElementList;
SV_DECL_REF(SvMetaType)
SV_DECL_REF(SvMetaAttribute)
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index a08e3e430d91..9ad2e37f0410 100755
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -443,10 +443,10 @@ sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
SvStream & rOutStm )
{
sal_uInt16 nCount = 0;
- for( sal_uLong n = 0; n < rSlotList.Count(); n++ )
+ SvMetaSlot *pAttr = NULL;
+ for(SvSlotElementList::iterator it = rSlotList.begin(); it != rSlotList.end(); ++it)
{
- SvSlotElement *pEle = rSlotList.GetObject( n );
- SvMetaSlot *pAttr = pEle->xSlot;
+ pAttr = (*it)->xSlot;
nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm );
}
@@ -459,13 +459,12 @@ sal_uInt16 SvMetaClass::WriteSlots( const ByteString & rShellName,
SvStream & rOutStm )
{
sal_uInt16 nSCount = 0;
- for( sal_uLong n = 0; n < rSlotList.Count(); n++ )
+ SvMetaSlot *pAttr = NULL;
+ for(SvSlotElementList::iterator it = rSlotList.begin(); it != rSlotList.end(); ++it)
{
- rSlotList.Seek(n);
- SvSlotElement * pEle = rSlotList.GetCurObject();
- SvMetaSlot * pAttr = pEle->xSlot;
+ pAttr = (*it)->xSlot;
nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount,
- rSlotList, pEle->aPrefix, rBase,
+ rSlotList, it, (*it)->aPrefix, rBase,
rOutStm );
}
@@ -560,13 +559,8 @@ void SvMetaClass::WriteSlotStubs( const ByteString & rShellName,
ByteStringList & rList,
SvStream & rOutStm )
{
- // write all attributes
- for( sal_uLong n = 0; n < rSlotList.Count(); n++ )
- {
- SvSlotElement *pEle = rSlotList.GetObject( n );
- SvMetaSlot *pAttr = pEle->xSlot;
- pAttr->WriteSlotStubs( rShellName, rList, rOutStm );
- }
+ for(SvSlotElementList::iterator it = rSlotList.begin(); it != rSlotList.end(); ++it)
+ (*it)->xSlot->WriteSlotStubs( rShellName, rList, rOutStm );
}
void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
@@ -592,14 +586,12 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
SvMetaClassList classList;
SvSlotElementList aSlotList;
InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase);
- for (sal_uInt32 n=0; n<aSlotList.Count(); n++ )
- {
- SvSlotElement *pEle = aSlotList.GetObject( n );
- SvMetaSlot *pSlot = pEle->xSlot;
- pSlot->SetListPos(n);
- }
- sal_uLong nSlotCount = aSlotList.Count();
+ sal_uInt32 k = 0;
+ for(SvSlotElementList::iterator it = aSlotList.begin(); it != aSlotList.end(); ++it, ++k)
+ (*it)->xSlot->SetListPos(k);
+
+ sal_uLong nSlotCount = aSlotList.size();
// write all attributes
sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm );
@@ -641,16 +633,11 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
}
rOutStm << endl << "};" << endl << "#endif" << endl << endl;
- for( sal_uLong n=0; n<aSlotList.Count(); n++ )
+ for(SvSlotElementList::iterator it = aSlotList.begin(); it != aSlotList.end(); ++it)
{
- aSlotList.Seek(n);
- SvSlotElement* pEle = aSlotList.GetCurObject();
- SvMetaSlot* pAttr = pEle->xSlot;
- pAttr->ResetSlotPointer();
+ (*it)->xSlot->ResetSlotPointer();
+ delete *it;
}
-
- for ( sal_uLong n=0; n<aSlotList.Count(); n++ )
- delete aSlotList.GetObject(n);
}
void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
index 2f4f219c2e6c..d4f7be793cc5 100755
--- a/idl/source/objects/slot.cxx
+++ b/idl/source/objects/slot.cxx
@@ -936,14 +936,14 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
{
// get insert position through binary search in slotlist
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_uLong m; // for inner "for" loop
if ( !nListCount )
nPos = 0;
else if ( nListCount == 1 )
- nPos = rList.GetObject(0)->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1;
+ nPos = rList[0]->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1;
else
{
sal_uInt16 nMid = 0, nLow = 0;
@@ -953,7 +953,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
{
nMid = (nLow + nHigh) >> 1;
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 ( nMid == 0 )
@@ -977,16 +977,16 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
DBG_ASSERT( nPos <= nListCount,
"nPos too large" );
DBG_ASSERT( nPos == nListCount || nId <=
- (sal_uInt16) rList.GetObject(nPos)->xSlot->GetSlotId().GetValue(),
+ (sal_uInt16) rList[nPos]->xSlot->GetSlotId().GetValue(),
"Successor has lower SlotId" );
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" );
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" );
- rList.Insert( new SvSlotElement( this, rPrefix ), nPos );
+ rList.insert(rList.begin()+nPos, new SvSlotElement( this, rPrefix ));
// iron out EnumSlots
SvMetaTypeEnum * pEnum = NULL;
@@ -1052,19 +1052,17 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
pLinkedSlot = pFirstEnumSlot;
// concatenate slaves among themselves
- rList.Seek((sal_uLong)0);
xEnumSlot = pFirstEnumSlot;
- SvSlotElement *pEle;
- do
+
+ for (SvSlotElementList::const_iterator it = rList.begin(); it != rList.end(); ++it)
{
- pEle = rList.Next();
- if ( pEle && pEle->xSlot->pLinkedSlot == this )
+ if ((*it)->xSlot->pLinkedSlot == this)
{
- xEnumSlot->pNextSlot = pEle->xSlot;
- xEnumSlot = pEle->xSlot;
+ xEnumSlot->pNextSlot = (*it)->xSlot;
+ xEnumSlot = (*it)->xSlot;
}
}
- while ( pEle );
+
xEnumSlot->pNextSlot = pFirstEnumSlot;
}
}
@@ -1136,6 +1134,7 @@ void SvMetaSlot::WriteSlotStubs( const ByteString & rShellName,
void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount,
const ByteString & rSlotId,
SvSlotElementList& rSlotList,
+ SvSlotElementList::iterator pCurSlot,
const ByteString & rPrefix,
SvIdlDataBase & rBase, SvStream & rOutStm )
{
@@ -1192,30 +1191,24 @@ void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount,
{
// look for the next slot with the same StateMethod like me
// the slotlist is set to the current slot
- SvSlotElement * pEle = rSlotList.Next();
- pNextSlot = pEle ? &pEle->xSlot : NULL;
- while ( pNextSlot )
+ for (SvSlotElementList::iterator it = pCurSlot+1; it != rSlotList.end(); ++it)
{
- if ( !pNextSlot->pNextSlot &&
- pNextSlot->GetStateMethod() == GetStateMethod() )
+ pNextSlot = (*it)->xSlot;
+
+ if (!pNextSlot || (!pNextSlot->pNextSlot && pNextSlot->GetStateMethod() == GetStateMethod()) )
break;
- pEle = rSlotList.Next();
- pNextSlot = pEle ? &pEle->xSlot : NULL;
}
if ( !pNextSlot )
{
// There is no slot behind me that has the same ExecMethod.
// So I search for the first slot with it (could be myself).
- pEle = rSlotList.First();
- pNextSlot = pEle ? &pEle->xSlot : NULL;
- while ( pNextSlot != this )
+ for (SvSlotElementList::iterator it = rSlotList.begin(); it != pCurSlot; ++it)
{
- if ( !pNextSlot->pEnumValue &&
- pNextSlot->GetStateMethod() == GetStateMethod() )
+ pNextSlot = (*it)->xSlot;
+
+ if (pNextSlot == this || (!pNextSlot->pEnumValue && pNextSlot->GetStateMethod() == GetStateMethod()) )
break;
- pEle = rSlotList.Next();
- pNextSlot = pEle ? &pEle->xSlot : NULL;
}
}
@@ -1436,6 +1429,7 @@ sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rO
sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 nCount,
SvSlotElementList& rSlotList,
+ SvSlotElementList::iterator pCurSlot,
const ByteString & rPrefix,
SvIdlDataBase & rBase,
SvStream & rOutStm )
@@ -1456,7 +1450,7 @@ sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 n
nSCount = (sal_uInt16)pType->GetAttrCount();
}
- WriteSlot( rShellName, nCount, slotId, rSlotList, rPrefix, rBase, rOutStm );
+ WriteSlot( rShellName, nCount, slotId, rSlotList, pCurSlot, rPrefix, rBase, rOutStm );
return nSCount;
}