From b091c9f867b87d085c0353f61b8f03fa7e6cbd2b Mon Sep 17 00:00:00 2001 From: Rafael Dominguez Date: Sun, 27 Feb 2011 21:35:16 -0800 Subject: [PATCH] PATCH 1/2] Remove SvULongs and replace it with std::vector --- idl/inc/object.hxx | 10 +--------- idl/source/objects/object.cxx | 17 +++++++---------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx index 84965e1cc768..417885184dfb 100644 --- a/idl/inc/object.hxx +++ b/idl/inc/object.hxx @@ -49,14 +49,6 @@ DECLARE_LIST( SvSlotElementList, SvSlotElement* ) class SvMetaClass; typedef ::std::vector< SvMetaClass* > SvMetaClassList; -class SvULongs : public List -{ -public: - void Insert( ULONG& rId, ULONG nPos ) { ULONG nId(rId ); List::Insert( (void*) nId, nPos ); } - void Remove( ULONG& rId ){ ULONG nId(rId ); List::Remove( (void*) nId ); } - ULONG GetObject( ULONG nPos ){ return (ULONG) List::GetObject( nPos ); } -}; - SV_DECL_REF(SvMetaClass) class SvClassElement : public SvPersistBase { @@ -111,7 +103,7 @@ class SvMetaClass : public SvMetaType SvIdlDataBase & rBase, SvStream & rOutStm ); - void InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList, + void InsertSlots( SvSlotElementList& rList, std::vector& rSuperList, SvMetaClassList & rClassList, const ByteString & rPrefix, SvIdlDataBase& rBase ); diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 92f8b7445d02..0cb39c367122 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -472,7 +472,7 @@ USHORT SvMetaClass::WriteSlots( const ByteString & rShellName, return nSCount; } -void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList, +void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector& rSuperList, SvMetaClassList &rClassList, const ByteString & rPrefix, SvIdlDataBase& rBase) { @@ -490,18 +490,15 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList, SvMetaAttribute * pAttr = aAttrList.GetObject( n ); ULONG nId = pAttr->GetSlotId().GetValue(); - USHORT nPos; - for ( nPos=0; nPos < rSuperList.Count(); nPos++ ) - { - if ( rSuperList.GetObject(nPos) == nId ) - break; - } - if( nPos == rSuperList.Count() ) + std::vector::iterator iter = std::find(rSuperList.begin(), + rSuperList.end(),nId); + + if( iter == rSuperList.end() ) { // Write only if not already written by subclass or // imported interface. - rSuperList.Insert( nId, nPos ); + rSuperList.push_back(nId); pAttr->Insert(rList, rPrefix, rBase); } } @@ -591,7 +588,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) rOutStm << "SFX_ARGUMENTMAP(" << GetName().GetBuffer() << ')' << endl << '{' << endl; - SvULongs aSuperList; + std::vector aSuperList; SvMetaClassList classList; SvSlotElementList aSlotList; InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase);