Kaydet (Commit) e516f134 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Caolán McNamara

Convert tools/table.hxx usage to std::map in IDL module

Along the way, convert the table parameter passing to using references since we are never passing
a null pointer.
üst dbd9198a
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
WriteType, WriteAttribute = 0 ); WriteType, WriteAttribute = 0 );
virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ); virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
virtual void WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, virtual void WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
Table* pTable ); HelpIdTable& rTable );
}; };
SV_DECL_IMPL_REF(SvMetaModule) SV_DECL_IMPL_REF(SvMetaModule)
SV_DECL_IMPL_PERSIST_LIST(SvMetaModule,SvMetaModule *) SV_DECL_IMPL_PERSIST_LIST(SvMetaModule,SvMetaModule *)
......
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
WriteType, WriteAttribute = 0 ); WriteType, WriteAttribute = 0 );
virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ); virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
virtual void WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, virtual void WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
Table* pTable ); HelpIdTable& rTable );
}; };
SV_IMPL_REF(SvMetaClass) SV_IMPL_REF(SvMetaClass)
SV_IMPL_PERSIST_LIST(SvMetaClass,SvMetaClass *) SV_IMPL_PERSIST_LIST(SvMetaClass,SvMetaClass *)
......
...@@ -260,7 +260,7 @@ public: ...@@ -260,7 +260,7 @@ public:
sal_uInt16 WriteSlotParamArray( SvIdlDataBase & rBase, sal_uInt16 WriteSlotParamArray( SvIdlDataBase & rBase,
SvStream & rOutStm ); SvStream & rOutStm );
virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
Table * pIdTable ); HelpIdTable& rIdTable );
virtual void WriteCSV( SvIdlDataBase&, SvStream& ); virtual void WriteCSV( SvIdlDataBase&, SvStream& );
}; };
SV_DECL_IMPL_REF(SvMetaSlot) SV_DECL_IMPL_REF(SvMetaSlot)
......
...@@ -31,12 +31,15 @@ ...@@ -31,12 +31,15 @@
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <tools/ref.hxx> #include <tools/ref.hxx>
#include <tools/table.hxx>
#include <basobj.hxx> #include <basobj.hxx>
#include <map>
struct SvSlotElement; struct SvSlotElement;
typedef std::vector< SvSlotElement* > SvSlotElementList; typedef std::vector< SvSlotElement* > SvSlotElementList;
class SvMetaSlot;
typedef std::map<sal_uLong, SvMetaSlot*> HelpIdTable;
SV_DECL_REF(SvMetaType) SV_DECL_REF(SvMetaType)
SV_DECL_REF(SvMetaAttribute) SV_DECL_REF(SvMetaAttribute)
SV_DECL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *) SV_DECL_PERSIST_LIST(SvMetaAttribute,SvMetaAttribute *)
...@@ -119,9 +122,9 @@ public: ...@@ -119,9 +122,9 @@ public:
virtual void Insert( SvSlotElementList&, const rtl::OString& rPrefix, virtual void Insert( SvSlotElementList&, const rtl::OString& rPrefix,
SvIdlDataBase& ); SvIdlDataBase& );
virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
Table * pIdTable ); HelpIdTable& rIdTable );
virtual void WriteCSV( SvIdlDataBase&, SvStream& ); virtual void WriteCSV( SvIdlDataBase&, SvStream& );
void FillIDTable(Table *pIDTable); void FillIDTable(HelpIdTable& rIDTable);
rtl::OString Compare( SvMetaAttribute *pAttr ); rtl::OString Compare( SvMetaAttribute *pAttr );
}; };
SV_IMPL_REF(SvMetaAttribute) SV_IMPL_REF(SvMetaAttribute)
......
...@@ -385,12 +385,12 @@ void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) ...@@ -385,12 +385,12 @@ void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
} }
void SvMetaModule::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, void SvMetaModule::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
Table* pTable ) HelpIdTable& rTable )
{ {
for( sal_uLong n = 0; n < aClassList.Count(); n++ ) for( sal_uLong n = 0; n < aClassList.Count(); n++ )
{ {
SvMetaClass * pClass = aClassList.GetObject( n ); SvMetaClass * pClass = aClassList.GetObject( n );
pClass->WriteHelpIds( rBase, rOutStm, pTable ); pClass->WriteHelpIds( rBase, rOutStm, rTable );
} }
} }
......
...@@ -652,12 +652,12 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) ...@@ -652,12 +652,12 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
} }
void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
Table* pTable ) HelpIdTable& rTable )
{ {
for( sal_uLong n=0; n<aAttrList.Count(); n++ ) for( sal_uLong n=0; n<aAttrList.Count(); n++ )
{ {
SvMetaAttribute * pAttr = aAttrList.GetObject( n ); SvMetaAttribute * pAttr = aAttrList.GetObject( n );
pAttr->WriteHelpId( rBase, rOutStm, pTable ); pAttr->WriteHelpId( rBase, rOutStm, rTable );
} }
} }
......
...@@ -1496,12 +1496,12 @@ sal_uInt16 SvMetaSlot::WriteSlotMap( const rtl::OString& rShellName, sal_uInt16 ...@@ -1496,12 +1496,12 @@ sal_uInt16 SvMetaSlot::WriteSlotMap( const rtl::OString& rShellName, sal_uInt16
} }
void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
Table * pTable ) HelpIdTable& rTable )
{ {
sal_uLong nSId = GetSlotId().GetValue(); sal_uLong nSId = GetSlotId().GetValue();
if( !pTable->IsKeyValid( nSId ) ) if( rTable.find( nSId ) == rTable.end() )
{ {
pTable->Insert( nSId, this ); rTable[ nSId ] = this;
rOutStm << "#define " << GetSlotId().getString().getStr() << '\t' rOutStm << "#define " << GetSlotId().getString().getStr() << '\t'
<< rtl::OString::valueOf(static_cast<sal_Int32>(nSId)).getStr() << rtl::OString::valueOf(static_cast<sal_Int32>(nSId)).getStr()
<< endl; << endl;
...@@ -1533,9 +1533,9 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, ...@@ -1533,9 +1533,9 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
} }
// if id not found, write always // if id not found, write always
if( !bIdOk || !pTable->IsKeyValid( nSId2 ) ) if( !bIdOk || rTable.find( nSId2 ) == rTable.end() )
{ {
pTable->Insert( nSId2, this ); rTable[ nSId2 ] = this;
rOutStm << "#define " << aSId.getStr() << '\t' rOutStm << "#define " << aSId.getStr() << '\t'
<< rtl::OString::valueOf( << rtl::OString::valueOf(
......
...@@ -740,7 +740,7 @@ void SvMetaAttribute::Insert (SvSlotElementList&, const rtl::OString&, SvIdlData ...@@ -740,7 +740,7 @@ void SvMetaAttribute::Insert (SvSlotElementList&, const rtl::OString&, SvIdlData
{ {
} }
void SvMetaAttribute::WriteHelpId( SvIdlDataBase &, SvStream &, Table * ) void SvMetaAttribute::WriteHelpId( SvIdlDataBase &, SvStream &, HelpIdTable& )
{ {
} }
......
...@@ -765,19 +765,19 @@ sal_Bool SvIdlWorkingBase::WriteHelpIds( SvStream& rOutStm ) ...@@ -765,19 +765,19 @@ sal_Bool SvIdlWorkingBase::WriteHelpIds( SvStream& rOutStm )
if( rOutStm.GetError() != SVSTREAM_OK ) if( rOutStm.GetError() != SVSTREAM_OK )
return sal_False; return sal_False;
Table aIdTable; HelpIdTable aIdTable;
sal_uLong n; sal_uLong n;
for( n = 0; n < GetModuleList().Count(); n++ ) for( n = 0; n < GetModuleList().Count(); n++ )
{ {
SvMetaModule * pModule = GetModuleList().GetObject( n ); SvMetaModule * pModule = GetModuleList().GetObject( n );
pModule->WriteHelpIds( *this, rOutStm, &aIdTable ); pModule->WriteHelpIds( *this, rOutStm, aIdTable );
} }
const SvMetaAttributeMemberList & rAttrList = GetAttrList(); const SvMetaAttributeMemberList & rAttrList = GetAttrList();
for( n = 0; n < rAttrList.Count(); n++ ) for( n = 0; n < rAttrList.Count(); n++ )
{ {
SvMetaAttribute * pAttr = rAttrList.GetObject( n ); SvMetaAttribute * pAttr = rAttrList.GetObject( n );
pAttr->WriteHelpId( *this, rOutStm, &aIdTable ); pAttr->WriteHelpId( *this, rOutStm, aIdTable );
} }
return sal_True; return sal_True;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment