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