]> git.lyx.org Git - features.git/blob - src/ParagraphList.h
parlist-22-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         ParagraphList();
62         ///
63         ParagraphList(ParagraphList const &);
64         ///
65         ParagraphList & operator=(ParagraphList const &);
66         ///
67         iterator insert(iterator it, Paragraph const & par);
68         ///
69         void insert(iterator pos, iterator beg, iterator end);
70         ///
71         void assign(iterator beg, iterator end);
72         ///
73         void splice(iterator pos, ParagraphList & pl);
74         ///
75         void clear();
76         ///
77         iterator erase(iterator it);
78         ///
79         iterator erase(iterator first, iterator last);
80         ///
81         iterator begin();
82         ///
83         iterator begin() const;
84         ///
85         iterator end();
86         ///
87         iterator end() const;
88         ///
89         void push_back(Paragraph const &);
90         ///
91         Paragraph const & front() const;
92         ///
93         Paragraph & front();
94         ///
95         Paragraph const & back() const;
96         ///
97         Paragraph & back();
98         ///
99         int size() const;
100         ///
101         bool empty() const;
102 private:
103         ///
104         Paragraph * parlist;
105 };
106
107
108
109 typedef std::pair<ParagraphList::iterator, int> PitPosPair;
110
111
112
113 ///
114 bool operator==(ParagraphList::iterator const & i1,
115                 ParagraphList::iterator const & i2);
116 ///
117 bool operator!=(ParagraphList::iterator const & i1,
118                 ParagraphList::iterator const & i2);
119
120 #endif
121
122 #endif