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 | |
parent | 552cc040866bb2d25cf6187c92d9c4acd0db82d8 (diff) |
STL'ify SV_DECL_IMPL_PERSIST_LIST
Converts it to a template based on std::vector
Change-Id: Id7f89f494164c61a3a573cff443ac0e0488e93f1
-rw-r--r-- | dbaccess/source/ui/misc/DExport.cxx | 1 | ||||
-rw-r--r-- | editeng/inc/editeng/outliner.hxx | 1 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/svdfppt.hxx | 1 | ||||
-rw-r--r-- | idl/inc/basobj.hxx | 31 | ||||
-rw-r--r-- | idl/inc/database.hxx | 2 | ||||
-rw-r--r-- | idl/inc/module.hxx | 3 | ||||
-rw-r--r-- | idl/inc/object.hxx | 7 | ||||
-rw-r--r-- | idl/inc/slot.hxx | 3 | ||||
-rw-r--r-- | idl/inc/types.hxx | 23 | ||||
-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 | ||||
-rw-r--r-- | sd/source/filter/eppt/text.hxx | 1 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.hxx | 1 | ||||
-rw-r--r-- | svx/inc/svx/svdlayer.hxx | 1 | ||||
-rw-r--r-- | svx/inc/svx/xtable.hxx | 1 | ||||
-rw-r--r-- | tools/inc/tools/pstm.hxx | 57 | ||||
-rw-r--r-- | tools/inc/tools/ref.hxx | 265 | ||||
-rw-r--r-- | tools/source/inet/inetmsg.cxx | 1 | ||||
-rw-r--r-- | tools/source/ref/pstm.cxx | 31 |
22 files changed, 297 insertions, 441 deletions
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index bdacec83a1a7..09092f23d22d 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -48,6 +48,7 @@ #include <o3tl/compat_functional.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <tools/contnr.hxx> #include <i18npool/mslangid.hxx> #include <com/sun/star/awt/FontDescriptor.hpp> #include "WCopyTable.hxx" diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx index 2930db076221..370ff2e5d27f 100644 --- a/editeng/inc/editeng/outliner.hxx +++ b/editeng/inc/editeng/outliner.hxx @@ -36,6 +36,7 @@ #include <editeng/editdata.hxx> #include <i18npool/lang.h> #include <tools/color.hxx> +#include <tools/list.hxx> #include <vcl/graph.hxx> #include <tools/link.hxx> #include <rsc/rscsfx.hxx> diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx index 3ef2f922a80d..c559a820ab14 100644 --- a/filter/inc/filter/msfilter/svdfppt.hxx +++ b/filter/inc/filter/msfilter/svdfppt.hxx @@ -33,6 +33,7 @@ #include <tools/string.hxx> #include <tools/gen.hxx> #include <tools/color.hxx> +#include <tools/list.hxx> #include <svx/svdobj.hxx> #include <editeng/numitem.hxx> #include <editeng/editdata.hxx> diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx index ce7f47bf50e6..cc6343744aa7 100644 --- a/idl/inc/basobj.hxx +++ b/idl/inc/basobj.hxx @@ -73,9 +73,8 @@ public: WriteType, WriteAttribute = 0 ); }; SV_DECL_IMPL_REF(SvMetaObject) -SV_DECL_PERSIST_LIST(SvMetaObject,SvMetaObject *) -SV_IMPL_PERSIST_LIST(SvMetaObject,SvMetaObject *) +class SvMetaObjectMemberList : public SvDeclPersistList<SvMetaObject *> {}; class SvMetaObjectMemberStack { @@ -84,21 +83,17 @@ public: SvMetaObjectMemberStack() {;} void Push( SvMetaObject * pObj ) - { aList.Insert( pObj, LIST_APPEND ); } - SvMetaObject * Pop() { return aList.Remove( aList.Count() -1 ); } - SvMetaObject * Top() const { return aList.GetObject( aList.Count() -1 ); } - void Clear() { aList.Clear(); } - sal_uLong Count() const { return aList.Count(); } + { aList.push_back( pObj ); } + SvMetaObject * Pop() { return aList.pop_back(); } + SvMetaObject * Top() const { return aList.back(); } + void Clear() { aList.clear(); } + sal_uLong Count() const { return aList.size(); } SvMetaObject * Get( TypeId nType ) { - SvMetaObject * pObj = aList.Last(); - while( pObj ) - { - if( pObj->IsA( nType ) ) - return pObj; - pObj = aList.Prev(); - } + for( SvMetaObjectMemberList::reverse_iterator it = aList.rbegin(); it != aList.rend(); ++it ) + if( (*it)->IsA( nType ) ) + return *it; return NULL; } }; @@ -147,7 +142,8 @@ public: void WriteDescription( SvStream& rOutStm ); }; SV_DECL_IMPL_REF(SvMetaName) -SV_DECL_IMPL_PERSIST_LIST(SvMetaName,SvMetaName *) + +class SvMetaNameMemberList : public SvDeclPersistList<SvMetaName *> {}; SV_DECL_REF(SvMetaReference) @@ -195,7 +191,8 @@ public: { aRef = pRef; } }; SV_IMPL_REF(SvMetaReference) -SV_DECL_IMPL_PERSIST_LIST(SvMetaReference,SvMetaReference *) + +class SvMetaReferenceMemberList : public SvDeclPersistList<SvMetaReference *> {}; class SvMetaModule; @@ -229,8 +226,8 @@ protected: WriteType, WriteAttribute = 0); }; SV_DECL_IMPL_REF(SvMetaExtern) -SV_DECL_IMPL_PERSIST_LIST(SvMetaExtern,SvMetaExtern *) +class SvMetaExternMemberList : public SvDeclPersistList<SvMetaExtern *> {}; #endif // _BASOBJ_HXX diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index 5a64aac78976..7ce217520e88 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -79,7 +79,7 @@ protected: SvIdlError aError; void WriteReset() { - aUsedTypes.Clear(); + aUsedTypes.clear(); aIFaceName = rtl::OString(); } public: diff --git a/idl/inc/module.hxx b/idl/inc/module.hxx index c181650d8fd2..386b216a61ed 100644 --- a/idl/inc/module.hxx +++ b/idl/inc/module.hxx @@ -90,7 +90,8 @@ public: HelpIdTable& rTable ); }; SV_DECL_IMPL_REF(SvMetaModule) -SV_DECL_IMPL_PERSIST_LIST(SvMetaModule,SvMetaModule *) + +class SvMetaModuleMemberList : public SvDeclPersistList<SvMetaModule *> {}; #endif // _MODULE_HXX diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx index c236a6ff785f..cbe4d31bd680 100644 --- a/idl/inc/object.hxx +++ b/idl/inc/object.hxx @@ -66,9 +66,11 @@ public: }; SV_DECL_IMPL_REF(SvClassElement) -SV_DECL_IMPL_PERSIST_LIST(SvClassElement,SvClassElement *) -SV_DECL_PERSIST_LIST(SvMetaClass,SvMetaClass *) +class SvClassElementMemberList : public SvDeclPersistList<SvClassElement *> {}; + +class SvMetaClassMemberList : public SvDeclPersistList<SvMetaClass *> {}; + class SvMetaClass : public SvMetaType { SvMetaAttributeMemberList aAttrList; @@ -133,7 +135,6 @@ public: HelpIdTable& rTable ); }; SV_IMPL_REF(SvMetaClass) -SV_IMPL_PERSIST_LIST(SvMetaClass,SvMetaClass *) #endif // _OBJECT_HXX diff --git a/idl/inc/slot.hxx b/idl/inc/slot.hxx index 3b2cb6679999..1427218580a2 100644 --- a/idl/inc/slot.hxx +++ b/idl/inc/slot.hxx @@ -254,7 +254,8 @@ public: virtual void WriteCSV( SvIdlDataBase&, SvStream& ); }; SV_DECL_IMPL_REF(SvMetaSlot) -SV_DECL_IMPL_PERSIST_LIST(SvMetaSlot,SvMetaSlot *) + +class SvMetaSlotMemberList : public SvDeclPersistList<SvMetaSlot *> {}; #endif // _SLOT_HXX diff --git a/idl/inc/types.hxx b/idl/inc/types.hxx index 234d80ea08ce..7189ceb14cd0 100644 --- a/idl/inc/types.hxx +++ b/idl/inc/types.hxx @@ -33,7 +33,9 @@ typedef std::map<sal_uLong, SvMetaSlot*> HelpIdTable; SV_DECL_REF(SvMetaType) SV_DECL_REF(SvMetaAttribute) -SV_DECL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) + +class SvMetaAttributeMemberList : public SvDeclPersistList<SvMetaAttribute *> {}; + class SvMetaAttribute : public SvMetaReference { SvMetaTypeRef aType; @@ -119,7 +121,6 @@ public: rtl::OString Compare( SvMetaAttribute *pAttr ); }; SV_IMPL_REF(SvMetaAttribute) -SV_IMPL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) enum { CALL_VALUE, CALL_POINTER, CALL_REFERENCE }; @@ -175,11 +176,11 @@ public: SvMetaAttributeMemberList & GetAttrList() const; sal_uLong GetAttrCount() const { - return pAttrList ? pAttrList->Count() : 0L; + return pAttrList ? pAttrList->size() : 0L; } void AppendAttr( SvMetaAttribute * pAttr ) { - GetAttrList().Append( pAttr ); + GetAttrList().push_back( pAttr ); } void SetType( int nT ); @@ -236,8 +237,8 @@ public: const rtl::OString& rChief ); }; SV_IMPL_REF(SvMetaType) -SV_DECL_IMPL_PERSIST_LIST(SvMetaType,SvMetaType *) +class SvMetaTypeMemberList : public SvDeclPersistList<SvMetaType *> {}; class SvMetaTypeString : public SvMetaType { @@ -246,8 +247,8 @@ public: SvMetaTypeString(); }; SV_DECL_IMPL_REF(SvMetaTypeString) -SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeString,SvMetaTypeString *) +class SvMetaTypeStringMemberList : public SvDeclPersistList<SvMetaTypeString *> {}; class SvMetaEnumValue : public SvMetaName { @@ -262,8 +263,8 @@ public: WriteType, WriteAttribute = 0 ); }; SV_DECL_IMPL_REF(SvMetaEnumValue) -SV_DECL_IMPL_PERSIST_LIST(SvMetaEnumValue,SvMetaEnumValue *) +class SvMetaEnumValueMemberList : public SvDeclPersistList<SvMetaEnumValue *> {}; class SvMetaTypeEnum : public SvMetaType { @@ -280,10 +281,10 @@ public: SvMetaTypeEnum(); sal_uInt16 GetMaxValue() const; - sal_uLong Count() const { return aEnumValueList.Count(); } + sal_uLong Count() const { return aEnumValueList.size(); } const rtl::OString& GetPrefix() const { return aPrefix; } SvMetaEnumValue * GetObject( sal_uLong n ) const - { return aEnumValueList.GetObject( n ); } + { return aEnumValueList[n]; } virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ); virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab ); @@ -293,8 +294,8 @@ public: WriteType, WriteAttribute = 0 ); }; SV_DECL_IMPL_REF(SvMetaTypeEnum) -SV_DECL_IMPL_PERSIST_LIST(SvMetaTypeEnum,SvMetaTypeEnum *) +class SvMetaTypeEnumMemberList : public SvDeclPersistList<SvMetaTypeEnum *> {}; class SvMetaTypevoid : public SvMetaType { @@ -303,7 +304,7 @@ public: SvMetaTypevoid(); }; SV_DECL_IMPL_REF(SvMetaTypevoid) -SV_DECL_IMPL_PERSIST_LIST(SvMetaTypevoid,SvMetaTypevoid *) +class SvMetaTypevoidMemberList : public SvDeclPersistList<SvMetaTypevoid *> {}; #endif // _TYPES_HXX 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 ); } diff --git a/sd/source/filter/eppt/text.hxx b/sd/source/filter/eppt/text.hxx index aadd938ea13a..8f5c257d6ea6 100644 --- a/sd/source/filter/eppt/text.hxx +++ b/sd/source/filter/eppt/text.hxx @@ -35,6 +35,7 @@ #include <rtl/textenc.h> #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/lang/Locale.hpp> +#include <tools/list.hxx> namespace com { namespace sun { namespace star { namespace awt { struct FontDescriptor; } diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx index efcfda8983a0..5c79e517944f 100644 --- a/svtools/source/graphic/grfcache.hxx +++ b/svtools/source/graphic/grfcache.hxx @@ -31,6 +31,7 @@ #include <vcl/graph.hxx> #include <vcl/timer.hxx> +#include <tools/list.hxx> #include <svtools/grfmgr.hxx> #include <list> diff --git a/svx/inc/svx/svdlayer.hxx b/svx/inc/svx/svdlayer.hxx index 25b27ef9601f..aac75c9b009c 100644 --- a/svx/inc/svx/svdlayer.hxx +++ b/svx/inc/svx/svdlayer.hxx @@ -31,6 +31,7 @@ #include <tools/string.hxx> #include <tools/stream.hxx> +#include <tools/contnr.hxx> #include <svx/svdsob.hxx> #include <svx/svdtypes.hxx> // fuer typedef SdrLayerID #include "svx/svxdllapi.h" diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx index eaca035b81be..f09b68e9e625 100644 --- a/svx/inc/svx/xtable.hxx +++ b/svx/inc/svx/xtable.hxx @@ -41,6 +41,7 @@ #include <tools/color.hxx> #include <tools/string.hxx> +#include <tools/list.hxx> #include <cppuhelper/weak.hxx> diff --git a/tools/inc/tools/pstm.hxx b/tools/inc/tools/pstm.hxx index 64a3b64d9175..1cb882afcf03 100644 --- a/tools/inc/tools/pstm.hxx +++ b/tools/inc/tools/pstm.hxx @@ -104,35 +104,50 @@ public: SV_DECL_IMPL_REF(SvPersistBase) /*************************************************************************/ -// Damit die Liste, anders benannt wird -typedef SvPersistBase SuperSvPersistBase; -SV_DECL_REF_LIST_VISIBILITY(SuperSvPersistBase,SuperSvPersistBase*,TOOLS_DLLPUBLIC) -SV_IMPL_REF_LIST(SuperSvPersistBase,SuperSvPersistBase*) -class TOOLS_DLLPUBLIC SvPersistBaseMemberList : public SuperSvPersistBaseMemberList +class SvPersistListWriteable { public: - SvPersistBaseMemberList(); - - void WriteObjects( SvPersistStream &, sal_Bool bOnlyStreamedObj = sal_False ) const; - TOOLS_DLLPUBLIC friend SvPersistStream& operator << (SvPersistStream &, const SvPersistBaseMemberList &); - TOOLS_DLLPUBLIC friend SvPersistStream& operator >> (SvPersistStream &, SvPersistBaseMemberList &); + virtual ~SvPersistListWriteable() {} + virtual size_t size() const = 0; + virtual SvPersistBase* GetPersistBase(size_t idx) const = 0; +}; +class SvPersistListReadable +{ +public: + virtual ~SvPersistListReadable() {} + virtual void push_back(SvPersistBase* p) = 0; }; -/*************************************************************************/ -#define SV_DECL_PERSIST_LIST(ClassName,EntryName)\ -class ClassName##MemberList : public SvPersistBaseMemberList\ -{\ -public:\ - PRV_SV_DECL_MEMBER_LIST(ClassName,EntryName)\ +void TOOLS_DLLPUBLIC WritePersistListObjects(const SvPersistListWriteable& rList, SvPersistStream & rStm, bool bOnlyStreamed = false ); + +void TOOLS_DLLPUBLIC ReadObjects( SvPersistListReadable& rLst, SvPersistStream & rStm); + +// T has to be a subtype of "SvPersistBase*" +template<typename T> +class SvDeclPersistList : public SvRefMemberList<T>, public SvPersistListWriteable, public SvPersistListReadable +{ +public: + // implement the reader/writer adapter methods + size_t size() const { return SvRefMemberList<T>::size(); } + SvPersistBase* GetPersistBase(size_t idx) const { return SvRefMemberList<T>::operator[](idx); } + void push_back(SvPersistBase* p) { SvRefMemberList<T>::push_back(static_cast<T>(p)); } + void WriteObjects(SvPersistStream & rStm, bool bOnlyStreamed ) const { WritePersistListObjects(*this, rStm, bOnlyStreamed); } }; -#define SV_IMPL_PERSIST_LIST(ClassName,EntryName)\ - PRV_SV_IMPL_MEMBER_LIST(ClassName,EntryName,SvPersistBaseMemberList) +template<typename T> +TOOLS_DLLPUBLIC SvPersistStream& operator << (SvPersistStream &rStm, const SvDeclPersistList<T> &rLst) +{ + WritePersistListObjects( rLst, rStm ); + return rStm; +}; -#define SV_DECL_IMPL_PERSIST_LIST(ClassName,EntryName)\ -SV_DECL_PERSIST_LIST(ClassName,EntryName)\ -SV_IMPL_PERSIST_LIST(ClassName,EntryName) +template<typename T> +TOOLS_DLLPUBLIC SvPersistStream& operator >> (SvPersistStream &rStm, SvDeclPersistList<T> &rLst) +{ + ReadObjects( rLst, rStm ); + return rStm; +}; typedef UniqueIndex<SvPersistBase> SvPersistUIdx; diff --git a/tools/inc/tools/ref.hxx b/tools/inc/tools/ref.hxx index 7a3257e2bb74..5e33c79174f0 100644 --- a/tools/inc/tools/ref.hxx +++ b/tools/inc/tools/ref.hxx @@ -20,7 +20,7 @@ #define _REF_HXX #include "tools/toolsdllapi.h" -#include <tools/list.hxx> +#include <vector> //========================================================================= @@ -101,222 +101,59 @@ PRV_SV_IMPL_REF_COUNTERS( ClassName, Lock, OwnerLock( sal_True ), \ /************************** S v R e f L i s t ****************************/ -#define PRV_SV_DECL_REF_LIST(CN,EN,vis) \ -class CN##List : private List \ -{ \ -public: \ - using List::Clear; \ - using List::Count; \ - using List::GetCurPos; \ - \ - CN##List( sal_uInt16 _nInitSize = 16, sal_uInt16 _nReSize = 16 ) \ - : List( _nInitSize, _nReSize ) {} \ - CN##List( sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, \ - sal_uInt16 _nReSize ) \ - : List( _nBlockSize, _nInitSize, _nReSize ) {} \ - CN##List( const CN##List& rClassName ) \ - : List( rClassName ) {} \ - \ - void Insert( EN p, sal_uIntPtr nIndex ) \ - { List::Insert( (void*)p, nIndex ); } \ - void Insert( EN p ) \ - { List::Insert( (void*)p ); } \ - EN Remove() \ - { return (EN)List::Remove(); } \ - EN Remove( sal_uIntPtr nIndex ) \ - { return (EN)List::Remove( nIndex ); } \ - EN Remove( EN p ) \ - { return (EN)List::Remove( (void*)p ); } \ - EN Replace( EN p, sal_uIntPtr nIndex ) \ - { return (EN)List::Replace( (void*)p, nIndex ); } \ - EN Replace( EN pNew, EN pOld ) \ - { return (EN)List::Replace( (void*)pNew, (void*)pOld ); } \ - \ - EN GetCurObject() const \ - { return (EN)List::GetCurObject(); } \ - EN GetObject( sal_uIntPtr nIndex ) const \ - { return (EN)List::GetObject( nIndex ); } \ - sal_uIntPtr GetPos( const EN p ) const \ - { return List::GetPos( (const void*)p ); } \ - \ - EN Seek( sal_uIntPtr nIndex ) \ - { return (EN)List::Seek( nIndex ); } \ - EN Seek( void* p ) { return (EN)List::Seek( p ); } \ - EN First() { return (EN)List::First(); } \ - EN Last() { return (EN)List::Last(); } \ - EN Next() { return (EN)List::Next(); } \ - EN Prev() { return (EN)List::Prev(); } \ - \ - CN##List& operator =( const CN##List& rClassName ) \ - { List::operator =( rClassName ); return *this; } \ - \ - sal_Bool operator ==( const CN##List& rList ) const \ - { return List::operator ==( rList ); } \ - sal_Bool operator !=( const CN##List& rList ) const \ - { return List::operator !=( rList ); } \ -}; \ -class vis CN##MemberList : public CN##List\ -{\ -public:\ - inline CN##MemberList();\ - inline CN##MemberList(sal_uInt16 nInitSz, sal_uInt16 nResize );\ - inline CN##MemberList( const CN##MemberList & rRef );\ - inline ~CN##MemberList();\ - inline CN##MemberList & operator =( const CN##MemberList & rRef );\ - inline void Clear();\ - inline void Insert( EN p )\ - {\ - CN##List::Insert( p );\ - p->AddRef();\ - }\ - inline void Insert( EN p, sal_uIntPtr nIndex )\ - {\ - CN##List::Insert( p, nIndex );\ - p->AddRef();\ - }\ - inline void Append( EN p ) { Insert( p, LIST_APPEND ); }\ - inline EN Remove();\ - inline EN Remove( sal_uIntPtr nIndex );\ - inline EN Remove( EN p );\ - inline EN Replace( EN p, sal_uIntPtr nIndex );\ - inline EN Replace( EN pNew, EN pOld );\ - inline void Append( const CN##MemberList & );\ +template<typename T> +class SvRefMemberList : private std::vector<T> +{ +private: + typedef typename std::vector<T> base_t; +public: + using base_t::size; + using base_t::front; + using base_t::back; + using base_t::operator[]; + using base_t::begin; + using base_t::end; + using base_t::iterator; + using base_t::const_iterator; + using base_t::rbegin; + using base_t::rend; + using base_t::reverse_iterator; + using base_t::empty; + + inline ~SvRefMemberList() { clear(); } + inline void clear() + { + for( typename base_t::const_iterator it = base_t::begin(); it != base_t::end(); ++it ) + { + T p = *it; + if( p ) + p->ReleaseReference(); + } + base_t::clear(); + } + inline void push_back( T p ) + { + base_t::push_back( p ); + p->AddRef(); + } + inline void insert(const SvRefMemberList& rOther) + { + for( typename base_t::const_iterator it = rOther.begin(); it != rOther.end(); ++it ) + { + push_back(*it); + } + } + inline T pop_back() + { + T p = base_t::back(); + base_t::pop_back(); + if( p ) + p->ReleaseReference(); + return p; + } }; -#define SV_DECL_REF_LIST(CN,EN) \ -PRV_SV_DECL_REF_LIST(CN,EN,/* empty */) - -#define SV_DECL_REF_LIST_VISIBILITY(CN,EN,vis) \ -PRV_SV_DECL_REF_LIST(CN,EN,vis) - -/************************** S v R e f L i s t ****************************/ -#define SV_IMPL_REF_LIST( CN, EN ) \ -inline CN##MemberList::CN##MemberList(){}\ -inline CN##MemberList::CN##MemberList(sal_uInt16 nInitSz, sal_uInt16 nResize )\ - : CN##List( nInitSz, nResize ){}\ -inline CN##MemberList::CN##MemberList( const CN##MemberList & rRef ) \ - : CN##List( rRef ) \ -{\ - sal_uIntPtr nOldCount = Count(); \ - EN pEntry = First(); \ - while( pEntry ) \ - { pEntry->AddRef(); pEntry = Next(); } \ - Seek( nOldCount ); /* auch Curser gleich */ \ -}\ -inline CN##MemberList::~CN##MemberList() { Clear(); } \ -inline CN##MemberList & CN##MemberList::operator = \ - ( const CN##MemberList & rRef ) \ -{\ - CN##MemberList & rList = (CN##MemberList &)rRef; \ - sal_uIntPtr nOldCount = rList.Count(); \ - /* Count der Objekte erhoehen */ \ - EN pEntry = rList.First(); \ - while( pEntry ) \ - { pEntry->AddRef(); pEntry = rList.Next(); } \ - rList.Seek( nOldCount ); /* Curser zurueck */ \ - /* Liste kopieren */ \ - Clear(); \ - CN##List::operator = ( rRef ); \ - return *this; \ -}\ -inline void CN##MemberList::Clear() \ -{\ - EN pEntry = Last();\ - while( NULL != pEntry )\ - pEntry = Remove();\ -}\ -inline EN CN##MemberList::Remove() \ -{\ - EN p = CN##List::Remove(); \ - if( p ) p->ReleaseReference(); return p; \ -}\ -inline EN CN##MemberList::Remove( sal_uIntPtr nIndex ) \ -{\ - EN p = CN##List::Remove( nIndex ); \ - if( p ) p->ReleaseReference(); return p; \ -}\ -inline EN CN##MemberList::Remove( EN p ) \ -{\ - p = CN##List::Remove( p ); \ - if( p ) p->ReleaseReference(); return p; \ -}\ -inline EN CN##MemberList::Replace( EN p, sal_uIntPtr nIndex ) \ -{\ - p->AddRef(); p = CN##List::Replace( p, nIndex ); \ - if( p ) p->ReleaseReference(); return p; \ -}\ -inline EN CN##MemberList::Replace( EN pNew, EN pOld ) \ -{\ - pNew->AddRef(); CN##List::Replace( pNew, pOld ); \ - if( pOld ) pOld->ReleaseReference(); return pOld; \ -}\ -inline void CN##MemberList::Append( const CN##MemberList & rList )\ -{\ - for( sal_uIntPtr i = 0; i < rList.Count(); i++ )\ - Append( rList.GetObject( i ) );\ -} - -/************************** S v M e m b e r L i s t **********************/ -#define PRV_SV_DECL_MEMBER_LIST(Class,EntryName) \ - Class##MemberList() {} \ -inline void Insert( EntryName p ); \ -inline void Insert( EntryName p, sal_uIntPtr nIndex ); \ -inline void Append( EntryName p ); \ -inline EntryName Remove(); \ -inline EntryName Remove( sal_uIntPtr nIndex ); \ -inline EntryName Remove( EntryName p ); \ -inline EntryName Replace( EntryName p, sal_uIntPtr nIndex );\ -inline EntryName Replace( EntryName pNew, EntryName pOld );\ -inline EntryName GetCurObject() const;\ -inline EntryName GetObject( sal_uIntPtr nIndex ) const;\ -inline sal_uIntPtr GetPos( const EntryName ) const;\ -inline EntryName Seek( sal_uIntPtr nIndex );\ -inline EntryName Seek( EntryName p );\ -inline EntryName First();\ -inline EntryName Last();\ -inline EntryName Next();\ -inline EntryName Prev();\ -inline void Append( const Class##MemberList & rList ); - -#define PRV_SV_IMPL_MEMBER_LIST(ClassName,EntryName,BaseList)\ -inline void ClassName##MemberList::Insert( EntryName p )\ - {BaseList::Insert(p);}\ -inline void ClassName##MemberList::Insert( EntryName p, sal_uIntPtr nIdx )\ - {BaseList::Insert(p,nIdx);}\ -inline void ClassName##MemberList::Append( EntryName p )\ - {BaseList::Append(p);}\ -inline EntryName ClassName##MemberList::Remove()\ - {return (EntryName)BaseList::Remove();}\ -inline EntryName ClassName##MemberList::Remove( sal_uIntPtr nIdx )\ - {return (EntryName)BaseList::Remove(nIdx);}\ -inline EntryName ClassName##MemberList::Remove( EntryName p )\ - {return (EntryName)BaseList::Remove(p);}\ -inline EntryName ClassName##MemberList::Replace( EntryName p, sal_uIntPtr nIdx )\ - {return (EntryName)BaseList::Replace(p,nIdx);}\ -inline EntryName ClassName##MemberList::Replace( EntryName p, EntryName pOld )\ - {return (EntryName)BaseList::Replace(p,pOld);}\ -inline EntryName ClassName##MemberList::GetCurObject() const\ - {return (EntryName)BaseList::GetCurObject();}\ -inline EntryName ClassName##MemberList::GetObject( sal_uIntPtr nIdx ) const\ - {return (EntryName)BaseList::GetObject( nIdx );}\ -inline EntryName ClassName##MemberList::Seek( sal_uIntPtr nIdx )\ - {return (EntryName)BaseList::Seek( nIdx );}\ -inline EntryName ClassName##MemberList::Seek( EntryName p )\ - {return (EntryName)BaseList::Seek( p );}\ -inline EntryName ClassName##MemberList::First()\ - {return (EntryName)BaseList::First();}\ -inline EntryName ClassName##MemberList::Last()\ - {return (EntryName)BaseList::Last();}\ -inline EntryName ClassName##MemberList::Next()\ - {return (EntryName)BaseList::Next();}\ -inline EntryName ClassName##MemberList::Prev()\ - {return (EntryName)BaseList::Prev();}\ -inline void ClassName##MemberList::Append( const ClassName##MemberList & rList )\ - {BaseList::Append(rList);}\ -inline sal_uIntPtr ClassName##MemberList::GetPos( const EntryName p) const\ - {return BaseList::GetPos( p );} - /************************** S v R e f B a s e ****************************/ #define SV_NO_DELETE_REFCOUNT 0x80000000 class TOOLS_DLLPUBLIC SvRefBase diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 46a36e93fcff..3940c115d1a3 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -22,6 +22,7 @@ #include <tools/inetmime.hxx> #include <tools/inetmsg.hxx> #include <tools/inetstrm.hxx> +#include <tools/list.hxx> #include <rtl/instance.hxx> #include <rtl/strbuf.hxx> #include <comphelper/string.hxx> diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 064a09bd8b35..ecd9e4763b88 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -52,16 +52,13 @@ TYPEINIT0( SvRttiBase ); /****************** SvPersistBaseMemberList ******************************/ -SvPersistBaseMemberList::SvPersistBaseMemberList(){} - #define PERSIST_LIST_VER (sal_uInt8)0 #define PERSIST_LIST_DBGUTIL (sal_uInt8)0x80 /************************************************************************ -|* SvPersistBaseMemberList::WriteOnlyStreamedObjects() +|* WritePersistListObjects() *************************************************************************/ -void SvPersistBaseMemberList::WriteObjects( SvPersistStream & rStm, - sal_Bool bOnlyStreamed ) const +void TOOLS_DLLPUBLIC WritePersistListObjects(const SvPersistListWriteable& rList, SvPersistStream & rStm, bool bOnlyStreamed ) { #ifdef STOR_NO_OPTIMIZE rStm << (sal_uInt8)(PERSIST_LIST_VER | PERSIST_LIST_DBGUTIL); @@ -70,7 +67,7 @@ void SvPersistBaseMemberList::WriteObjects( SvPersistStream & rStm, sal_uInt8 bTmp = PERSIST_LIST_VER; rStm << bTmp; #endif - sal_uInt32 nCountMember = Count(); + sal_uInt32 nCountMember = rList.size(); sal_uIntPtr nCountPos = rStm.Tell(); sal_uInt32 nWriteCount = 0; rStm << nCountMember; @@ -78,10 +75,10 @@ void SvPersistBaseMemberList::WriteObjects( SvPersistStream & rStm, //wegen Seiteneffekten beim Save for( sal_uIntPtr n = 0; n < nCountMember; n++ ) { - SvPersistBase * pObj = GetObject( n ); + SvPersistBase * pObj = rList.GetPersistBase( n ); if( !bOnlyStreamed || rStm.IsStreamed( pObj ) ) { // Objekt soll geschrieben werden - rStm << GetObject( n ); + rStm << pObj; nWriteCount++; } } @@ -99,20 +96,9 @@ void SvPersistBaseMemberList::WriteObjects( SvPersistStream & rStm, } /************************************************************************ -|* operator << () -*************************************************************************/ -SvPersistStream& operator << ( SvPersistStream & rStm, - const SvPersistBaseMemberList & rLst ) -{ - rLst.WriteObjects( rStm ); - return rStm; -} - -/************************************************************************ -|* operator >> () +|* ReadObjects() *************************************************************************/ -SvPersistStream& operator >> ( SvPersistStream & rStm, - SvPersistBaseMemberList & rLst ) +void TOOLS_DLLPUBLIC ReadObjects( SvPersistListReadable& rLst, SvPersistStream & rStm ) { sal_uInt8 nVer; rStm >> nVer; @@ -134,7 +120,7 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, SvPersistBase * pObj; rStm >> pObj; if( pObj ) - rLst.Append( pObj ); + rLst.push_back( pObj ); } #ifdef DBG_UTIL if( nObjLen + nObjPos != rStm.Tell() ) @@ -149,7 +135,6 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, #else (void)nObjLen; #endif - return rStm; } //========================================================================= |