2002-08-12 00:15:19 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
|
|
|
|
#ifndef PARAGRAPH_LIST_H
|
|
|
|
#define PARAGRAPH_LIST_H
|
|
|
|
|
2003-05-23 22:42:14 +00:00
|
|
|
#define NO_STD_LIST 1
|
|
|
|
|
|
|
|
#ifndef NO_STD_LIST
|
|
|
|
|
|
|
|
#include "paragraph.h"
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
typedef std::list<Paragraph> ParagraphList;
|
|
|
|
|
|
|
|
#else
|
2002-08-12 00:15:19 +00:00
|
|
|
|
|
|
|
class Paragraph;
|
|
|
|
|
2003-05-23 22:42:14 +00:00
|
|
|
#include <iterator>
|
|
|
|
#include <utility>
|
|
|
|
|
2002-08-12 00:15:19 +00:00
|
|
|
///
|
|
|
|
class ParagraphList {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
class iterator {
|
|
|
|
public:
|
2003-05-27 17:29:03 +00:00
|
|
|
friend class ParagraphList;
|
2002-08-12 00:15:19 +00:00
|
|
|
///
|
|
|
|
typedef std::bidirectional_iterator_tag iterator_category;
|
|
|
|
///
|
|
|
|
typedef Paragraph * value_type;
|
|
|
|
///
|
|
|
|
typedef ptrdiff_t difference_type;
|
|
|
|
///
|
|
|
|
typedef Paragraph * pointer;
|
|
|
|
///
|
|
|
|
typedef Paragraph & reference;
|
|
|
|
///
|
|
|
|
iterator();
|
|
|
|
///
|
|
|
|
reference operator*();
|
|
|
|
///
|
|
|
|
pointer operator->();
|
|
|
|
///
|
|
|
|
iterator & operator++();
|
|
|
|
///
|
|
|
|
iterator operator++(int);
|
|
|
|
///
|
|
|
|
iterator & operator--();
|
|
|
|
///
|
|
|
|
iterator operator--(int);
|
|
|
|
private:
|
2003-05-27 17:29:03 +00:00
|
|
|
///
|
|
|
|
iterator(value_type);
|
2002-08-12 00:15:19 +00:00
|
|
|
///
|
|
|
|
Paragraph * ptr;
|
|
|
|
};
|
|
|
|
///
|
2003-05-27 22:41:04 +00:00
|
|
|
class const_iterator {
|
|
|
|
public:
|
|
|
|
friend class ParagraphList;
|
|
|
|
///
|
|
|
|
typedef std::bidirectional_iterator_tag iterator_category;
|
|
|
|
///
|
|
|
|
typedef Paragraph * value_type;
|
|
|
|
///
|
|
|
|
typedef ptrdiff_t difference_type;
|
|
|
|
///
|
|
|
|
typedef Paragraph const * const_pointer;
|
|
|
|
///
|
|
|
|
typedef Paragraph const & const_reference;
|
|
|
|
///
|
|
|
|
const_iterator();
|
|
|
|
///
|
|
|
|
const_reference operator*();
|
|
|
|
///
|
|
|
|
const_pointer operator->();
|
|
|
|
///
|
|
|
|
const_iterator & operator++();
|
|
|
|
///
|
|
|
|
const_iterator operator++(int);
|
|
|
|
///
|
|
|
|
const_iterator & operator--();
|
|
|
|
///
|
|
|
|
const_iterator operator--(int);
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
const_iterator(value_type);
|
|
|
|
///
|
|
|
|
Paragraph * ptr;
|
|
|
|
};
|
|
|
|
///
|
2002-08-12 00:15:19 +00:00
|
|
|
ParagraphList();
|
|
|
|
///
|
2003-05-01 12:31:35 +00:00
|
|
|
ParagraphList(ParagraphList const &);
|
|
|
|
///
|
|
|
|
ParagraphList & operator=(ParagraphList const &);
|
|
|
|
///
|
2003-05-24 12:13:30 +00:00
|
|
|
iterator insert(iterator it, Paragraph const & par);
|
2003-03-04 21:40:36 +00:00
|
|
|
///
|
2003-05-01 14:45:04 +00:00
|
|
|
void insert(iterator pos, iterator beg, iterator end);
|
|
|
|
///
|
2003-05-01 12:31:35 +00:00
|
|
|
void assign(iterator beg, iterator end);
|
|
|
|
///
|
2003-05-01 22:37:02 +00:00
|
|
|
void splice(iterator pos, ParagraphList & pl);
|
|
|
|
///
|
2002-08-12 00:15:19 +00:00
|
|
|
void clear();
|
|
|
|
///
|
2003-05-22 17:26:50 +00:00
|
|
|
iterator erase(iterator it);
|
|
|
|
///
|
|
|
|
iterator erase(iterator first, iterator last);
|
2003-03-04 20:45:02 +00:00
|
|
|
///
|
2002-08-12 00:15:19 +00:00
|
|
|
iterator begin();
|
|
|
|
///
|
2003-05-27 22:41:04 +00:00
|
|
|
const_iterator begin() const;
|
2002-08-12 00:15:19 +00:00
|
|
|
///
|
|
|
|
iterator end();
|
|
|
|
///
|
2003-05-27 22:41:04 +00:00
|
|
|
const_iterator end() const;
|
2002-08-12 00:15:19 +00:00
|
|
|
///
|
2003-05-24 11:54:10 +00:00
|
|
|
void push_back(Paragraph const &);
|
2002-08-13 17:43:40 +00:00
|
|
|
///
|
2003-03-06 21:01:04 +00:00
|
|
|
Paragraph const & front() const;
|
2002-08-20 15:26:52 +00:00
|
|
|
///
|
2003-03-06 21:01:04 +00:00
|
|
|
Paragraph & front();
|
|
|
|
///
|
|
|
|
Paragraph const & back() const;
|
|
|
|
///
|
|
|
|
Paragraph & back();
|
2002-08-20 15:26:52 +00:00
|
|
|
///
|
2002-08-12 00:15:19 +00:00
|
|
|
int size() const;
|
|
|
|
///
|
|
|
|
bool empty() const;
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
Paragraph * parlist;
|
|
|
|
};
|
|
|
|
|
2003-04-30 10:32:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef std::pair<ParagraphList::iterator, int> PitPosPair;
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-08-12 00:15:19 +00:00
|
|
|
///
|
|
|
|
bool operator==(ParagraphList::iterator const & i1,
|
|
|
|
ParagraphList::iterator const & i2);
|
|
|
|
///
|
|
|
|
bool operator!=(ParagraphList::iterator const & i1,
|
|
|
|
ParagraphList::iterator const & i2);
|
|
|
|
|
2003-05-27 22:41:04 +00:00
|
|
|
///
|
|
|
|
bool operator==(ParagraphList::const_iterator const & i1,
|
|
|
|
ParagraphList::const_iterator const & i2);
|
|
|
|
///
|
|
|
|
bool operator!=(ParagraphList::const_iterator const & i1,
|
|
|
|
ParagraphList::const_iterator const & i2);
|
|
|
|
|
2003-05-23 22:42:14 +00:00
|
|
|
#endif
|
2003-04-30 10:32:01 +00:00
|
|
|
|
2002-08-12 00:15:19 +00:00
|
|
|
#endif
|