]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/array.h
use stream-like syntax for LaTeX output
[lyx.git] / src / mathed / array.h
index 16da85b7d33668d88eddf430c442d995bd9387db..db0f1d4ea5840f37ad044815c19a5c024c81958b 100644 (file)
 
 #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__
@@ -40,21 +38,26 @@ class LaTeXFeatures;
     \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(MathArray const &, int from, int to);
+       typedef buffer_type::iterator        iterator;
+       ///
+       typedef buffer_type::size_type       size_type;
+
+public:
        ///
-       MathArray & operator=(MathArray const &);
+       MathArray();
        ///
-       ~MathArray();
+       MathArray(MathArray const &, size_type from, size_type to);
 
        ///
-       int size() const;
+       size_type size() const;
        ///
        bool empty() const;
        ///
@@ -63,38 +66,25 @@ public:
        void swap(MathArray &);
        
        ///
-       void insert(int pos, MathInset * inset);
-       ///
-       void insert(int pos, unsigned char, MathTextCodes);
+       void insert(size_type pos, MathAtom const &);
        ///
-       void insert(int pos, MathArray const &);
+       void insert(size_type pos, MathArray const &);
 
        ///
-       void erase(int pos1, int pos2);
+       void erase(size_type pos1, size_type pos2);
        ///
-       void erase(int pos);
+       void erase(size_type pos);
        ///
        void erase();
-       ///
-       void replace(int pos, MathInset * inset);
-       ///
-       bool prev(int & pos) const;
-       ///
-       bool next(int & pos) const;
-       ///
-       bool last(int & pos) const;
-
 
        ///
-       void push_back(MathInset * inset);
-       ///
-       void push_back(unsigned char, MathTextCodes);
+       void push_back(MathAtom const &);
        ///
        void push_back(MathArray const &);
        ///
        void pop_back();
        ///
-       MathInset * back_inset() const;
+       MathAtom & back();
 
        ///
        void dump(std::ostream &) const;
@@ -102,37 +92,28 @@ public:
        void dump2(std::ostream &) const;
        ///
        void substitute(MathMacro const &);
-       ///
 
        ///
-       MathInset * nextInset(int pos) const;
+       MathAtom & at(size_type pos);
        ///
-       MathInset * prevInset(int pos) const;
+       MathAtom const & at(size_type pos) const;
        ///
-       unsigned char 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 write(MathWriteInfo & os) const;
        ///
-       MathTextCodes GetCode(int pos) const;
+       void writeNormal(std::ostream &) const;
        ///
-       void setCode(int pos, MathTextCodes t);
+       void validate(LaTeXFeatures &) const;
        ///
-       bool isInset(int pos) const;
+       const_iterator begin() const;   
        ///
-       void Write(std::ostream &, bool) const;
+       const_iterator end() const;     
        ///
-       void WriteNormal(std::ostream &) const;
+       iterator begin();
        ///
-       void Validate(LaTeXFeatures &) const;
-private:
-       ///
-       typedef std::vector<unsigned char>           buffer_type;
+       iterator end();
        ///
-       typedef unsigned char                        value_type;
-
-       ///
-       int item_size(int pos) const;
+       MathScriptInset const * asScript(const_iterator it) const;
+private:
        /// Buffer
        buffer_type bf_;
 };