From 00a6992b97a806b183e368d412508801dc632f8b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 23 Sep 2015 10:17:52 +0200 Subject: convert Link<> to typed Change-Id: I80bd798ea5d36fa94d6b3348be713dbe2cbeab14 Reviewed-on: https://gerrit.libreoffice.org/18803 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- rsc/inc/rscclobj.hxx | 8 ++++---- rsc/inc/rsctree.hxx | 2 +- rsc/source/parser/rscdb.cxx | 48 ++++++++++++++++++++++---------------------- rsc/source/tools/rsctree.cxx | 4 ++-- 4 files changed, 31 insertions(+), 31 deletions(-) (limited to 'rsc') diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx index 5eaedb6da2b5..2509e579d671 100644 --- a/rsc/inc/rscclobj.hxx +++ b/rsc/inc/rscclobj.hxx @@ -38,8 +38,8 @@ public: ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey ); ObjNode * DelObjNode( RscTop * pClass, sal_uLong lFileKey ); sal_uInt32 GetId() const SAL_OVERRIDE; - RscId GetRscId(){ return aRscId; } - sal_uLong GetFileKey(){ return lFileKey; }; + RscId GetRscId() const { return aRscId; } + sal_uLong GetFileKey() const { return lFileKey; }; ObjNode* Search( const RscId &rName ) const //< search the index in the b-tree { return static_cast(IdNode::Search( rName )); @@ -49,7 +49,7 @@ public: { return IdNode::Insert( static_cast(pTN) ); } - CLASS_DATA GetRscObj() //< get the Object from this Node + CLASS_DATA GetRscObj() const//< get the Object from this Node { return pRscObj; @@ -79,7 +79,7 @@ public: // insert new node in b-tree pObjBiTree ObjNode * GetObjNode( const RscId &rRscId ); - ObjNode * GetObjNode() + ObjNode * GetObjNode() const { // hole pObjBiTree return pObjBiTree; diff --git a/rsc/inc/rsctree.hxx b/rsc/inc/rsctree.hxx index f2f6ac29d6ee..209c4225d80c 100644 --- a/rsc/inc/rsctree.hxx +++ b/rsc/inc/rsctree.hxx @@ -43,7 +43,7 @@ protected: NameNode* ChangeBTreeDLList(); public: - void EnumNodes( Link<> aLink ) const; + void EnumNodes( Link aLink ) const; NameNode* Left() const { return pLeft; } NameNode* Right() const{ return pRight; } NameNode* Search( const NameNode * pName ) const; diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index 42aa6dac19aa..627e54908956 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -349,8 +349,8 @@ private: sal_uLong lFileKey; // what source file RscTop * pClass; - DECL_LINK( CallBackWriteRc, ObjNode * ); - DECL_LINK( CallBackWriteSrc, ObjNode * ); + DECL_LINK_TYPED( CallBackWriteRc, const NameNode&, void ); + DECL_LINK_TYPED( CallBackWriteSrc, const NameNode&, void ); ERRTYPE WriteRc( RscTop * pCl, ObjNode * pRoot ) { @@ -369,30 +369,30 @@ public: void WriteRcFile( RscWriteRc & rMem, FILE * fOutput ); }; -IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode ) +IMPL_LINK_TYPED( RscEnumerateObj, CallBackWriteRc, const NameNode&, rNode, void ) { - RscWriteRc aMem( pTypCont->GetByteOrder() ); + const ObjNode& rObjNode = static_cast(rNode); + RscWriteRc aMem( pTypCont->GetByteOrder() ); - aError = pClass->WriteRcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), + aError = pClass->WriteRcHeader( RSCINST( pClass, rObjNode.GetRscObj() ), aMem, pTypCont, - pObjNode->GetRscId(), 0, true ); + rObjNode.GetRscId(), 0, true ); if( aError.IsError() || aError.IsWarning() ) - pTypCont->pEH->Error( aError, pClass, pObjNode->GetRscId() ); + pTypCont->pEH->Error( aError, pClass, rObjNode.GetRscId() ); WriteRcFile( aMem, fOutput ); - return 0; } -IMPL_LINK( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode ) +IMPL_LINK_TYPED( RscEnumerateObj, CallBackWriteSrc, const NameNode&, rNode, void ) { - if( pObjNode->GetFileKey() == lFileKey ) + const ObjNode& rObjNode = static_cast(rNode); + if( rObjNode.GetFileKey() == lFileKey ) { - pClass->WriteSrcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), + pClass->WriteSrcHeader( RSCINST( pClass, rObjNode.GetRscObj() ), fOutput, pTypCont, 0, - pObjNode->GetRscId(), "" ); + rObjNode.GetRscId(), "" ); fprintf( fOutput, ";\n" ); } - return 0; } void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ) @@ -445,8 +445,8 @@ class RscEnumerateRef private: RscTop * pRoot; - DECL_LINK( CallBackWriteRc, RscTop * ); - DECL_LINK( CallBackWriteSrc, RscTop * ); + DECL_LINK_TYPED( CallBackWriteRc, const NameNode&, void ); + DECL_LINK_TYPED( CallBackWriteSrc, const NameNode&, void ); public: RscEnumerateObj aEnumObj; @@ -473,16 +473,16 @@ public: } }; -IMPL_LINK( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef ) +IMPL_LINK_TYPED( RscEnumerateRef, CallBackWriteRc, const NameNode&, rNode, void ) { - aEnumObj.WriteRc( pRef, pRef->GetObjNode() ); - return 0; + const RscTop& rRef = static_cast(rNode); + aEnumObj.WriteRc( const_cast(&rRef), rRef.GetObjNode() ); } -IMPL_LINK( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef ) +IMPL_LINK_TYPED( RscEnumerateRef, CallBackWriteSrc, const NameNode&, rNode, void ) { - aEnumObj.WriteSrc( pRef, pRef->GetObjNode() ); - return 0; + const RscTop& rRef = static_cast(rNode); + aEnumObj.WriteSrc( const_cast(&rRef), rRef.GetObjNode() ); } ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext ) @@ -561,7 +561,7 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, class RscDel { sal_uLong lFileKey; - DECL_LINK( Delete, RscTop * ); + DECL_LINK_TYPED( Delete, const NameNode&, void ); public: RscDel( RscTop * pRoot, sal_uLong lKey ); }; @@ -573,11 +573,11 @@ inline RscDel::RscDel( RscTop * pRoot, sal_uLong lKey ) pRoot->EnumNodes( LINK( this, RscDel, Delete ) ); } -IMPL_LINK( RscDel, Delete, RscTop *, pNode ) +IMPL_LINK_TYPED( RscDel, Delete, const NameNode&, r, void ) { + RscTop* pNode = const_cast(static_cast(&r)); if( pNode->GetObjNode() ) pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey ); - return 0; } void RscTypCont :: Delete( sal_uLong lFileKey ) diff --git a/rsc/source/tools/rsctree.cxx b/rsc/source/tools/rsctree.cxx index 8ee50368efdf..494575429dcd 100644 --- a/rsc/source/tools/rsctree.cxx +++ b/rsc/source/tools/rsctree.cxx @@ -35,11 +35,11 @@ NameNode::~NameNode() { } -void NameNode::EnumNodes( Link<> aLink ) const +void NameNode::EnumNodes( Link aLink ) const { if( Left() ) Left()->EnumNodes( aLink ); - aLink.Call( const_cast(this) ); + aLink.Call( *this ); if( Right() ) Right()->EnumNodes( aLink ); } -- cgit