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.
22 #include "mathed/support.h"
30 /** \class MathedArray
31 \brief A resizable array.
33 A general purpose resizable array.
35 \author Alejandro Aguilar Sierra
37 \author Lars Gullik Bjønnes
38 \version February 2001
43 typedef std::vector<byte> buffer_type;
44 typedef byte value_type;
45 typedef buffer_type::size_type size_type;
46 typedef buffer_type::iterator iterator;
47 typedef buffer_type::const_iterator const_iterator;
52 MathedArray(MathedArray const &);
54 MathedArray & operator=(MathedArray const &);
63 const_iterator begin() const;
65 const_iterator end() const;
78 void swap(MathedArray &);
80 void shrink(int pos1, int pos2);
84 void insert(iterator pos, const_iterator beg, const_iterator end);
86 /// Merge \a dx elements from array \a a at \apos.
87 /// This doesn't changes the size (dangerous)
88 void merge(MathedArray const & a, int pos);
91 void raw_pointer_copy(MathedInset ** p, int pos) const;
94 void insertInset(int pos, MathedInset * p, int type);
96 MathedInset * getInset(int pos);
99 void raw_pointer_insert(void * p, int pos, int len);
102 void strange_copy(MathedArray * dest, int dpos, int spos, int len);
104 byte operator[](int) const;
106 byte & operator[](int i);
109 void move(int p, int shift);
111 void resize(int newsize);
112 /// Make sure we can access at least \a needed elements
113 void need_size(int needed);
115 void dump(std::ostream &) const;
127 InsetTable(int p, MathedInset * i)
128 : pos(p), inset(i) {}
132 typedef std::vector<InsetTable> InsetList;
133 /// The list of insets in this array.
134 InsetList insetList_;
136 /// Last position inserted.