X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTocBackend.h;h=379c47e536b1689e9c28f9cfa6e96cad55d41c71;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=4a03493db888aa79a6731ff466d6c843178ccf25;hpb=479e9054dbba9753a1a5e03e12ffab970caf4557;p=lyx.git diff --git a/src/TocBackend.h b/src/TocBackend.h index 4a03493db8..379c47e536 100644 --- a/src/TocBackend.h +++ b/src/TocBackend.h @@ -35,56 +35,58 @@ class LCursor; /// /** */ -class TocBackend +class TocItem { + friend class TocBackend; + public: /// - /** - */ - class Item - { - friend class TocBackend; - friend bool operator==(Item const & a, Item const & b); - - public: - /// - Item( - ParConstIterator const & par_it = ParConstIterator(), - int d = -1, - docstring const & s = docstring()); - /// - ~Item() {} - /// - bool const isValid() const; - /// - int const id() const; - /// - int const depth() const; - /// - docstring const & str() const; - /// - docstring const asString() const; - - /// the action corresponding to the goTo above - FuncRequest action() const; - - protected: - /// Current position of item. - ParConstIterator par_it_; - - /// nesting depth - int depth_; - - /// Full item string - docstring str_; - }; - - /// - typedef std::vector Toc; - typedef std::vector::const_iterator TocIterator; - /// - typedef std::map TocList; + TocItem(ParConstIterator const & par_it = ParConstIterator(), + int d = -1, + docstring const & s = docstring()); + /// + ~TocItem() {} + /// + bool const isValid() const; + /// + int const id() const; + /// + int const depth() const; + /// + docstring const & str() const; + /// + docstring const asString() const; + + /// the action corresponding to the goTo above + FuncRequest action() const; + +protected: + /// Current position of item. + ParConstIterator par_it_; + + /// nesting depth + int depth_; + + /// Full item string + docstring str_; +}; + +/// +typedef std::vector Toc; +typedef Toc::const_iterator TocIterator; +/// The ToC list. +/// A class and no typedef because we want to forward declare it. +class TocList : public std::map +{ +}; + + +/// +/** +*/ +class TocBackend +{ public: /// TocBackend(Buffer const * buffer = NULL): buffer_(buffer) {} @@ -121,14 +123,14 @@ private: }; // TocBackend inline -bool operator==(TocBackend::Item const & a, TocBackend::Item const & b) +bool operator==(TocItem const & a, TocItem const & b) { return a.id() == b.id() && a.str() == b.str() && a.depth() == b.depth(); } inline -bool operator!=(TocBackend::Item const & a, TocBackend::Item const & b) +bool operator!=(TocItem const & a, TocItem const & b) { return !(a == b); }