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"
|
2003-11-02 17:56:26 +00:00
|
|
|
|
#include "support/types.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
|
|
|
|
|
2003-10-14 13:01:49 +00:00
|
|
|
|
class LyXText;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
class InsetBase;
|
2003-10-29 12:18:08 +00:00
|
|
|
|
class Cursor;
|
2003-12-01 13:35:49 +00:00
|
|
|
|
class Buffer;
|
2003-11-03 09:23:23 +00:00
|
|
|
|
class BufferView;
|
2003-11-02 17:56:26 +00:00
|
|
|
|
class PosIterator;
|
|
|
|
|
|
2003-10-14 13:01:49 +00:00
|
|
|
|
|
2004-01-26 17:00:09 +00:00
|
|
|
|
class ParIterator : public std::iterator<
|
|
|
|
|
std::forward_iterator_tag,
|
|
|
|
|
ParagraphList::value_type> {
|
2001-09-01 21:26:34 +00:00
|
|
|
|
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-11-06 09:51:08 +00:00
|
|
|
|
ParIterator(PosIterator const &);
|
|
|
|
|
///
|
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;
|
2003-11-06 09:51:08 +00:00
|
|
|
|
/// returns 'innermost' LyXText
|
2003-12-01 13:35:49 +00:00
|
|
|
|
LyXText * text(Buffer &) const;
|
2003-10-15 08:49:44 +00:00
|
|
|
|
/// returns innermost inset
|
2004-01-26 10:13:15 +00:00
|
|
|
|
InsetBase * inset() const;
|
2003-10-15 08:49:44 +00:00
|
|
|
|
/// returns index of cell in innermost inset
|
|
|
|
|
int index() 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);
|
2003-11-03 09:23:23 +00:00
|
|
|
|
///
|
|
|
|
|
void lockPath(BufferView *) const;
|
2003-11-02 17:56:26 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
PosIterator asPosIterator(lyx::pos_type) const;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
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
|
|
|
|
|
2004-01-26 17:00:09 +00:00
|
|
|
|
class ParConstIterator : public std::iterator<
|
|
|
|
|
std::forward_iterator_tag,
|
|
|
|
|
ParagraphList::value_type> {
|
2002-11-08 01:08:27 +00:00
|
|
|
|
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);
|
2003-11-02 17:56:26 +00:00
|
|
|
|
|
2002-11-08 01:08:27 +00:00
|
|
|
|
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
|