]> git.lyx.org Git - lyx.git/blob - src/FontIterator.cpp
Fixed some lines that were too long. It compiled afterwards.
[lyx.git] / src / FontIterator.cpp
1 /**
2  * \file src/FontIterator.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alfredo Braunstein
7  *
8  * Full author contact details are available in file CREDITS.
9  *
10  */
11
12
13 #include <config.h>
14
15 #include "FontIterator.h"
16
17 #include "Buffer.h"
18 #include "Text.h"
19 #include "Paragraph.h"
20
21
22 namespace lyx {
23
24
25 FontIterator::FontIterator(Buffer const & buffer, Text const & text,
26                 Paragraph const & par, pos_type pos)
27         : buffer_(buffer), text_(text), par_(par), pos_(pos),
28           font_(text.getFont(buffer, par, pos)),
29           endspan_(par.fontSpan(pos).last),
30           bodypos_(par.beginOfBody())
31 {}
32
33
34 Font const & FontIterator::operator*() const
35 {
36         return font_;
37 }
38
39
40 Font * FontIterator::operator->()
41 {
42         return &font_;
43 }
44
45
46 FontIterator & FontIterator::operator++()
47 {
48         ++pos_;
49         if (pos_ > endspan_ || pos_ == bodypos_) {
50                 font_ = text_.getFont(buffer_, par_, pos_);
51                 endspan_ = par_.fontSpan(pos_).last;
52         }
53         return *this;
54 }
55
56
57 } // namespace lyx