]> git.lyx.org Git - lyx.git/blobdiff - src/ParagraphList.h
"Inter-word Space"
[lyx.git] / src / ParagraphList.h
index 08f60640a532ae2a1f1cb9e1c6fe21b53f6abdb5..95cacfb2c92be5cf44ac846de843cb5464e33f5e 100644 (file)
@@ -3,17 +3,34 @@
 #ifndef PARAGRAPH_LIST_H
 #define PARAGRAPH_LIST_H
 
-#include <iterator>
-#include <utility>
+//#define NO_STD_LIST 1
+
+#ifndef NO_STD_LIST
+
+#include "paragraph.h"
+
+#include <list>
+
+struct ParagraphList : public std::list<Paragraph>
+{
+};
+
+typedef std::pair<ParagraphList::iterator, int> PitPosPair;
+
+#else
 
 class Paragraph;
 
+#include <iterator>
+#include <utility>
+
 ///
 class ParagraphList {
 public:
        ///
        class iterator {
        public:
+               friend class ParagraphList;
                ///
                typedef std::bidirectional_iterator_tag iterator_category;
                ///
@@ -27,8 +44,6 @@ public:
                ///
                iterator();
                ///
-               iterator(value_type);
-               ///
                reference operator*();
                ///
                pointer operator->();
@@ -41,6 +56,42 @@ 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;
        };
@@ -51,7 +102,7 @@ public:
        ///
        ParagraphList & operator=(ParagraphList const &);
        ///
-       iterator insert(iterator it, Paragraph * par);
+       iterator insert(iterator it, Paragraph const & par);
        ///
        void insert(iterator pos, iterator beg, iterator end);
        ///
@@ -67,13 +118,13 @@ public:
        ///
        iterator begin();
        ///
-       iterator begin() const;
+       const_iterator begin() const;
        ///
        iterator end();
        ///
-       iterator end() const;
+       const_iterator end() const;
        ///
-       void push_back(Paragraph *);
+       void push_back(Paragraph const &);
        ///
        Paragraph const & front() const;
        ///
@@ -104,5 +155,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