]> git.lyx.org Git - lyx.git/blobdiff - src/lyxparagraph.h
prepare for 1.1.6pre2
[lyx.git] / src / lyxparagraph.h
index 48476bd5aeddadcc122361df7c0702c1dd89c343..6d8d6129109aa9241555ef4440b7b4c563d3ef41 100644 (file)
 #pragma interface
 #endif
 
+//#define HAVE_ROPE 1
+
+#ifdef HAVE_ROPE
+#include <rope>
+#endif
+
 #include <vector>
 #include <list>
 
 #include "insets/lyxinset.h"
 #include "vspace.h"
 #include "layout.h"
-#include "support/block.h"
+#include <boost/array.hpp>
 #include "language.h"
 
 class BufferParams;
@@ -122,16 +128,23 @@ public:
        ///
        typedef char value_type;
        ///
+#ifndef HAVE_ROPE
        typedef std::vector<value_type> TextContainer;
+#else
+       typedef std::rope<value_type> TextContainer;
+#endif
        ///
-       typedef int size_type;
+       /* This should be TextContainer::size_type, but we need
+          signed values for now.
+       */
+       typedef TextContainer::difference_type size_type;
 
        ///
        LyXParagraph();
-       /// this konstruktor inserts the new paragraph in a list
+       /// this constructor inserts the new paragraph in a list
        explicit
        LyXParagraph(LyXParagraph * par);
-       /// the destruktors removes the new paragraph from the list
+       /// the destructor removes the new paragraph from the list
        ~LyXParagraph();
 
        ///
@@ -228,7 +241,9 @@ public:
        size_type size() const { return text.size(); }
        ///
        void fitToSize() {
+#ifndef HAVE_ROPE
                text.resize(text.size());
+#endif
        }
        ///
        void setContentsFromPar(LyXParagraph * par) {
@@ -236,7 +251,11 @@ public:
        }
        ///
        void clearContents() {
+#ifndef HAVE_ROPE
                text.clear();
+#else
+               text.erase(text.mutable_begin(), text.mutable_end());
+#endif
        }
        
        /// 
@@ -286,7 +305,7 @@ public:
        
 private:
        ///
-       block<int, 10> counter_;
+       array<int, 10> counter_;
 public:
        ///
        void setCounter(int i, int v) { counter_[i] = v; }
@@ -424,7 +443,11 @@ public:
        value_type GetChar(size_type pos) const;
        /// The position must already exist.
        void SetChar(size_type pos, value_type c) {
+#ifndef HAVE_ROPE
                text[pos] = c;
+#else
+               text.replace(pos, c);
+#endif
        }
        
        ///
@@ -647,7 +670,7 @@ public:
                ///
                Inset * operator*() { return (*it).inset; }
                ///
-               size_type getPos() {return (*it).pos; }
+               size_type getPos() const {return (*it).pos; }
                ///
                bool operator==(inset_iterator const & iter) const {
                        return it == iter.it;