convert Link<> to typed

Change-Id: I80bd798ea5d36fa94d6b3348be713dbe2cbeab14
Reviewed-on: https://gerrit.libreoffice.org/18803
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin
2015-09-23 10:17:52 +02:00
parent 146fe08382
commit 00a6992b97
4 changed files with 31 additions and 31 deletions

View File

@@ -38,8 +38,8 @@ public:
ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey ); ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey );
ObjNode * DelObjNode( RscTop * pClass, sal_uLong lFileKey ); ObjNode * DelObjNode( RscTop * pClass, sal_uLong lFileKey );
sal_uInt32 GetId() const SAL_OVERRIDE; sal_uInt32 GetId() const SAL_OVERRIDE;
RscId GetRscId(){ return aRscId; } RscId GetRscId() const { return aRscId; }
sal_uLong GetFileKey(){ return lFileKey; }; sal_uLong GetFileKey() const { return lFileKey; };
ObjNode* Search( const RscId &rName ) const //< search the index in the b-tree ObjNode* Search( const RscId &rName ) const //< search the index in the b-tree
{ {
return static_cast<ObjNode *>(IdNode::Search( rName )); return static_cast<ObjNode *>(IdNode::Search( rName ));
@@ -49,7 +49,7 @@ public:
{ {
return IdNode::Insert( static_cast<IdNode *>(pTN) ); return IdNode::Insert( static_cast<IdNode *>(pTN) );
} }
CLASS_DATA GetRscObj() //< get the Object from this Node CLASS_DATA GetRscObj() const//< get the Object from this Node
{ {
return pRscObj; return pRscObj;
@@ -79,7 +79,7 @@ public:
// insert new node in b-tree pObjBiTree // insert new node in b-tree pObjBiTree
ObjNode * GetObjNode( const RscId &rRscId ); ObjNode * GetObjNode( const RscId &rRscId );
ObjNode * GetObjNode() ObjNode * GetObjNode() const
{ {
// hole pObjBiTree // hole pObjBiTree
return pObjBiTree; return pObjBiTree;

View File

@@ -43,7 +43,7 @@ protected:
NameNode* ChangeBTreeDLList(); NameNode* ChangeBTreeDLList();
public: public:
void EnumNodes( Link<> aLink ) const; void EnumNodes( Link<const NameNode&,void> aLink ) const;
NameNode* Left() const { return pLeft; } NameNode* Left() const { return pLeft; }
NameNode* Right() const{ return pRight; } NameNode* Right() const{ return pRight; }
NameNode* Search( const NameNode * pName ) const; NameNode* Search( const NameNode * pName ) const;

View File

@@ -349,8 +349,8 @@ private:
sal_uLong lFileKey; // what source file sal_uLong lFileKey; // what source file
RscTop * pClass; RscTop * pClass;
DECL_LINK( CallBackWriteRc, ObjNode * ); DECL_LINK_TYPED( CallBackWriteRc, const NameNode&, void );
DECL_LINK( CallBackWriteSrc, ObjNode * ); DECL_LINK_TYPED( CallBackWriteSrc, const NameNode&, void );
ERRTYPE WriteRc( RscTop * pCl, ObjNode * pRoot ) ERRTYPE WriteRc( RscTop * pCl, ObjNode * pRoot )
{ {
@@ -369,30 +369,30 @@ public:
void WriteRcFile( RscWriteRc & rMem, FILE * fOutput ); void WriteRcFile( RscWriteRc & rMem, FILE * fOutput );
}; };
IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode ) IMPL_LINK_TYPED( RscEnumerateObj, CallBackWriteRc, const NameNode&, rNode, void )
{ {
const ObjNode& rObjNode = static_cast<const ObjNode&>(rNode);
RscWriteRc aMem( pTypCont->GetByteOrder() ); RscWriteRc aMem( pTypCont->GetByteOrder() );
aError = pClass->WriteRcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), aError = pClass->WriteRcHeader( RSCINST( pClass, rObjNode.GetRscObj() ),
aMem, pTypCont, aMem, pTypCont,
pObjNode->GetRscId(), 0, true ); rObjNode.GetRscId(), 0, true );
if( aError.IsError() || aError.IsWarning() ) if( aError.IsError() || aError.IsWarning() )
pTypCont->pEH->Error( aError, pClass, pObjNode->GetRscId() ); pTypCont->pEH->Error( aError, pClass, rObjNode.GetRscId() );
WriteRcFile( aMem, fOutput ); 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<const ObjNode&>(rNode);
if( rObjNode.GetFileKey() == lFileKey )
{ {
pClass->WriteSrcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), pClass->WriteSrcHeader( RSCINST( pClass, rObjNode.GetRscObj() ),
fOutput, pTypCont, 0, fOutput, pTypCont, 0,
pObjNode->GetRscId(), "" ); rObjNode.GetRscId(), "" );
fprintf( fOutput, ";\n" ); fprintf( fOutput, ";\n" );
} }
return 0;
} }
void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ) void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut )
@@ -445,8 +445,8 @@ class RscEnumerateRef
private: private:
RscTop * pRoot; RscTop * pRoot;
DECL_LINK( CallBackWriteRc, RscTop * ); DECL_LINK_TYPED( CallBackWriteRc, const NameNode&, void );
DECL_LINK( CallBackWriteSrc, RscTop * ); DECL_LINK_TYPED( CallBackWriteSrc, const NameNode&, void );
public: public:
RscEnumerateObj aEnumObj; 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() ); const RscTop& rRef = static_cast<const RscTop&>(rNode);
return 0; aEnumObj.WriteRc( const_cast<RscTop*>(&rRef), rRef.GetObjNode() );
} }
IMPL_LINK( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef ) IMPL_LINK_TYPED( RscEnumerateRef, CallBackWriteSrc, const NameNode&, rNode, void )
{ {
aEnumObj.WriteSrc( pRef, pRef->GetObjNode() ); const RscTop& rRef = static_cast<const RscTop&>(rNode);
return 0; aEnumObj.WriteSrc( const_cast<RscTop*>(&rRef), rRef.GetObjNode() );
} }
ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext ) ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext )
@@ -561,7 +561,7 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey,
class RscDel class RscDel
{ {
sal_uLong lFileKey; sal_uLong lFileKey;
DECL_LINK( Delete, RscTop * ); DECL_LINK_TYPED( Delete, const NameNode&, void );
public: public:
RscDel( RscTop * pRoot, sal_uLong lKey ); RscDel( RscTop * pRoot, sal_uLong lKey );
}; };
@@ -573,11 +573,11 @@ inline RscDel::RscDel( RscTop * pRoot, sal_uLong lKey )
pRoot->EnumNodes( LINK( this, RscDel, Delete ) ); 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<RscTop*>(static_cast<const RscTop*>(&r));
if( pNode->GetObjNode() ) if( pNode->GetObjNode() )
pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey ); pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey );
return 0;
} }
void RscTypCont :: Delete( sal_uLong lFileKey ) void RscTypCont :: Delete( sal_uLong lFileKey )

View File

@@ -35,11 +35,11 @@ NameNode::~NameNode()
{ {
} }
void NameNode::EnumNodes( Link<> aLink ) const void NameNode::EnumNodes( Link<const NameNode&,void> aLink ) const
{ {
if( Left() ) if( Left() )
Left()->EnumNodes( aLink ); Left()->EnumNodes( aLink );
aLink.Call( const_cast<NameNode *>(this) ); aLink.Call( *this );
if( Right() ) if( Right() )
Right()->EnumNodes( aLink ); Right()->EnumNodes( aLink );
} }