]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/array.h
small cleanup, doxygen, formatting changes
[lyx.git] / src / mathed / array.h
index def0ffd18586626f6eadc71505ee317e30c51a5c..c9d042587a016635fc67f666725629f627bccdef 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <vector>
 
+#include "mathed/support.h"
 
 class MathedInset;
 
@@ -25,10 +26,6 @@ class MathedInset;
 #pragma interface
 #endif
 
-#ifndef byte
-#define byte unsigned char
-#endif
-
 /** \class MathedArray
     \brief A resizable array.
     
@@ -45,10 +42,11 @@ public:
        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_SIZE = 256,
                ///
                ARRAY_STEP = 16,
                ///
@@ -59,6 +57,15 @@ public:
        explicit
        MathedArray(int size = ARRAY_STEP);
 
+       ///
+       iterator begin();
+       ///
+       iterator end();
+       ///
+       const_iterator begin() const;
+       ///
+       const_iterator end() const;
+       
        ///
        int empty() const;
    
@@ -66,14 +73,15 @@ public:
        int last() const;
        ///
        void last(int l);
-   
+
+#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); 
-
-       /// Insert a character at position \a pos
-       void insert(int pos, byte);
-
+#endif
        ///
        void raw_pointer_copy(MathedInset ** p, int pos) const;
        ///
@@ -89,15 +97,12 @@ public:
        void move(int p, int shift);
        ///
        void resize(int newsize);
-       ///
-       int maxsize() const;
+       /// Make sure we can access at least \a needed elements
+       void need_size(int needed);
 private:
-
        /// Buffer
        buffer_type bf_;
        /// Last position inserted.
        int last_;
-       /// Max size of the array.
-       int maxsize_;
 };
 #endif