3 #include "ParagraphList.h"
7 ////////// The ParagraphList::iterator
9 ParagraphList::iterator::iterator()
14 ParagraphList::iterator::iterator(Paragraph * p)
19 ParagraphList::iterator::reference
20 ParagraphList::iterator::operator*()
26 ParagraphList::iterator::pointer
27 ParagraphList::iterator::operator->()
33 ParagraphList::iterator &
34 ParagraphList::iterator::operator++()
41 ParagraphList::iterator
42 ParagraphList::iterator::operator++(int)
50 ParagraphList::iterator &
51 ParagraphList::iterator::operator--()
53 ptr = ptr->previous();
58 ParagraphList::iterator
59 ParagraphList::iterator::operator--(int)
67 bool operator==(ParagraphList::iterator const & i1,
68 ParagraphList::iterator const & i2)
70 return &(*const_cast<ParagraphList::iterator&>(i1))
71 == &(*const_cast<ParagraphList::iterator&>(i2));
75 bool operator!=(ParagraphList::iterator const & i1,
76 ParagraphList::iterator const & i2)
82 ////////// The ParagraphList proper
83 ParagraphList::ParagraphList()
88 ParagraphList::iterator
89 ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
92 Paragraph * prev = it->previous();
97 } else if (parlist == 0) {
101 Paragraph * last = parlist;
107 return iterator(par);
111 void ParagraphList::clear()
114 Paragraph * tmp = parlist->next();
121 void ParagraphList::erase(ParagraphList::iterator it)
123 Paragraph * prev = it->previous();
124 Paragraph * next = it->next();
132 next->previous(prev);
138 ParagraphList::iterator ParagraphList::begin()
140 return iterator(parlist);
144 ParagraphList::iterator ParagraphList::begin() const
146 return iterator(parlist);
150 ParagraphList::iterator ParagraphList::end()
156 ParagraphList::iterator ParagraphList::end() const
162 Paragraph const & ParagraphList::front() const
168 Paragraph & ParagraphList::front()
174 Paragraph const & ParagraphList::back() const
176 Paragraph * tmp = parlist;
183 Paragraph & ParagraphList::back()
185 Paragraph * tmp = parlist;
192 void ParagraphList::set(Paragraph * p)
198 void ParagraphList::push_back(Paragraph * p)
205 Paragraph * pos = parlist;
213 int ParagraphList::size() const
215 // When we switch to a std::container this will be O(1)
216 // instead of O(n). (Lgb)
217 Paragraph * tmp = parlist;
227 bool ParagraphList::empty() const