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"
23 #include "math_defs.h"
27 class MathScriptInset;
36 \brief A resizable array.
38 A general purpose resizable array.
40 \author Alejandro Aguilar Sierra
42 \author Lars Gullik Bjønnes
43 \version February 2001
50 MathArray(MathArray const &);
52 MathArray & operator=(MathArray const &);
63 void swap(MathArray &);
66 void insert(int pos, MathInset * inset);
68 void insert(int pos, byte, MathTextCodes);
70 void insert(int pos, MathArray const &);
73 void erase(int pos1, int pos2);
77 void replace(int pos, MathInset * inset);
79 bool prev(int & pos) const;
81 bool next(int & pos) const;
83 bool last(int & pos) const;
87 void push_back(MathInset * inset);
89 void push_back(byte, MathTextCodes);
91 void push_back(MathArray const &);
93 MathInset * back_inset() const;
96 void dump(std::ostream &) const;
98 void dump2(std::ostream &) const;
100 void substitute(MathMacro const &);
104 MathInset * GetInset(int pos) const;
106 MathScriptInset * prevScriptInset(int pos) const;
108 MathScriptInset * nextScriptInset(int pos) const;
110 byte GetChar(int pos) const;
111 /// read subsequent chars of the same kind.
112 // pos is afterwards one behind the last char belonging to the string
113 string GetString(int & pos) const;
115 MathTextCodes GetCode(int pos) const;
117 void setCode(int pos, MathTextCodes t);
119 bool isInset(int pos) const;
121 void Write(std::ostream &, bool) const;
123 void WriteNormal(std::ostream &) const;
126 typedef std::vector<byte> buffer_type;
128 typedef byte value_type;
131 int item_size(int pos) const;
137 std::ostream & operator<<(std::ostream & os, MathArray const & ar);