]> git.lyx.org Git - lyx.git/blob - src/iterators.h
In insets:
[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_fwd.h"
16
17 #include <boost/scoped_ptr.hpp>
18
19 class LyXText;
20 class InsetOld;
21
22 class ParIterator {
23 public:
24         ///
25         ParIterator(ParagraphList::iterator pit, ParagraphList const & pl);
26         ///
27         ~ParIterator();
28         ///
29         ParIterator(ParIterator const &);
30         ///
31         void operator=(ParIterator const &);
32         ///
33         ParIterator & operator++();
34         ///
35         Paragraph & operator*() const;
36         ///
37         ParagraphList::iterator operator->() const;
38         /// This gives us the top-most parent paragraph
39         ParagraphList::iterator outerPar() const;
40         ///
41         ParagraphList::iterator pit() const;
42         ///
43         ParagraphList & plist() const;
44         /// returns 'innermost' LyXText if in an inset or '0' instead of
45         //bv->text
46         LyXText * text() const;
47         ///
48         InsetOld * inset() const;
49         ///
50         size_t size() const;
51         ///
52         friend
53         bool operator==(ParIterator const & iter1, ParIterator const & iter2);
54 private:
55         struct Pimpl;
56         boost::scoped_ptr<Pimpl> pimpl_;
57 };
58
59 ///
60 bool operator==(ParIterator const & iter1, ParIterator const & iter2);
61
62 ///
63 bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
64
65
66 class ParConstIterator {
67 public:
68         ///
69         ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl);
70         ///
71         ~ParConstIterator();
72         ///
73         ParConstIterator(ParConstIterator const &);
74         ///
75         ParConstIterator & operator++();
76         ///
77         ParagraphList::const_iterator pit() const;
78         ///
79         Paragraph const & operator*() const;
80         ///
81         ParagraphList::const_iterator operator->() const;
82         ///
83         ParagraphList const & plist() const;
84
85         /// depth of nesting
86         size_t size() const;
87         ///
88         friend
89         bool operator==(ParConstIterator const & iter1,
90                         ParConstIterator const & iter2);
91 private:
92         struct Pimpl;
93         boost::scoped_ptr<Pimpl> pimpl_;
94 };
95
96 bool operator==(ParConstIterator const & iter1,
97                 ParConstIterator const & iter2);
98
99 bool operator!=(ParConstIterator const & iter1,
100                 ParConstIterator const & iter2);
101
102 #endif