2001-09-01 21:26:34 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-05-21 21:20:50 +00:00
|
|
|
|
/* \file iterators.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author unknown
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-05-21 21:20:50 +00:00
|
|
|
|
*/
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
|
|
|
|
#ifndef ITERATORS_H
|
|
|
|
|
#define ITERATORS_H
|
|
|
|
|
|
2003-09-06 12:36:58 +00:00
|
|
|
|
#include "ParagraphList_fwd.h"
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
2003-05-21 21:20:50 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
|
|
|
|
class ParIterator {
|
|
|
|
|
public:
|
2002-02-16 15:59:55 +00:00
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
ParIterator(ParagraphList::iterator pit, ParagraphList const & pl);
|
2001-09-01 21:26:34 +00:00
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
~ParIterator();
|
2002-02-16 15:59:55 +00:00
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
ParIterator(ParIterator const &);
|
2001-09-01 21:26:34 +00:00
|
|
|
|
///
|
2003-05-22 15:16:58 +00:00
|
|
|
|
void operator=(ParIterator const &);
|
|
|
|
|
///
|
2001-09-01 21:26:34 +00:00
|
|
|
|
ParIterator & operator++();
|
|
|
|
|
///
|
2003-06-12 11:09:55 +00:00
|
|
|
|
Paragraph & operator*() const;
|
2003-05-21 21:20:50 +00:00
|
|
|
|
///
|
2003-05-22 08:01:41 +00:00
|
|
|
|
ParagraphList::iterator operator->() const;
|
2003-07-25 19:18:43 +00:00
|
|
|
|
/// This gives us the top-most parent paragraph
|
2003-06-04 12:45:26 +00:00
|
|
|
|
ParagraphList::iterator outerPar() const;
|
|
|
|
|
///
|
2003-06-12 11:09:55 +00:00
|
|
|
|
ParagraphList::iterator pit() const;
|
|
|
|
|
///
|
2003-05-23 10:33:40 +00:00
|
|
|
|
ParagraphList & plist() const;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
size_t size() const;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
///
|
|
|
|
|
friend
|
|
|
|
|
bool operator==(ParIterator const & iter1, ParIterator const & iter2);
|
|
|
|
|
private:
|
2003-05-21 21:20:50 +00:00
|
|
|
|
struct Pimpl;
|
|
|
|
|
boost::scoped_ptr<Pimpl> pimpl_;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
bool operator==(ParIterator const & iter1, ParIterator const & iter2);
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
bool operator!=(ParIterator const & iter1, ParIterator const & iter2);
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
2002-11-08 01:08:27 +00:00
|
|
|
|
|
|
|
|
|
class ParConstIterator {
|
|
|
|
|
public:
|
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
ParConstIterator(ParagraphList::iterator pit, ParagraphList const & pl);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
~ParConstIterator();
|
2002-11-08 01:08:27 +00:00
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
ParConstIterator(ParConstIterator const &);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
///
|
|
|
|
|
ParConstIterator & operator++();
|
|
|
|
|
///
|
2003-06-12 11:09:55 +00:00
|
|
|
|
ParagraphList::const_iterator pit() const;
|
2003-05-21 21:20:50 +00:00
|
|
|
|
///
|
2003-06-12 11:09:55 +00:00
|
|
|
|
Paragraph const & operator*() const;
|
2002-11-08 01:08:27 +00:00
|
|
|
|
///
|
2003-06-12 11:09:55 +00:00
|
|
|
|
ParagraphList::const_iterator operator->() const;
|
2003-08-27 15:38:23 +00:00
|
|
|
|
///
|
|
|
|
|
ParagraphList const & plist() const;
|
2003-06-12 11:09:55 +00:00
|
|
|
|
|
|
|
|
|
/// depth of nesting
|
2003-05-21 21:20:50 +00:00
|
|
|
|
size_t size() const;
|
2002-11-08 01:08:27 +00:00
|
|
|
|
///
|
|
|
|
|
friend
|
|
|
|
|
bool operator==(ParConstIterator const & iter1,
|
|
|
|
|
ParConstIterator const & iter2);
|
|
|
|
|
private:
|
2003-05-21 21:20:50 +00:00
|
|
|
|
struct Pimpl;
|
|
|
|
|
boost::scoped_ptr<Pimpl> pimpl_;
|
2002-11-08 01:08:27 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-05-21 21:20:50 +00:00
|
|
|
|
bool operator==(ParConstIterator const & iter1,
|
|
|
|
|
ParConstIterator const & iter2);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
|
2003-05-21 21:20:50 +00:00
|
|
|
|
bool operator!=(ParConstIterator const & iter1,
|
|
|
|
|
ParConstIterator const & iter2);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
|
2001-09-01 21:26:34 +00:00
|
|
|
|
#endif
|