Kaydet (Commit) 96c7fff3 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

inline Assign

Change-Id: Ibeb8d7b8e83d432a502707f83a8fde7900596aec
üst eaf37747
...@@ -114,8 +114,8 @@ public: ...@@ -114,8 +114,8 @@ public:
inline sal_uLong GetIndex() const; inline sal_uLong GetIndex() const;
// Enables assignments without creation of a temporary object. // Enables assignments without creation of a temporary object.
SwNodeIndex& Assign( SwNodes& rNds, sal_uLong ); inline SwNodeIndex& Assign( SwNodes& rNds, sal_uLong );
SwNodeIndex& Assign( const SwNode& rNd, long nOffset = 0 ); inline SwNodeIndex& Assign( const SwNode& rNd, long nOffset = 0 );
// Gets pointer on NodesArray. // Gets pointer on NodesArray.
inline const SwNodes& GetNodes() const; inline const SwNodes& GetNodes() const;
...@@ -282,6 +282,36 @@ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd ) ...@@ -282,6 +282,36 @@ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
return *this; return *this;
} }
SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
{
if( &pNd->GetNodes() != &rNds )
{
DeRegisterIndex( pNd->GetNodes() );
pNd = rNds[ nIdx ];
RegisterIndex( pNd->GetNodes() );
}
else
pNd = rNds[ nIdx ];
return *this;
}
SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
{
if( &pNd->GetNodes() != &rNd.GetNodes() )
{
DeRegisterIndex( pNd->GetNodes() );
pNd = (SwNode*)&rNd;
RegisterIndex( pNd->GetNodes() );
}
else
pNd = (SwNode*)&rNd;
if( nOffset )
pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
return *this;
}
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -19,61 +19,6 @@ ...@@ -19,61 +19,6 @@
#include "ndindex.hxx" #include "ndindex.hxx"
SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
{
if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
{
DeRegisterIndex( pNd->GetNodes() );
pNd = rIdx.pNd;
RegisterIndex( pNd->GetNodes() );
}
else
pNd = rIdx.pNd;
return *this;
}
SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
{
if( &pNd->GetNodes() != &rNd.GetNodes() )
{
DeRegisterIndex( pNd->GetNodes() );
pNd = (SwNode*)&rNd;
RegisterIndex( pNd->GetNodes() );
}
else
pNd = (SwNode*)&rNd;
return *this;
}
SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
{
if( &pNd->GetNodes() != &rNds )
{
DeRegisterIndex( pNd->GetNodes() );
pNd = rNds[ nIdx ];
RegisterIndex( pNd->GetNodes() );
}
else
pNd = rNds[ nIdx ];
return *this;
}
SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
{
if( &pNd->GetNodes() != &rNd.GetNodes() )
{
DeRegisterIndex( pNd->GetNodes() );
pNd = (SwNode*)&rNd;
RegisterIndex( pNd->GetNodes() );
}
else
pNd = (SwNode*)&rNd;
if( nOffset )
pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
return *this;
}
std::ostream &operator <<(std::ostream& s, const SwNodeIndex& index) std::ostream &operator <<(std::ostream& s, const SwNodeIndex& index)
{ {
......
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