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