#include <vector>
#include <iosfwd>
+#include "math_atom.h"
-#include "mathed/support.h"
-#include "math_defs.h"
-#include "LString.h"
-
-class MathInset;
class MathScriptInset;
class MathMacro;
-class Painter;
+class MathWriteInfo;
+class MathMetricsInfo;
+class LaTeXFeatures;
#ifdef __GNUG__
#pragma interface
#endif
/** \class MathArray
- \brief A resizable array.
-
- A general purpose resizable array.
+ \brief Low level container for math insets
\author Alejandro Aguilar Sierra
\author André Pönitz
\author Lars Gullik Bjønnes
\version February 2001
*/
+
class MathArray {
public:
///
- MathArray();
+ typedef std::vector<MathAtom> buffer_type;
///
- MathArray(MathArray const &);
+ typedef buffer_type::const_iterator const_iterator;
///
- MathArray & operator=(MathArray const &);
+ typedef buffer_type::iterator iterator;
///
- ~MathArray();
+ typedef buffer_type::size_type size_type;
+public:
///
- int size() const;
+ MathArray();
+ ///
+ MathArray(MathArray const &, size_type from, size_type to);
+
+ ///
+ size_type size() const;
///
bool empty() const;
///
void swap(MathArray &);
///
- void insert(int pos, MathInset * inset);
+ void insert(size_type pos, MathAtom const &);
///
- void insert(int pos, byte, MathTextCodes);
- ///
- void insert(int pos, MathArray const &);
+ void insert(size_type pos, MathArray const &);
///
- void erase(int pos1, int pos2);
- ///
- void erase(int pos);
+ void erase(size_type pos1, size_type pos2);
///
- void replace(int pos, MathInset * inset);
+ void erase(size_type pos);
///
- bool prev(int & pos) const;
- ///
- bool next(int & pos) const;
- ///
- bool last(int & pos) const;
-
+ void erase();
///
- void push_back(MathInset * inset);
- ///
- void push_back(byte, MathTextCodes);
+ void push_back(MathAtom const &);
///
void push_back(MathArray const &);
///
- MathInset * back_inset() const;
+ void pop_back();
+ ///
+ MathAtom & back();
///
void dump(std::ostream &) const;
void dump2(std::ostream &) const;
///
void substitute(MathMacro const &);
- ///
///
- MathInset * GetInset(int pos) const;
+ MathAtom & at(size_type pos);
///
- MathScriptInset * prevScriptInset(int pos) const;
+ MathAtom const & at(size_type pos) const;
///
- MathScriptInset * nextScriptInset(int pos) const;
+ void write(MathWriteInfo & os) const;
///
- byte GetChar(int pos) const;
- /// read subsequent chars of the same kind.
- // pos is afterwards one behind the last char belonging to the string
- string GetString(int & pos) const;
+ void writeNormal(std::ostream &) const;
///
- MathTextCodes GetCode(int pos) const;
+ void validate(LaTeXFeatures &) const;
///
- void setCode(int pos, MathTextCodes t);
+ const_iterator begin() const;
///
- bool isInset(int pos) const;
+ const_iterator end() const;
///
- void Write(std::ostream &, bool) const;
+ iterator begin();
///
- void WriteNormal(std::ostream &) const;
-private:
- ///
- typedef std::vector<byte> buffer_type;
+ iterator end();
///
- typedef byte value_type;
-
- ///
- int item_size(int pos) const;
+ MathScriptInset const * asScript(const_iterator it) const;
+private:
/// Buffer
buffer_type bf_;
};