summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-02 09:36:37 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-02 11:15:01 +0100
commit1bea427d55ecf4a1914a6c404fc0f06a7bb044bd (patch)
treefafcaf5c07e122e75ade45be89bf13976aa5ca26 /sw/inc
parent98ee936a114bdd78c304aac824508cd4fd9ce59a (diff)
add rangeRing() for easier iteration
Change-Id: I0ef002c0c32c1435cbc62f954f98dc11c3f69945
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/edimp.hxx2
-rw-r--r--sw/inc/ring.hxx5
2 files changed, 6 insertions, 1 deletions
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index 9f22e64eb560..f3f985aa0f6d 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -31,7 +31,7 @@ class SwNodeIndex;
#define PCURCRSR (static_cast<SwPaM *>(&__r))
#define FOREACHPAM_START(pCURSH) \
- BOOST_FOREACH(SwPaM& __r, std::make_pair((pCURSH)->beginRing(), (pCURSH)->endRing())) \
+ BOOST_FOREACH(SwPaM& __r, (pCURSH)->rangeRing()) \
{
#define FOREACHPAM_END() }
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index e364be893822..33bc069bdfba 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -21,6 +21,7 @@
#include <swdllapi.h>
#include <swtypes.hxx>
+#include <utility>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/intrusive/circular_list_algorithms.hpp>
@@ -67,6 +68,10 @@ namespace sw
iterator endRing();
const_iterator beginRing() const;
const_iterator endRing() const;
+ std::pair<iterator, iterator> rangeRing()
+ { return std::make_pair(beginRing(), endRing()); }
+ std::pair<const_iterator, const_iterator> rangeRing() const
+ { return std::make_pair(beginRing(), endRing()); }
sal_uInt32 numberOf() const
{ return algo::count(static_cast< const T* >(this)); }