3 * Purpose: A general purpose resizable array.
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
7 * Dependencies: None (almost)
9 * Copyright: 1996, Alejandro Aguilar Sierra
12 * You are free to use and modify this code under the terms of
13 * the GNU General Public Licence version 2 or later.
21 #include "mathed/support.h"
29 /** \class MathedArray
30 \brief A resizable array.
32 A general purpose resizable array.
34 \author Alejandro Aguilar Sierra
36 \author Lars Gullik Bjønnes
37 \version February 2001
42 typedef std::vector<byte> buffer_type;
43 typedef byte value_type;
44 typedef buffer_type::size_type size_type;
45 typedef buffer_type::iterator iterator;
46 typedef buffer_type::const_iterator const_iterator;
56 const_iterator begin() const;
58 const_iterator end() const;
70 void insert(iterator pos, const_iterator beg, const_iterator end);
72 /// Merge \a dx elements from array \a a at \apos.
73 /// This doesn't changes the size (dangerous)
74 void mergeF(MathedArray * a, int pos, int dx);
77 void raw_pointer_copy(MathedInset ** p, int pos) const;
80 void insertInset(int pos, MathedInset * p, int type);
82 MathedInset * getInset(int pos);
85 void raw_pointer_insert(void * p, int pos, int len);
88 void strange_copy(MathedArray * dest, int dpos, int spos, int len);
90 byte operator[](int) const;
92 byte & operator[](int i);
95 void move(int p, int shift);
97 void resize(int newsize);
98 /// Make sure we can access at least \a needed elements
99 void need_size(int needed);
111 InsetTable(int p, MathedInset * i)
112 : pos(p), inset(i) {}
116 typedef std::vector<InsetTable> InsetList;
117 /// The list of insets in this array.
118 InsetList insetList_;
120 /// Last position inserted.