2001-09-01 21:26:34 +00:00
|
|
|
// -*- C++ -*-
|
2007-04-26 04:41:58 +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
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-05-21 21:20:50 +00:00
|
|
|
*
|
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
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "DocIterator.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
|
|
|
|
2003-11-02 17:56:26 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2008-11-17 11:46:07 +00:00
|
|
|
class Buffer;
|
2007-04-29 13:39:47 +00:00
|
|
|
class Inset;
|
2020-10-20 08:36:59 +00:00
|
|
|
class Paragraph;
|
2007-04-26 08:30:11 +00:00
|
|
|
class ParagraphList;
|
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;
|
|
|
|
|
|
|
|
///
|
2008-11-17 11:46:07 +00:00
|
|
|
///
|
|
|
|
ParIterator(Buffer * buf) : DocIterator(buf) {}
|
2002-02-16 15:59:55 +00:00
|
|
|
///
|
2020-11-06 16:23:52 +00:00
|
|
|
ParIterator(ParIterator const & pi) :
|
|
|
|
DocIterator(DocIterator(pi)) {}
|
2001-09-01 21:26:34 +00:00
|
|
|
///
|
2020-11-06 16:23:52 +00:00
|
|
|
explicit ParIterator(DocIterator const & dit) :
|
|
|
|
DocIterator(dit) {}
|
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);
|
2007-04-26 04:41:58 +00:00
|
|
|
/// See comment in ParIterator.cpp
|
2004-11-16 20:41:38 +00:00
|
|
|
//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
|
2006-10-21 00:16:43 +00:00
|
|
|
pit_type outerPar() const;
|
2003-06-04 12:45:26 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
pit_type pit() const;
|
2003-06-12 11:09:55 +00:00
|
|
|
///
|
2006-04-08 05:17:45 +00:00
|
|
|
/// return the paragraph this cursor is in
|
|
|
|
pit_type & pit() { return DocIterator::pit(); }
|
|
|
|
|
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
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
ParIterator par_iterator_begin(Inset & inset);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
ParIterator par_iterator_end(Inset & inset);
|
2004-03-28 22:00:22 +00:00
|
|
|
|
|
|
|
|
2001-09-01 21:26:34 +00:00
|
|
|
///
|
2008-01-12 21:38:51 +00:00
|
|
|
//bool operator==(ParIterator const & it1, ParIterator const & it2);
|
2001-09-01 21:26:34 +00:00
|
|
|
|
2008-01-12 21:38:51 +00:00
|
|
|
// FIXME: Unfortunately operator!=(ParIterator &, ParIterator &) is
|
|
|
|
// implemented with operator!=(DocIterator &, DocIterator &) that gives
|
|
|
|
// false if the positions are different, even if the pars are the same.
|
|
|
|
// So ultimately it's a bug in operator!=(ParIterator &, ParIterator &)
|
|
|
|
// I'd say (nevertheless, I would be reluctant to change it, because I
|
|
|
|
// fear that some part of the code could rely on this "bug". --Alfredo
|
|
|
|
//bool operator!=(ParIterator const & it1, ParIterator const & it2);
|
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:
|
2006-04-22 18:48:28 +00:00
|
|
|
///
|
2020-11-06 16:23:52 +00:00
|
|
|
ParConstIterator(Buffer const * buf)
|
|
|
|
: DocIterator(const_cast<Buffer *>(buf)) {}
|
2002-11-08 01:08:27 +00:00
|
|
|
///
|
2020-11-06 16:23:52 +00:00
|
|
|
ParConstIterator(ParConstIterator const & pi)
|
|
|
|
: DocIterator(DocIterator(pi)) {}
|
2002-11-08 01:08:27 +00:00
|
|
|
///
|
2020-11-06 16:23:52 +00:00
|
|
|
explicit ParConstIterator(DocIterator const & dit)
|
|
|
|
: DocIterator(dit) {}
|
2004-03-28 22:00:22 +00:00
|
|
|
///
|
2008-02-15 08:32:27 +00:00
|
|
|
void push_back(Inset 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
|
|
|
};
|
|
|
|
|
2020-11-08 21:26:36 +00:00
|
|
|
//bool operator==(ParConstIterator const & it1, ParConstIterator const & it2);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
2008-01-12 21:38:51 +00:00
|
|
|
//bool operator!=(ParConstIterator const & it1, ParConstIterator const & it2);
|
2002-11-08 01:08:27 +00:00
|
|
|
|
2004-03-30 08:18:09 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2001-09-01 21:26:34 +00:00
|
|
|
#endif
|