]> git.lyx.org Git - features.git/blob - src/ParagraphList.h
make ParagraphList::push_back take a reference instead of a pointer.
[features.git] / src / ParagraphList.h
1 // -*- C++ -*-
2
3 #ifndef PARAGRAPH_LIST_H
4 #define PARAGRAPH_LIST_H
5
6 #define NO_STD_LIST 1
7
8 #ifndef NO_STD_LIST
9
10 #include "paragraph.h"
11
12 #include <list>
13
14 typedef std::list<Paragraph> ParagraphList;
15
16 #else
17
18 class Paragraph;
19
20 #include <iterator>
21 #include <utility>
22
23 ///
24 class ParagraphList {
25 public:
26         ///
27         class iterator {
28         public:
29                 ///
30                 typedef std::bidirectional_iterator_tag iterator_category;
31                 ///
32                 typedef Paragraph * value_type;
33                 ///
34                 typedef ptrdiff_t difference_type;
35                 ///
36                 typedef Paragraph * pointer;
37                 ///
38                 typedef Paragraph & reference;
39                 ///
40                 iterator();
41                 ///
42                 iterator(value_type);
43                 ///
44                 reference operator*();
45                 ///
46                 pointer operator->();
47                 ///
48                 iterator & operator++();
49                 ///
50                 iterator operator++(int);
51                 ///
52                 iterator & operator--();
53                 ///
54                 iterator operator--(int);
55         private:
56                 ///
57                 Paragraph * ptr;
58         };
59         ///
60         ParagraphList();
61         ///
62         ParagraphList(ParagraphList const &);
63         ///
64         ParagraphList & operator=(ParagraphList const &);
65         ///
66         iterator insert(iterator it, Paragraph * par);
67         ///
68         void insert(iterator pos, iterator beg, iterator end);
69         ///
70         void assign(iterator beg, iterator end);
71         ///
72         void splice(iterator pos, ParagraphList & pl);
73         ///
74         void clear();
75         ///
76         iterator erase(iterator it);
77         ///
78         iterator erase(iterator first, iterator last);
79         ///
80         iterator begin();
81         ///
82         iterator begin() const;
83         ///
84         iterator end();
85         ///
86         iterator end() const;
87         ///
88         void push_back(Paragraph const &);
89         ///
90         Paragraph const & front() const;
91         ///
92         Paragraph & front();
93         ///
94         Paragraph const & back() const;
95         ///
96         Paragraph & back();
97         ///
98         int size() const;
99         ///
100         bool empty() const;
101 private:
102         ///
103         Paragraph * parlist;
104 };
105
106
107
108 typedef std::pair<ParagraphList::iterator, int> PitPosPair;
109
110
111
112 ///
113 bool operator==(ParagraphList::iterator const & i1,
114                 ParagraphList::iterator const & i2);
115 ///
116 bool operator!=(ParagraphList::iterator const & i1,
117                 ParagraphList::iterator const & i2);
118
119 #endif
120
121 #endif