]> git.lyx.org Git - lyx.git/blob - src/mathed/math_data.h
some support for matrix operations with maple ('M-x math-extern maple evalm')
[lyx.git] / src / mathed / math_data.h
1 // -*- C++ -*-
2 /*
3  *  Purpose:     A general purpose resizable array.  
4  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
5  *  Created:     January 1996
6  *
7  *  Dependencies: None (almost)
8  *
9  *  Copyright: 1996, Alejandro Aguilar Sierra
10  *                 1997  The LyX Team!
11  *
12  *   You are free to use and modify this code under the terms of
13  *   the GNU General Public Licence version 2 or later.
14  */
15
16 #ifndef MATHEDARRAY_H
17 #define MATHEDARRAY_H
18
19 #include <vector>
20
21 #include "math_atom.h"
22 #include "LString.h"
23
24 class MathScriptInset;
25 class MathMacro;
26 class LaTeXFeatures;
27
28
29 #ifdef __GNUG__
30 #pragma interface
31 #endif
32
33
34 /** \class MathArray
35     \brief Low level container for math insets
36     
37     \author Alejandro Aguilar Sierra
38     \author André Pönitz
39     \author Lars Gullik Bjønnes
40     \version February 2001
41   */
42
43 class MathArray  {
44 public:
45         ///
46         typedef std::vector<MathAtom>        buffer_type;
47         ///
48         typedef buffer_type::const_iterator  const_iterator;
49         ///
50         typedef buffer_type::iterator        iterator;
51         ///
52         typedef buffer_type::size_type       size_type;
53
54 public:
55         ///
56         MathArray();
57         ///
58         MathArray(MathArray const &, size_type from, size_type to);
59
60         ///
61         size_type size() const;
62         ///
63         bool empty() const;
64         ///
65         void clear();
66         ///
67         void swap(MathArray &);
68         
69         ///
70         void insert(size_type pos, MathAtom const &);
71         ///
72         void insert(size_type pos, MathArray const &);
73
74         ///
75         void erase(size_type pos1, size_type pos2);
76         ///
77         void erase(size_type pos);
78         ///
79         void erase();
80
81         ///
82         void push_back(MathAtom const &);
83         ///
84         void push_back(MathArray const &);
85         ///
86         void pop_back();
87         ///
88         MathAtom & back();
89
90         ///
91         void dump() const;
92         ///
93         void dump2() const;
94         ///
95         void substitute(MathMacro const &);
96
97         ///
98         MathAtom & at(size_type pos);
99         ///
100         MathAtom const & at(size_type pos) const;
101         ///
102         void validate(LaTeXFeatures &) const;
103         ///
104         const_iterator begin() const;   
105         ///
106         const_iterator end() const;     
107         ///
108         iterator begin();
109         ///
110         iterator end();
111
112 private:
113         /// Buffer
114         buffer_type bf_;
115 };
116
117 #endif