4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
9 * \author Abdelrazak Younes
11 * Full author contact details are available in file CREDITS.
13 * TocBackend mainly used in toc.[Ch]
23 #include "ParIterator.h"
25 #include "support/strfwd.h"
38 friend class TocBackend;
41 /// Default constructor for STL containers.
44 TocItem(ParConstIterator const & par_it,
55 docstring const & str() const;
57 docstring const asString() const;
59 /// the action corresponding to the goTo above
60 FuncRequest action() const;
63 /// Current position of item.
64 ParConstIterator par_it_;
75 typedef std::vector<TocItem> Toc;
76 typedef Toc::const_iterator TocIterator;
79 /// A class and no typedef because we want to forward declare it.
80 class TocList : public std::map<std::string, Toc> {};
90 TocBackend(Buffer const * buffer = NULL): buffer_(buffer) {}
94 void setBuffer(Buffer const * buffer)
99 void updateItem(ParConstIterator const & pit);
102 TocList const & tocs() const
106 Toc const & toc(std::string const & type) const;
107 /// Return the first Toc Item before the cursor
108 TocIterator const item(
109 std::string const & type, ///< Type of Toc.
110 ParConstIterator const & ///< The cursor location in the document.
113 void writePlaintextTocList(std::string const & type, odocstream & os) const;
119 Buffer const * buffer_;
124 bool operator==(TocItem const & a, TocItem const & b)
126 return a.id() == b.id() && a.str() == b.str() && a.depth() == b.depth();
131 bool operator!=(TocItem const & a, TocItem const & b)
139 #endif // TOC_BACKEND_H