]> git.lyx.org Git - lyx.git/blob - src/iterators.h
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[lyx.git] / src / iterators.h
1 // -*- C++ -*-
2 /* \file iterators.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef ITERATORS_H
13 #define ITERATORS_H
14
15 #include "ParagraphList.h"
16
17 #include <boost/scoped_ptr.hpp>
18
19 class ParIterator {
20 public:
21         ///
22         ParIterator(ParagraphList::iterator pit, ParagraphList const & pl);
23         ///
24         ~ParIterator();
25         ///
26         ParIterator(ParIterator const &);
27         ///
28         void operator=(ParIterator const &);
29         ///
30         ParIterator & operator++();
31         ///
32         Paragraph & operator*() const;
33         ///
34         ParagraphList::iterator operator->() const;
35         /// This gives us the top-most parent paragraph
36         ParagraphList::iterator outerPar() const;
37         ///
38         ParagraphList::iterator pit() const;
39         ///
40         ParagraphList & plist() const;
41         ///
42         size_t size() const;
43         ///
44         friend
45         bool operator==(ParIterator const & iter1, ParIterator const & iter2);
46 private:
47         struct Pimpl;
48         boost::scoped_ptr<Pimpl> pimpl_;
49 };
50
51 ///
52 bool operator==(ParIterator const & iter1, ParIterator const & iter2);
53
54 ///
55 bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
56
57
58 class ParConstIterator {
59 public:
60         ///
61         ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl);
62         ///
63         ~ParConstIterator();
64         ///
65         ParConstIterator(ParConstIterator const &);
66         ///
67         ParConstIterator & operator++();
68         ///
69         ParagraphList::const_iterator pit() const;
70         ///
71         Paragraph const & operator*() const;
72         ///
73         ParagraphList::const_iterator operator->() const;
74
75         /// depth of nesting
76         size_t size() const;
77         ///
78         friend
79         bool operator==(ParConstIterator const & iter1,
80                         ParConstIterator const & iter2);
81 private:
82         struct Pimpl;
83         boost::scoped_ptr<Pimpl> pimpl_;
84 };
85
86 bool operator==(ParConstIterator const & iter1,
87                 ParConstIterator const & iter2);
88
89 bool operator!=(ParConstIterator const & iter1,
90                 ParConstIterator const & iter2);
91
92 #endif