diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-07 16:56:51 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2012-08-08 13:53:07 +0300 |
commit | 016918cf9459eccc177bfedbe75c6296b3b4bb67 (patch) | |
tree | d6966ad5b74e79d8aff54cefb6e34309b671f8df /idl/source | |
parent | 552cc040866bb2d25cf6187c92d9c4acd0db82d8 (diff) |
STL'ify SV_DECL_IMPL_PERSIST_LIST
Converts it to a template based on std::vector
Change-Id: Id7f89f494164c61a3a573cff443ac0e0488e93f1
Diffstat (limited to 'idl/source')
-rw-r--r-- | idl/source/objects/module.cxx | 56 | ||||
-rw-r--r-- | idl/source/objects/object.cxx | 40 | ||||
-rw-r--r-- | idl/source/objects/slot.cxx | 31 | ||||
-rw-r--r-- | idl/source/objects/types.cxx | 79 | ||||
-rw-r--r-- | idl/source/prj/database.cxx | 102 |
5 files changed, 159 insertions, 149 deletions
diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx index 20e38af369da..43a6869efa65 100644 --- a/idl/source/objects/module.cxx +++ b/idl/source/objects/module.cxx @@ -184,9 +184,9 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, SvMetaClassRef aClass = new SvMetaClass(); if( aClass->ReadSvIdl( rBase, rInStm ) ) { - aClassList.Append( aClass ); + aClassList.push_back( aClass ); // announce globally - rBase.GetClassList().Append( aClass ); + rBase.GetClassList().push_back( aClass ); } } else if( rInStm.GetToken()->Is( SvHash_enum() ) ) @@ -196,9 +196,9 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, if( aEnum->ReadSvIdl( rBase, rInStm ) ) { // declared in module - aTypeList.Append( aEnum ); + aTypeList.push_back( aEnum ); // announce globally - rBase.GetTypeList().Append( aEnum ); + rBase.GetTypeList().push_back( aEnum ); } } else if( rInStm.GetToken()->Is( SvHash_item() ) @@ -210,9 +210,9 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, if( xItem->ReadSvIdl( rBase, rInStm ) ) { // declared in module - aTypeList.Append( xItem ); + aTypeList.push_back( xItem ); // announce globally - rBase.GetTypeList().Append( xItem ); + rBase.GetTypeList().push_back( xItem ); } } else if( rInStm.GetToken()->Is( SvHash_include() ) ) @@ -280,7 +280,7 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, if( xSlot->Test( rBase, rInStm ) ) { // declared in module - aAttrList.Append( xSlot ); + aAttrList.push_back( xSlot ); // announce globally rBase.AppendAttr( xSlot ); } @@ -294,22 +294,22 @@ void SvMetaModule::WriteContextSvIdl( SvIdlDataBase & rBase, { SvMetaExtern::WriteContextSvIdl( rBase, rOutStm, nTab ); sal_uLong n; - for( n = 0; n < aTypeList.Count(); n++ ) + for( n = 0; n < aTypeList.size(); n++ ) { WriteTab( rOutStm, nTab ); - aTypeList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + aTypeList[n]->WriteSvIdl( rBase, rOutStm, nTab ); } rOutStm << endl; - for( n = 0; n < aAttrList.Count(); n++ ) + for( n = 0; n < aAttrList.size(); n++ ) { WriteTab( rOutStm, nTab ); - aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + aAttrList[n]->WriteSvIdl( rBase, rOutStm, nTab ); } rOutStm << endl; - for( n = 0; n < aClassList.Count(); n++ ) + for( n = 0; n < aClassList.size(); n++ ) { WriteTab( rOutStm, nTab ); - aClassList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + aClassList[n]->WriteSvIdl( rBase, rOutStm, nTab ); } } @@ -368,9 +368,9 @@ void SvMetaModule::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) { - for( sal_uLong n = 0; n < aClassList.Count(); n++ ) + for( sal_uLong n = 0; n < aClassList.size(); n++ ) { - SvMetaClass * pClass = aClassList.GetObject( n ); + SvMetaClass * pClass = aClassList[n]; pClass->WriteSfx( rBase, rOutStm ); } } @@ -378,9 +378,9 @@ void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) void SvMetaModule::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, HelpIdTable& rTable ) { - for( sal_uLong n = 0; n < aClassList.Count(); n++ ) + for( sal_uLong n = 0; n < aClassList.size(); n++ ) { - SvMetaClass * pClass = aClassList.GetObject( n ); + SvMetaClass * pClass = aClassList[n]; pClass->WriteHelpIds( rBase, rOutStm, rTable ); } } @@ -422,15 +422,15 @@ void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm, WriteTab( rOutStm, nTab ); rOutStm << "importlib(\"STDOLE.TLB\");" << endl; - for( sal_uLong n = 0; n < aClassList.Count(); n++ ) + for( sal_uLong n = 0; n < aClassList.size(); n++ ) { - SvMetaClass * pClass = aClassList.GetObject( n ); + SvMetaClass * pClass = aClassList[n]; if( !pClass->IsShell() && pClass->GetAutomation() ) { WriteTab( rOutStm, nTab ); WriteStars( rOutStm ); pClass->Write( rBase, rOutStm, nTab +1, nT, nA ); - if( n +1 < aClassList.Count() ) + if( n +1 < aClassList.size() ) rOutStm << endl; } } @@ -446,9 +446,9 @@ void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm, rOutStm << "</MODULE>" << endl << endl; rOutStm << "<CLASSES>" << endl; - for( sal_uLong n = 0; n < aClassList.Count(); n++ ) + for( sal_uLong n = 0; n < aClassList.size(); n++ ) { - SvMetaClass * pClass = aClassList.GetObject( n ); + SvMetaClass * pClass = aClassList[n]; if( !pClass->IsShell() ) { rOutStm << pClass->GetName().getString().getStr(); @@ -458,16 +458,16 @@ void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm, // imported classes const SvClassElementMemberList& rClassList = pClass->GetClassList(); - if ( rClassList.Count() ) + if ( !rClassList.empty() ) { rOutStm << " ( "; - for( sal_uLong m=0; m<rClassList.Count(); ++m ) + for( sal_uLong m=0; m<rClassList.size(); ++m ) { - SvClassElement *pEle = rClassList.GetObject(m); + SvClassElement *pEle = rClassList[m]; SvMetaClass *pCl = pEle->GetClass(); rOutStm << pCl->GetName().getString().getStr(); - if ( m+1 == rClassList.Count() ) + if ( m+1 == rClassList.size() ) rOutStm << " )"; else rOutStm << " , "; @@ -484,9 +484,9 @@ void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm, case WRITE_C_SOURCE: case WRITE_C_HEADER: { - for( sal_uLong n = 0; n < aClassList.Count(); n++ ) + for( sal_uLong n = 0; n < aClassList.size(); n++ ) { - SvMetaClass * pClass = aClassList.GetObject( n ); + SvMetaClass * pClass = aClassList[n]; if( !pClass->IsShell() ) pClass->Write( rBase, rOutStm, nTab, nT, nA ); } diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index e26e1dd05419..953886d97974 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -109,9 +109,9 @@ void SvMetaClass::Save( SvPersistStream & rStm ) // create mask sal_uInt8 nMask = 0; - if( aAttrList.Count() ) nMask |= 0x1; + if( !aAttrList.empty() ) nMask |= 0x1; if( aSuperClass.Is() ) nMask |= 0x2; - if( aClassList.Count() ) nMask |= 0x4; + if( !aClassList.empty() ) nMask |= 0x4; if( xAutomationInterface.Is() ) nMask |= 0x8; if( aAutomation.IsSet() ) nMask |= 0x10; @@ -162,7 +162,7 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, { SvClassElementRef xEle = new SvClassElement(); xEle->SetClass( pClass ); - aClassList.Append( xEle ); + aClassList.push_back( xEle ); if( rInStm.Read( '[' ) ) { @@ -241,7 +241,7 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, aI.SetValue( rBase.GetUniqueId() ); xAttr->SetSlotId( aI ); } - aAttrList.Append( xAttr ); + aAttrList.push_back( xAttr ); return; } } @@ -256,15 +256,15 @@ void SvMetaClass::WriteContextSvIdl ) { sal_uLong n; - for( n = 0; n < aAttrList.Count(); n++ ) + for( n = 0; n < aAttrList.size(); n++ ) { WriteTab( rOutStm, nTab ); - aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); + aAttrList[n]->WriteSvIdl( rBase, rOutStm, nTab ); rOutStm << ';' << endl; } - for( n = 0; n < aClassList.Count(); n++ ) + for( n = 0; n < aClassList.size(); n++ ) { - SvClassElement * pEle = aClassList.GetObject( n ); + SvClassElement * pEle = aClassList[n]; WriteTab( rOutStm, nTab ); rOutStm << SvHash_import()->GetName().getStr() << ' ' << pEle->GetPrefix().getStr(); @@ -316,9 +316,9 @@ sal_Bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInS OSL_FAIL( rAttr.GetSlotId().getString().getStr() ); } - for( sal_uLong n = 0; n < aAttrList.Count(); n++ ) + for( sal_uLong n = 0; n < aAttrList.size(); n++ ) { - SvMetaAttribute * pS = aAttrList.GetObject( n ); + SvMetaAttribute * pS = aAttrList[n]; if( pS->GetName().getString() == rAttr.GetName().getString() ) { // values have to match @@ -407,9 +407,9 @@ void SvMetaClass::Write( SvIdlDataBase & rBase, SvStream & rOutStm, // write all attributes sal_uLong n; - for( n = 0; n < aAttrList.Count(); n++ ) + for( n = 0; n < aAttrList.size(); n++ ) { - SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + SvMetaAttribute * pAttr = aAttrList[n]; if( !pAttr->GetHidden() ) { if( pAttr->IsMethod() ) @@ -473,9 +473,9 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& // write all direct attributes sal_uLong n; - for( n = 0; n < aAttrList.Count(); n++ ) + for( n = 0; n < aAttrList.size(); n++ ) { - SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + SvMetaAttribute * pAttr = aAttrList[n]; sal_uLong nId = pAttr->GetSlotId().GetValue(); @@ -500,9 +500,9 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& // Write all attributes of the imported classes, as long as they have // not already been imported by the superclass. - for( n = 0; n < aClassList.Count(); n++ ) + for( n = 0; n < aClassList.size(); n++ ) { - SvClassElement * pEle = aClassList.GetObject( n ); + SvClassElement * pEle = aClassList[n]; SvMetaClass * pCl = pEle->GetClass(); rtl::OStringBuffer rPre(rPrefix); if( rPre.getLength() && pEle->GetPrefix().getLength() ) @@ -531,9 +531,9 @@ void SvMetaClass::FillClasses( SvMetaClassList & rList ) rList.push_back( this ); // my imports - for( sal_uInt32 n = 0; n < aClassList.Count(); n++ ) + for( sal_uInt32 n = 0; n < aClassList.size(); n++ ) { - SvClassElement * pEle = aClassList.GetObject( n ); + SvClassElement * pEle = aClassList[n]; SvMetaClass * pCl = pEle->GetClass(); pCl->FillClasses( rList ); } @@ -645,9 +645,9 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, HelpIdTable& rTable ) { - for( sal_uLong n=0; n<aAttrList.Count(); n++ ) + for( sal_uLong n=0; n<aAttrList.size(); n++ ) { - SvMetaAttribute * pAttr = aAttrList.GetObject( n ); + SvMetaAttribute * pAttr = aAttrList[n]; pAttr->WriteHelpId( rBase, rOutStm, rTable ); } } diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index e0ed2d372f7d..e55712eb6423 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -1013,9 +1013,9 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const rtl::OString& rPrefix, rtl::OString aSId = aBuf.makeStringAndClear(); xEnumSlot = NULL; - for( m=0; m<rBase.GetAttrList().Count(); m++ ) + for( m=0; m<rBase.GetAttrList().size(); m++ ) { - SvMetaAttribute * pAttr = rBase.GetAttrList().GetObject( m ); + SvMetaAttribute * pAttr = rBase.GetAttrList()[m]; if (aSId.equals(pAttr->GetSlotId().getString())) { SvMetaSlot* pSlot = PTR_CAST( SvMetaSlot, pAttr ); @@ -1024,7 +1024,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const rtl::OString& rPrefix, } } - if ( m == rBase.GetAttrList().Count() ) + if ( m == rBase.GetAttrList().size() ) { OSL_FAIL("Invalid EnumSlot!"); xEnumSlot = Clone(); @@ -1347,7 +1347,7 @@ void SvMetaSlot::WriteSlot( const rtl::OString& rShellName, sal_uInt16 nCount, { rOutStm << pT->GetName().getString().getStr(); if( !rBase.FindType( pT, rBase.aUsedTypes ) ) - rBase.aUsedTypes.Append( pT ); + rBase.aUsedTypes.push_back( pT ); } else rOutStm << "SfxVoidItem not defined"; @@ -1356,7 +1356,7 @@ void SvMetaSlot::WriteSlot( const rtl::OString& rShellName, sal_uInt16 nCount, { SvMetaType *pT = rBase.FindType( "SfxBoolItem" ); if ( pT && !rBase.FindType( pT, rBase.aUsedTypes ) ) - rBase.aUsedTypes.Append( pT ); + rBase.aUsedTypes.push_back( pT ); } if( !bIsEnumSlot ) @@ -1436,13 +1436,13 @@ sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rO pType = GetType(); if( !rBase.FindType( pType, rBase.aUsedTypes ) ) - rBase.aUsedTypes.Append( pType ); + rBase.aUsedTypes.push_back( pType ); const SvMetaAttributeMemberList & rList = pType->GetAttrList(); - for( sal_uLong n = 0; n < rList.Count(); n++ ) + for( sal_uLong n = 0; n < rList.size(); n++ ) { - SvMetaAttribute * pPar = rList.GetObject( n ); + SvMetaAttribute * pPar = rList[n]; SvMetaType * pPType = pPar->GetType(); WriteTab( rOutStm, 1 ); rOutStm << "SFX_ARGUMENT(" @@ -1452,9 +1452,9 @@ sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rO // item name << pPType->GetName().getString().getStr() << ")," << endl; if( !rBase.FindType( pPType, rBase.aUsedTypes ) ) - rBase.aUsedTypes.Append( pPType ); + rBase.aUsedTypes.push_back( pPType ); } - return (sal_uInt16)rList.Count(); + return (sal_uInt16)rList.size(); } return 0; } @@ -1624,15 +1624,16 @@ void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm ) if ( GetMethod() ) pList = &GetMethod()->GetType()->GetAttrList(); - if( pList && pList->Count() ) + if( pList && !pList->empty() ) { rStrm << "\"("; - SvMetaAttribute* pAttr = pList->First(); - while( pAttr ) + SvMetaAttributeMemberList::const_iterator it = pList->begin(); + while( it != pList->end() ) { + SvMetaAttribute* pAttr = *it; pAttr->WriteCSV( rBase, rStrm ); - pAttr = pList->Next(); - if( pAttr ) + ++it; + if( it != pList->end() ) rStrm << ','; } rStrm << ")\""; diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index 16e559a6940a..9186857fe81f 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -334,10 +334,10 @@ void SvMetaAttribute::WriteParam( SvIdlDataBase & rBase, if( pBaseType->GetType() == TYPE_STRUCT ) { const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList(); - sal_uLong nCount = rList.Count(); + sal_uLong nCount = rList.size(); for( sal_uLong i = 0; i < nCount; i++ ) { - rList.GetObject( i )->WriteParam( rBase, rOutStm, nTab, nT ); + rList[i]->WriteParam( rBase, rOutStm, nTab, nT ); if( i+1<nCount ) { rOutStm << ','; @@ -505,7 +505,7 @@ void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase, WriteType nT, WriteAttribute nA ) { const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList(); - sal_uLong nCount = rList.Count(); + sal_uLong nCount = rList.size(); SvNumberIdentifier slotId = rBase.aStructSlotId; if ( !GetSlotId().getString().isEmpty() ) @@ -517,7 +517,7 @@ void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase, for( sal_uLong i = 0; i < nCount; i++ ) { - SvMetaAttribute *pAttr = rList.GetObject( i ); + SvMetaAttribute *pAttr = rList[i]; if ( nT == WRITE_DOCU ) pAttr->SetDescription( GetDescription().getString() ); pAttr->Write( rBase, rOutStm, nTab, nT, nA ); @@ -1130,15 +1130,16 @@ void SvMetaType::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, { if( GetAttrCount() ) { - SvMetaAttribute * pAttr = pAttrList->First(); - while( pAttr ) + SvMetaAttributeMemberList::const_iterator it = pAttrList->begin(); + while( it != pAttrList->end() ) { + SvMetaAttribute * pAttr = *it; pAttr->Write( rBase, rOutStm, nTab, nT, nA ); if( GetType() == TYPE_METHOD ) rOutStm << ',' << endl; else rOutStm << ';' << endl; - pAttr = pAttrList->Next(); + ++it; } } } @@ -1337,7 +1338,7 @@ void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase, if( xAttr->ReadSvIdl( rBase, rInStm ) ) { if( xAttr->Test( rBase, rInStm ) ) - GetAttrList().Append( xAttr ); + GetAttrList().push_back( xAttr ); } } @@ -1350,16 +1351,17 @@ void SvMetaType::WriteContextSvIdl { if( GetAttrCount() ) { - SvMetaAttribute * pAttr = pAttrList->First(); - while( pAttr ) + SvMetaAttributeMemberList::const_iterator it = pAttrList->begin(); + while( it != pAttrList->end() ) { + SvMetaAttribute * pAttr = *it; WriteTab( rOutStm, nTab ); pAttr->WriteSvIdl( rBase, rOutStm, nTab ); if( GetType() == TYPE_METHOD ) rOutStm << ',' << endl; else rOutStm << ';' << endl; - pAttr = pAttrList->Next(); + ++it; } } } @@ -1381,7 +1383,7 @@ sal_uLong SvMetaType::MakeSfx( rtl::OStringBuffer& rAttrArray ) // write the single attributes for( sal_uLong n = 0; n < nAttrCount; n++ ) { - nC += pAttrList->GetObject( n )->MakeSfx( rAttrArray ); + nC += (*pAttrList)[n]->MakeSfx( rAttrArray ); if( n +1 < nAttrCount ) rAttrArray.append(", "); } @@ -1467,13 +1469,14 @@ void SvMetaType::WriteMethodArgs WriteTab( rOutStm, nTab ); rOutStm << '(' << endl; - SvMetaAttribute * pAttr = pAttrList->First(); - while( pAttr ) + SvMetaAttributeMemberList::const_iterator it = pAttrList->begin(); + while( it != pAttrList->end() ) { + SvMetaAttribute * pAttr = *it; WriteTab( rOutStm, nTab +1 ); pAttr->WriteSvIdl( rBase, rOutStm, nTab +1 ); - pAttr = pAttrList->Next(); - if( pAttr ) + ++it; + if( it != pAttrList->end() ) rOutStm << ',' << endl; } rOutStm << endl; @@ -1489,12 +1492,13 @@ void SvMetaType::WriteMethodArgs rOutStm << '('; if( GetAttrCount() ) { - SvMetaAttribute * pAttr = pAttrList->First(); - while( pAttr ) + SvMetaAttributeMemberList::const_iterator it = pAttrList->begin(); + while( it != pAttrList->end() ) { + SvMetaAttribute * pAttr = *it; pAttr->WriteParam( rBase, rOutStm, nTab+1, nT ); - pAttr = pAttrList->Next(); - if( pAttr ) + ++it; + if( it != pAttrList->end() ) rOutStm << ','; else rOutStm << ' '; @@ -1517,9 +1521,10 @@ void SvMetaType::WriteMethodArgs if( GetAttrCount() ) { rOutStm << endl; - SvMetaAttribute * pAttr = pAttrList->First(); - while( pAttr ) + SvMetaAttributeMemberList::const_iterator it = pAttrList->begin(); + while( it != pAttrList->end() ) { + SvMetaAttribute* pAttr = *it; switch( nT ) { case WRITE_C_HEADER: @@ -1535,8 +1540,8 @@ void SvMetaType::WriteMethodArgs DBG_ASSERT( sal_False, "WriteType not implemented" ); } } - pAttr = pAttrList->Next(); - if( pAttr ) + ++it; + if( it != pAttrList->end() ) rOutStm << ',' << endl; } if( nT != WRITE_C_HEADER && nT != WRITE_C_SOURCE ) @@ -1685,7 +1690,7 @@ rtl::OString SvMetaType::GetParserString() const // write the single attributes for( sal_uLong n = 0; n < nAttrCount; n++ ) { - SvMetaAttribute * pT = pAttrList->GetObject( n ); + SvMetaAttribute * pT = (*pAttrList)[n]; aPStr += pT->GetType()->GetParserString(); } } @@ -1711,7 +1716,7 @@ void SvMetaType::WriteParamNames( SvIdlDataBase & rBase, // write the single attributes for( sal_uLong n = 0; n < nAttrCount; n++ ) { - SvMetaAttribute * pA = pAttrList->GetObject( n ); + SvMetaAttribute * pA = (*pAttrList)[n]; rtl::OString aStr = pA->GetName().getString(); pA->GetType()->WriteParamNames( rBase, rOutStm, aStr ); if( n +1 < nAttrCount ) @@ -1822,7 +1827,7 @@ void SvMetaTypeEnum::Save( SvPersistStream & rStm ) // create mask sal_uInt8 nMask = 0; - if( aEnumValueList.Count() ) nMask |= 0x01; + if( !aEnumValueList.empty() ) nMask |= 0x01; if( !aPrefix.isEmpty() ) nMask |= 0x02; // write data @@ -1856,7 +1861,7 @@ void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase, sal_Bool bOk = aEnumVal->ReadSvIdl( rBase, rInStm ); if( bOk ) { - if( 0 == aEnumValueList.Count() ) + if( aEnumValueList.empty() ) { // the first aPrefix = aEnumVal->GetName().getString(); @@ -1865,7 +1870,7 @@ void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase, { aPrefix = getCommonSubPrefix(aPrefix, aEnumVal->GetName().getString()); } - aEnumValueList.Append( aEnumVal ); + aEnumValueList.push_back( aEnumVal ); } if( !bOk ) rInStm.Seek( nTokPos ); @@ -1876,10 +1881,10 @@ void SvMetaTypeEnum::WriteContextSvIdl( SvIdlDataBase & rBase, sal_uInt16 nTab ) { WriteTab( rOutStm, nTab +1 ); - for( sal_uLong n = 0; n < aEnumValueList.Count(); n++ ) + for( sal_uLong n = 0; n < aEnumValueList.size(); n++ ) { - aEnumValueList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); - if( n +1 != aEnumValueList.Count() ) + aEnumValueList[n]->WriteSvIdl( rBase, rOutStm, nTab ); + if( n + 1 != aEnumValueList.size() ) rOutStm << ", "; else rOutStm << endl; @@ -1921,11 +1926,11 @@ void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, WriteType nT, WriteAttribute nA ) { WriteTab( rOutStm, nTab +1 ); - for( sal_uLong n = 0; n < aEnumValueList.Count(); n++ ) + for( sal_uLong n = 0; n < aEnumValueList.size(); n++ ) { - aEnumValueList.GetObject( n )->Write( rBase, rOutStm, nTab +1, nT, nA ); + aEnumValueList[n]->Write( rBase, rOutStm, nTab +1, nT, nA ); - if( n +1 != aEnumValueList.Count() ) + if( n + 1 != aEnumValueList.size() ) { if( 2 == n % 3 ) { @@ -1987,8 +1992,8 @@ rtl::OString SvMetaAttribute::Compare( SvMetaAttribute* pAttr ) { for ( sal_uInt16 n=0; n<nCount; n++ ) { - SvMetaAttribute *pAttr1 = rList.GetObject(n); - SvMetaAttribute *pAttr2 = rOtherList.GetObject(n); + SvMetaAttribute *pAttr1 = rList[n]; + SvMetaAttribute *pAttr2 = rOtherList[n]; pAttr1->Compare( pAttr2 ); } } diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 3ba44ef52ef8..b68862a0f287 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -47,15 +47,15 @@ SvIdlDataBase::~SvIdlDataBase() } #define ADD_TYPE( Name, OdlName, ParserChar, CName, BasName, BasPost ) \ - aTypeList.Append( new SvMetaType( SvHash_##Name()->GetName(), \ + aTypeList.push_back( new SvMetaType( SvHash_##Name()->GetName(), \ BasName, OdlName, ParserChar, CName, BasName, BasPost ) ); SvMetaTypeMemberList & SvIdlDataBase::GetTypeList() { - if( aTypeList.Count() == 0 ) + if( aTypeList.empty() ) { // fill initially - aTypeList.Append( new SvMetaTypeString() ); - aTypeList.Append( new SvMetaTypevoid() ); + aTypeList.push_back( new SvMetaTypeString() ); + aTypeList.push_back( new SvMetaTypevoid() ); // MI: IDispatch::Invoke can not unsigned ADD_TYPE( UINT16, "long", 'h', "unsigned short", "Long", "&" ); @@ -78,9 +78,9 @@ SvMetaTypeMemberList & SvIdlDataBase::GetTypeList() SvMetaModule * SvIdlDataBase::GetModule( const rtl::OString& rName ) { - for( sal_uLong n = 0; n < aModuleList.Count(); n++ ) - if( aModuleList.GetObject( n )->GetName().getString().equals(rName) ) - return aModuleList.GetObject( n ); + for( sal_uLong n = 0; n < aModuleList.size(); n++ ) + if( aModuleList[n]->GetName().getString().equals(rName) ) + return aModuleList[n]; return NULL; } @@ -98,7 +98,7 @@ sal_Bool SvIdlDataBase::IsBinaryFormat( SvStream & rStm ) void SvIdlDataBase::Load( SvStream & rStm ) { - DBG_ASSERT( aTypeList.Count() == 0, "type list already initialized" ); + DBG_ASSERT( aTypeList.empty(), "type list already initialized" ); SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm ); sal_uInt16 nVersion = 0; @@ -141,11 +141,11 @@ void SvIdlDataBase::Save( SvStream & rStm, sal_uInt32 nFlags ) if( bOnlyStreamedObjs ) { SvMetaClassMemberList aList; - for( sal_uLong n = 0; n < GetModuleList().Count(); n++ ) + for( sal_uLong n = 0; n < GetModuleList().size(); n++ ) { - SvMetaModule * pModule = GetModuleList().GetObject( n ); + SvMetaModule * pModule = GetModuleList()[n]; if( !pModule->IsImported() ) - aList.Append( pModule->GetClassList() ); + aList.insert( pModule->GetClassList() ); } aPStm << aList; } @@ -347,18 +347,18 @@ sal_Bool SvIdlDataBase::ReadIdFile( const String & rFileName ) SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType, SvMetaTypeMemberList & rList ) { - SvMetaType * pType = rList.First(); - while( pType && pPType != pType ) - pType = rList.Next(); - return pType; + for( SvMetaTypeMemberList::const_iterator it = rList.begin(); it != rList.end(); ++it ) + if( *it == pPType ) + return *it; + return NULL; } SvMetaType * SvIdlDataBase::FindType( const rtl::OString& rName ) { - SvMetaType * pType = aTypeList.First(); - while( pType && !rName.equals(pType->GetName().getString()) ) - pType = aTypeList.Next(); - return pType; + for( SvMetaTypeMemberList::const_iterator it = aTypeList.begin(); it != aTypeList.end(); ++it ) + if( rName.equals((*it)->GetName().getString()) ) + return *it; + return NULL; } SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) @@ -404,12 +404,16 @@ SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) { rtl::OString aName = pTok->GetString(); SvMetaTypeMemberList & rList = GetTypeList(); - SvMetaType * pType = rList.First(); - while( pType ) + SvMetaTypeMemberList::const_iterator it = rList.begin(); + SvMetaType * pType = NULL; + while( it != rList.end() ) { - if( pType->GetName().getString().equals(aName) ) + if( (*it)->GetName().getString().equals(aName) ) + { + pType = *it; break; - pType = rList.Next(); + } + ++it; } if( pType ) { @@ -436,7 +440,7 @@ SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) // is exactly this type return pType; - DBG_ASSERT( aTmpTypeList.First(), "mindestens ein Element" ); + DBG_ASSERT( aTmpTypeList.front(), "mindestens ein Element" ); SvMetaTypeRef xType = new SvMetaType( pType->GetName().getString(), 'h', "dummy" ); xType->SetRef( pType ); xType->SetIn( bIn ); @@ -444,7 +448,7 @@ SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm ) xType->SetCall0( nCall0 ); xType->SetCall1( nCall1 ); - aTmpTypeList.Append( xType ); + aTmpTypeList.push_back( xType ); return xType; } } @@ -473,9 +477,9 @@ SvMetaAttribute * SvIdlDataBase::ReadKnownAttr sal_uLong n; if( FindId( pTok->GetString(), &n ) ) { - for( sal_uLong i = 0; i < aAttrList.Count(); i++ ) + for( sal_uLong i = 0; i < aAttrList.size(); i++ ) { - SvMetaAttribute * pAttr = aAttrList.GetObject( i ); + SvMetaAttribute * pAttr = aAttrList[i]; if( pAttr->GetSlotId().getString().equals(pTok->GetString()) ) return pAttr; } @@ -499,9 +503,9 @@ SvMetaAttribute* SvIdlDataBase::SearchKnownAttr sal_uLong n; if( FindId( rId.getString(), &n ) ) { - for( sal_uLong i = 0; i < aAttrList.Count(); i++ ) + for( sal_uLong i = 0; i < aAttrList.size(); i++ ) { - SvMetaAttribute * pAttr = aAttrList.GetObject( i ); + SvMetaAttribute * pAttr = aAttrList[i]; if( pAttr->GetSlotId().getString() == rId.getString() ) return pAttr; } @@ -516,9 +520,9 @@ SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm ) SvToken * pTok = rInStm.GetToken_Next(); if( pTok->IsIdentifier() ) - for( sal_uLong n = 0; n < aClassList.Count(); n++ ) + for( sal_uLong n = 0; n < aClassList.size(); n++ ) { - SvMetaClass * pClass = aClassList.GetObject( n ); + SvMetaClass * pClass = aClassList[n]; if( pClass->GetName().getString().equals(pTok->GetString()) ) return pClass; } @@ -681,7 +685,7 @@ sal_Bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, sal_Bool bImported { SvMetaModuleRef aModule = new SvMetaModule( rInStm.GetFileName(), bImported ); if( aModule->ReadSvIdl( *this, rInStm ) ) - GetModuleList().Append( aModule ); + GetModuleList().push_back( aModule ); else bOk = sal_False; } @@ -717,9 +721,9 @@ sal_Bool SvIdlWorkingBase::WriteSvIdl( SvStream & rOutStm ) } } - for( sal_uLong n = 0; n < GetModuleList().Count(); n++ ) + for( sal_uLong n = 0; n < GetModuleList().size(); n++ ) { - SvMetaModule * pModule = GetModuleList().GetObject( n ); + SvMetaModule * pModule = GetModuleList()[n]; pModule->WriteSvIdl( *this, rOutStm, 0 ); } return sal_True; @@ -734,19 +738,19 @@ sal_Bool SvIdlWorkingBase::WriteSfx( SvStream & rOutStm ) WriteReset(); SvMemoryStream aTmpStm( 256000, 256000 ); sal_uLong n; - for( n = 0; n < GetModuleList().Count(); n++ ) + for( n = 0; n < GetModuleList().size(); n++ ) { - SvMetaModule * pModule = GetModuleList().GetObject( n ); + SvMetaModule * pModule = GetModuleList()[n]; if( !pModule->IsImported() ) pModule->WriteSfx( *this, aTmpStm ); aTmpStm.Seek( 0 ); } - for( n = 0; n < aUsedTypes.Count(); n++ ) + for( n = 0; n < aUsedTypes.size(); n++ ) { - SvMetaType * pType = aUsedTypes.GetObject( n ); + SvMetaType * pType = aUsedTypes[n]; pType->WriteSfx( *this, rOutStm ); } - aUsedTypes.Clear(); + aUsedTypes.clear(); rOutStm << aTmpStm; return sal_True; } @@ -758,16 +762,16 @@ sal_Bool SvIdlWorkingBase::WriteHelpIds( SvStream& rOutStm ) HelpIdTable aIdTable; sal_uLong n; - for( n = 0; n < GetModuleList().Count(); n++ ) + for( n = 0; n < GetModuleList().size(); n++ ) { - SvMetaModule * pModule = GetModuleList().GetObject( n ); + SvMetaModule * pModule = GetModuleList()[n]; pModule->WriteHelpIds( *this, rOutStm, aIdTable ); } const SvMetaAttributeMemberList & rAttrList = GetAttrList(); - for( n = 0; n < rAttrList.Count(); n++ ) + for( n = 0; n < rAttrList.size(); n++ ) { - SvMetaAttribute * pAttr = rAttrList.GetObject( n ); + SvMetaAttribute * pAttr = rAttrList[n]; pAttr->WriteHelpId( *this, rOutStm, aIdTable ); } @@ -786,7 +790,7 @@ void SvIdlDataBase::StartNewFile( const String& rName ) void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr ) { - aAttrList.Append( pAttr ); + aAttrList.push_back( pAttr ); if ( bExport ) pAttr->SetNewAttribute( sal_True ); } @@ -794,12 +798,12 @@ void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr ) sal_Bool SvIdlWorkingBase::WriteCSV( SvStream& rStrm ) { SvMetaAttributeMemberList &rList = GetAttrList(); - sal_uLong nCount = rList.Count(); + sal_uLong nCount = rList.size(); for ( sal_uLong n=0; n<nCount; n++ ) { - if ( rList.GetObject(n)->IsNewAttribute() ) + if ( rList[n]->IsNewAttribute() ) { - rList.GetObject(n)->WriteCSV( *this, rStrm ); + rList[n]->WriteCSV( *this, rStrm ); } } @@ -814,9 +818,9 @@ sal_Bool SvIdlWorkingBase::WriteDocumentation( SvStream & rOutStm ) if( rOutStm.GetError() != SVSTREAM_OK ) return sal_False; - for( sal_uLong n = 0; n < GetModuleList().Count(); n++ ) + for( sal_uLong n = 0; n < GetModuleList().size(); n++ ) { - SvMetaModule * pModule = GetModuleList().GetObject( n ); + SvMetaModule * pModule = GetModuleList()[n]; if( !pModule->IsImported() ) pModule->Write( *this, rOutStm, 0, WRITE_DOCU ); } |