2001-09-01 21:26:34 +00:00
|
|
|
|
// -*- C++ -*-
|
2004-03-30 12:14:01 +00:00
|
|
|
|
/* \file pariterator.h
|
2003-05-21 21:20:50 +00:00
|
|
|
|
* 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
|
|
|
|
|
2004-03-30 12:14:01 +00:00
|
|
|
|
#ifndef PARITERATOR_H
|
|
|
|
|
#define PARITERATOR_H
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
2004-03-28 22:00:22 +00:00
|
|
|
|
#include "dociterator.h"
|
2006-03-24 17:37:15 +00:00
|
|
|
|
#include "ParagraphList_fwd.h"
|
2004-01-27 15:14:34 +00:00
|
|
|
|
|
2003-11-02 17:56:26 +00:00
|
|
|
|
#include "support/types.h"
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
2004-01-27 15:14:34 +00:00
|
|
|
|
#include <boost/optional.hpp>
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
2001-09-01 21:26:34 +00:00
|
|
|
|
|
2003-11-02 17:56:26 +00:00
|
|
|
|
|
2003-10-14 13:01:49 +00:00
|
|
|
|
|
2004-03-28 22:00:22 +00:00
|
|
|
|
class InsetBase;
|
|
|
|
|
class LyXText;
|
2004-01-27 15:14:34 +00:00
|
|
|
|
|
|
|
|
|
|
2004-03-28 22:00:22 +00:00
|
|
|
|
class ParIterator : public std::iterator<std::forward_iterator_tag, Paragraph>,
|
2004-03-31 19:11:56 +00:00
|
|
|
|
public DocIterator
|
2004-03-28 22:00:22 +00:00
|
|
|
|
{
|
2001-09-01 21:26:34 +00:00
|
|
|
|
public:
|
2004-11-16 20:41:38 +00:00
|
|
|
|
typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt;
|
|
|
|
|
|
|
|
|
|
typedef StdIt::value_type value_type;
|
|
|
|
|
typedef StdIt::difference_type difference_type;
|
|
|
|
|
typedef StdIt::pointer pointer;
|
|
|
|
|
typedef StdIt::reference reference;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
ParIterator() : DocIterator() {}
|
|
|
|
|
|
|
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
///
|
2004-11-24 21:53:46 +00:00
|
|
|
|
ParIterator(InsetBase &, lyx::pit_type pit);
|
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
|
|
|
|
///
|
2004-03-31 19:11:56 +00:00
|
|
|
|
ParIterator(DocIterator const &);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
|
2004-11-17 00:54:18 +00:00
|
|
|
|
/// This really should be implemented...
|
2004-11-23 23:04:52 +00:00
|
|
|
|
//ParIterator & operator=(ParIterator const &);
|
2003-05-22 15:16:58 +00:00
|
|
|
|
///
|
2001-09-01 21:26:34 +00:00
|
|
|
|
ParIterator & operator++();
|
|
|
|
|
///
|
2004-11-16 20:41:38 +00:00
|
|
|
|
ParIterator operator++(int);
|
|
|
|
|
/// See comment in pariterator.C
|
|
|
|
|
//ParIterator & operator--();
|
2004-03-28 22:00:22 +00:00
|
|
|
|
///
|
2003-06-12 11:09:55 +00:00
|
|
|
|
Paragraph & operator*() const;
|
2003-05-21 21:20:50 +00:00
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
Paragraph * operator->() const;
|
2003-07-25 19:18:43 +00:00
|
|
|
|
/// This gives us the top-most parent paragraph
|
2004-11-24 21:53:46 +00:00
|
|
|
|
lyx::pit_type outerPar() const;
|
2003-06-04 12:45:26 +00:00
|
|
|
|
///
|
2004-11-24 21:53:46 +00:00
|
|
|
|
lyx::pit_type pit() const;
|
2003-06-12 11:09:55 +00:00
|
|
|
|
///
|
2003-05-23 10:33:40 +00:00
|
|
|
|
ParagraphList & plist() const;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
};
|
|
|
|
|
|
2004-03-28 22:00:22 +00:00
|
|
|
|
|
2004-03-31 19:11:56 +00:00
|
|
|
|
DocIterator makeDocIterator(ParIterator const &, lyx::pos_type);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
|
2004-03-30 08:18:09 +00:00
|
|
|
|
ParIterator par_iterator_begin(InsetBase & inset);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
|
2004-03-30 08:18:09 +00:00
|
|
|
|
ParIterator par_iterator_end(InsetBase & inset);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
|
|
|
|
|
|
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-03-28 22:00:22 +00:00
|
|
|
|
class ParConstIterator : public std::iterator<std::forward_iterator_tag,
|
|
|
|
|
Paragraph>,
|
2004-03-31 19:11:56 +00:00
|
|
|
|
public DocIterator
|
2004-03-28 22:00:22 +00:00
|
|
|
|
{
|
2002-11-08 01:08:27 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
2003-05-21 21:20:50 +00:00
|
|
|
|
ParConstIterator(ParConstIterator const &);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
///
|
2004-03-31 19:11:56 +00:00
|
|
|
|
ParConstIterator(DocIterator const &);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
///
|
|
|
|
|
|
2002-11-08 01:08:27 +00:00
|
|
|
|
ParConstIterator & operator++();
|
|
|
|
|
///
|
2004-03-28 22:00:22 +00:00
|
|
|
|
ParConstIterator & operator--();
|
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
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
Paragraph const * operator->() const;
|
2003-08-27 15:38:23 +00:00
|
|
|
|
///
|
|
|
|
|
ParagraphList const & plist() const;
|
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
|
|
|
|
|
2004-03-30 08:18:09 +00:00
|
|
|
|
|
|
|
|
|
ParConstIterator par_const_iterator_begin(InsetBase const & inset);
|
|
|
|
|
|
|
|
|
|
ParConstIterator par_const_iterator_end(InsetBase const & inset);
|
|
|
|
|
|
|
|
|
|
|
2001-09-01 21:26:34 +00:00
|
|
|
|
#endif
|