]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/array.h
add std support
[lyx.git] / src / mathed / array.h
index c9d042587a016635fc67f666725629f627bccdef..158affcdbfb3d6350021e58da569b5394702f70e 100644 (file)
@@ -17,6 +17,7 @@
 #define MATHEDARRAY_H
 
 #include <vector>
+#include <iosfwd>
 
 #include "mathed/support.h"
 
@@ -39,23 +40,20 @@ class MathedInset;
 class MathedArray  {
 public:
        ///
-       typedef std::vector<byte>         buffer_type;
-       typedef byte                      value_type;
-       typedef buffer_type::size_type    size_type;
-       typedef buffer_type::iterator iterator;
+       typedef std::vector<byte>           buffer_type;
+       typedef byte                        value_type;
+       typedef buffer_type::size_type      size_type;
+       typedef buffer_type::iterator       iterator;
        typedef buffer_type::const_iterator const_iterator;
        
        ///
-       enum {
-               ///
-               ARRAY_STEP = 16,
-               ///
-               ARRAY_MIN_SIZE = 4
-       };
-
+       MathedArray();
+       ///
+       MathedArray(MathedArray const &);
+       ///
+       MathedArray & operator=(MathedArray const &);
        ///
-       explicit
-       MathedArray(int size = ARRAY_STEP);
+       ~MathedArray();
 
        ///
        iterator begin();
@@ -68,24 +66,38 @@ public:
        
        ///
        int empty() const;
+       ///
+       void clear();
    
        ///
        int last() const;
        ///
        void last(int l);
 
+       ///
+       void swap(MathedArray &);
+       ///
+       void shrink(int pos1, int pos2);
+
 #if 0
        ///
        void insert(iterator pos, const_iterator beg, const_iterator end);
 #else
        /// Merge \a dx elements from array \a a at \apos.
        /// This doesn't changes the size (dangerous)
-       void mergeF(MathedArray * a, int pos, int dx); 
+       void merge(MathedArray const & a, int pos); 
 #endif
        ///
        void raw_pointer_copy(MathedInset ** p, int pos) const;
+#if 0
+       ///
+       void insertInset(int pos, MathedInset * p, int type);
+       ///
+       MathedInset * getInset(int pos);
+#else
        ///
        void raw_pointer_insert(void * p, int pos, int len);
+#endif
        ///
        void strange_copy(MathedArray * dest, int dpos, int spos, int len);
        ///
@@ -99,9 +111,28 @@ public:
        void resize(int newsize);
        /// Make sure we can access at least \a needed elements
        void need_size(int needed);
+       ///
+       void dump(std::ostream &) const;
 private:
        /// Buffer
        buffer_type bf_;
+#if 0
+       ///
+       struct InsetTable {
+               ///
+               int pos;
+               ///
+               MathedInset * inset;
+               ///
+               InsetTable(int p, MathedInset * i)
+                       : pos(p), inset(i) {}
+               
+       };
+       /// 
+       typedef std::vector<InsetTable> InsetList;
+       /// The list of insets in this array.
+       InsetList insetList_;
+#endif
        /// Last position inserted.
        int last_;
 };