]> git.lyx.org Git - lyx.git/blob - src/FontIterator.h
Add support for the jurabib package (www.jurabib.org), a package for elegant BibTeX...
[lyx.git] / src / FontIterator.h
1 // -*- C++ -*-
2 /**
3  * \file src/FontIterator.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alfredo Braunstein
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  *
12  * Calling LyXText::getFont is slow. While rebreaking we scan a
13  * paragraph from left to right calling getFont for every char.  This
14  * simple class address this problem by hidding an optimization trick
15  * (not mine btw -AB): the font is reused in the whole font span.  The
16  * class handles transparently the "hidden" (not part of the fontlist)
17  * label font (as getFont does).
18  */
19
20 #ifndef FONTITERATOR_H
21 #define FONTITERATOR_H
22
23
24 #include "lyxfont.h"
25 #include "ParagraphList_fwd.h"
26
27 #include "support/types.h"
28
29 class LyXText;
30
31 class FontIterator : std::iterator<std::forward_iterator_tag, LyXFont>
32 {
33 public:
34         FontIterator(LyXText const & text, ParagraphList::iterator pit,
35                      lyx::pos_type pos);
36         
37         LyXFont operator*() const;
38         FontIterator & operator++();
39         LyXFont * operator->();
40
41 private:
42         LyXText const & text_;
43         ParagraphList::iterator pit_;
44         lyx::pos_type pos_;
45         LyXFont font_;
46         lyx::pos_type endspan_;
47         lyx::pos_type bodypos_;
48 };
49
50 #endif //FONTITERATOR_H