summaryrefslogtreecommitdiff
path: root/sw/inc/ndindex.hxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-20 16:48:18 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-23 04:02:12 +0100
commitd5d46849714d4749467b409f6e9c7758b80e1b63 (patch)
tree33fe0589fd72c613882b03a53216d8f123474ff5 /sw/inc/ndindex.hxx
parent7a6639fc9d0bfc3481744a6de648ccbf754a109d (diff)
Make SwNodeIndex constructors inline
Change-Id: Ib29bcd5e2028c4e644621af4294c193f5b0aa14e
Diffstat (limited to 'sw/inc/ndindex.hxx')
-rw-r--r--sw/inc/ndindex.hxx48
1 files changed, 37 insertions, 11 deletions
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index 1bc358f44cde..254dd29e6d62 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -36,7 +36,8 @@ class SW_DLLPUBLIC SwNodeIndex SAL_FINAL : public sw::Ring<SwNodeIndex>
{
SwNode* pNd;
- void Remove();
+ void Remove()
+ { DeRegisterIndex( pNd->GetNodes() ); };
// These are not allowed!
SwNodeIndex( SwNodes& rNds, sal_uInt16 nIdx );
@@ -57,9 +58,30 @@ class SW_DLLPUBLIC SwNodeIndex SAL_FINAL : public sw::Ring<SwNodeIndex>
}
public:
- SwNodeIndex( SwNodes& rNds, sal_uLong nIdx = 0 );
- SwNodeIndex( const SwNodeIndex &, long nDiff = 0 );
- SwNodeIndex( const SwNode&, long nDiff = 0 );
+ SwNodeIndex( SwNodes& rNds, sal_uLong nIdx = 0 )
+ : pNd( rNds[ nIdx ] )
+ {
+ RegisterIndex( rNds );
+ };
+ SwNodeIndex( const SwNodeIndex& rIdx, long nDiff = 0 )
+ : sw::Ring<SwNodeIndex>()
+ {
+ if( nDiff )
+ pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
+ else
+ pNd = rIdx.pNd;
+ RegisterIndex( pNd->GetNodes() );
+ }
+
+ SwNodeIndex( const SwNode& rNd, long nDiff = 0 )
+ {
+ if( nDiff )
+ pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
+ else
+ pNd = (SwNode*)&rNd;
+ RegisterIndex( pNd->GetNodes() );
+ }
+
~SwNodeIndex() { Remove(); }
inline sal_uLong operator++();
@@ -114,14 +136,18 @@ public:
SwNodeIndex aStart;
SwNodeIndex aEnd;
- SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE );
- SwNodeRange( const SwNodeRange &rRange );
+ SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
+ : aStart( rS ), aEnd( rE ) {};
+ SwNodeRange( const SwNodeRange &rRange )
+ : aStart( rRange.aStart ), aEnd( rRange.aEnd ) {};
+
+ SwNodeRange( SwNodes& rNds, sal_uLong nSttIdx = 0, sal_uLong nEndIdx = 0 )
+ : aStart( rNds, nSttIdx ), aEnd( rNds, nEndIdx ) {};
- SwNodeRange( SwNodes& rArr, sal_uLong nSttIdx = 0, sal_uLong nEndIdx = 0 );
- SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
- const SwNodeIndex& rE, long nEndDiff = 0 );
- SwNodeRange( const SwNode& rS, long nSttDiff,
- const SwNode& rE, long nEndDiff = 0 );
+ SwNodeRange( const SwNodeIndex& rS, long nSttDiff, const SwNodeIndex& rE, long nEndDiff = 0 )
+ : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff ) {};
+ SwNodeRange( const SwNode& rS, long nSttDiff, const SwNode& rE, long nEndDiff = 0 )
+ : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff ) {};
};
// For inlines node.hxx is needed which in turn needs this one.