]> git.lyx.org Git - features.git/blob - src/ParagraphList.h
parlist-23-a,diff
[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                 friend class ParagraphList;
30                 ///
31                 typedef std::bidirectional_iterator_tag iterator_category;
32                 ///
33                 typedef Paragraph * value_type;
34                 ///
35                 typedef ptrdiff_t difference_type;
36                 ///
37                 typedef Paragraph * pointer;
38                 ///
39                 typedef Paragraph & reference;
40                 ///
41                 iterator();
42                 ///
43                 reference operator*();
44                 ///
45                 pointer operator->();
46                 ///
47                 iterator & operator++();
48                 ///
49                 iterator operator++(int);
50                 ///
51                 iterator & operator--();
52                 ///
53                 iterator operator--(int);
54         private:
55                 ///
56                 iterator(value_type);
57                 ///
58                 Paragraph * ptr;
59         };
60         ///
61         class const_iterator {
62         public:
63                 friend class ParagraphList;
64                 ///
65                 typedef std::bidirectional_iterator_tag iterator_category;
66                 ///
67                 typedef Paragraph * value_type;
68                 ///
69                 typedef ptrdiff_t difference_type;
70                 ///
71                 typedef Paragraph const * const_pointer;
72                 ///
73                 typedef Paragraph const & const_reference;
74                 ///
75                 const_iterator();
76                 ///
77                 const_reference operator*();
78                 ///
79                 const_pointer operator->();
80                 ///
81                 const_iterator & operator++();
82                 ///
83                 const_iterator operator++(int);
84                 ///
85                 const_iterator & operator--();
86                 ///
87                 const_iterator operator--(int);
88         private:
89                 ///
90                 const_iterator(value_type);
91                 ///
92                 Paragraph * ptr;
93         };
94         ///
95         ParagraphList();
96         ///
97         ParagraphList(ParagraphList const &);
98         ///
99         ParagraphList & operator=(ParagraphList const &);
100         ///
101         iterator insert(iterator it, Paragraph const & par);
102         ///
103         void insert(iterator pos, iterator beg, iterator end);
104         ///
105         void assign(iterator beg, iterator end);
106         ///
107         void splice(iterator pos, ParagraphList & pl);
108         ///
109         void clear();
110         ///
111         iterator erase(iterator it);
112         ///
113         iterator erase(iterator first, iterator last);
114         ///
115         iterator begin();
116         ///
117         const_iterator begin() const;
118         ///
119         iterator end();
120         ///
121         const_iterator end() const;
122         ///
123         void push_back(Paragraph const &);
124         ///
125         Paragraph const & front() const;
126         ///
127         Paragraph & front();
128         ///
129         Paragraph const & back() const;
130         ///
131         Paragraph & back();
132         ///
133         int size() const;
134         ///
135         bool empty() const;
136 private:
137         ///
138         Paragraph * parlist;
139 };
140
141
142
143 typedef std::pair<ParagraphList::iterator, int> PitPosPair;
144
145
146
147 ///
148 bool operator==(ParagraphList::iterator const & i1,
149                 ParagraphList::iterator const & i2);
150 ///
151 bool operator!=(ParagraphList::iterator const & i1,
152                 ParagraphList::iterator const & i2);
153
154 ///
155 bool operator==(ParagraphList::const_iterator const & i1,
156                 ParagraphList::const_iterator const & i2);
157 ///
158 bool operator!=(ParagraphList::const_iterator const & i1,
159                 ParagraphList::const_iterator const & i2);
160
161 #endif
162
163 #endif