]> git.lyx.org Git - features.git/blobdiff - src/ParagraphList.h
parlist-23-a,diff
[features.git] / src / ParagraphList.h
index aaa41c28eab9144cfa80bfd09ee8f6d68b974b6f..55ee259fd84217c01ba9d01aa26af049a82edfa1 100644 (file)
@@ -3,16 +3,30 @@
 #ifndef PARAGRAPH_LIST_H
 #define PARAGRAPH_LIST_H
 
-#include <iterator>
+#define NO_STD_LIST 1
+
+#ifndef NO_STD_LIST
+
+#include "paragraph.h"
+
+#include <list>
+
+typedef std::list<Paragraph> ParagraphList;
+
+#else
 
 class Paragraph;
 
+#include <iterator>
+#include <utility>
+
 ///
 class ParagraphList {
 public:
        ///
        class iterator {
        public:
+               friend class ParagraphList;
                ///
                typedef std::bidirectional_iterator_tag iterator_category;
                ///
@@ -26,8 +40,6 @@ public:
                ///
                iterator();
                ///
-               iterator(value_type);
-               ///
                reference operator*();
                ///
                pointer operator->();
@@ -40,29 +52,75 @@ public:
                ///
                iterator operator--(int);
        private:
+               ///
+               iterator(value_type);
+               ///
+               Paragraph * ptr;
+       };
+       ///
+       class const_iterator {
+       public:
+               friend class ParagraphList;
+               ///
+               typedef std::bidirectional_iterator_tag iterator_category;
+               ///
+               typedef Paragraph * value_type;
+               ///
+               typedef ptrdiff_t difference_type;
+               ///
+               typedef Paragraph const * const_pointer;
+               ///
+               typedef Paragraph const & const_reference;
+               ///
+               const_iterator();
+               ///
+               const_reference operator*();
+               ///
+               const_pointer operator->();
+               ///
+               const_iterator & operator++();
+               ///
+               const_iterator operator++(int);
+               ///
+               const_iterator & operator--();
+               ///
+               const_iterator operator--(int);
+       private:
+               ///
+               const_iterator(value_type);
                ///
                Paragraph * ptr;
        };
        ///
        ParagraphList();
        ///
-       iterator insert(iterator it, Paragraph * par);
+       ParagraphList(ParagraphList const &);
+       ///
+       ParagraphList & operator=(ParagraphList const &);
+       ///
+       iterator insert(iterator it, Paragraph const & par);
+       ///
+       void insert(iterator pos, iterator beg, iterator end);
+       ///
+       void assign(iterator beg, iterator end);
+       ///
+       void splice(iterator pos, ParagraphList & pl);
        ///
        void clear();
        ///
-       void erase(iterator it);
+       iterator erase(iterator it);
+       ///
+       iterator erase(iterator first, iterator last);
        ///
        iterator begin();
        ///
-       iterator begin() const;
+       const_iterator begin() const;
        ///
        iterator end();
        ///
-       iterator end() const;
-       ///
-       void set(Paragraph *);
+       const_iterator end() const;
        ///
-       void push_back(Paragraph *);
+       void push_back(Paragraph const &);
        ///
        Paragraph const & front() const;
        ///
@@ -80,6 +138,12 @@ private:
        Paragraph * parlist;
 };
 
+
+
+typedef std::pair<ParagraphList::iterator, int> PitPosPair;
+
+
+
 ///
 bool operator==(ParagraphList::iterator const & i1,
                ParagraphList::iterator const & i2);
@@ -87,4 +151,13 @@ bool operator==(ParagraphList::iterator const & i1,
 bool operator!=(ParagraphList::iterator const & i1,
                ParagraphList::iterator const & i2);
 
+///
+bool operator==(ParagraphList::const_iterator const & i1,
+               ParagraphList::const_iterator const & i2);
+///
+bool operator!=(ParagraphList::const_iterator const & i1,
+               ParagraphList::const_iterator const & i2);
+
+#endif
+
 #endif