]> git.lyx.org Git - lyx.git/blob - src/mathed/array.h
some visual feedback for extra vertical space
[lyx.git] / src / mathed / array.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 #include <iosfwd>
21
22 class MathInset;
23 class MathMacro;
24 class LaTeXFeatures;
25
26 #ifdef __GNUG__
27 #pragma interface
28 #endif
29
30 /** \class MathArray
31     \brief Low level container for math insets
32     
33     \author Alejandro Aguilar Sierra
34     \author André Pönitz
35     \author Lars Gullik Bjønnes
36     \version February 2001
37   */
38 class MathArray  {
39 public:
40         ///
41         typedef std::vector<MathInset *>     buffer_type;
42         ///
43         typedef buffer_type::const_iterator  const_iterator;
44         ///
45         typedef buffer_type::iterator        iterator;
46
47 public:
48         ///
49         MathArray();
50         ///
51         MathArray(MathArray const &);
52         ///
53         MathArray(MathArray const &, int from, int to);
54         ///
55         MathArray & operator=(MathArray const &);
56         ///
57         ~MathArray();
58
59         ///
60         int size() const;
61         ///
62         bool empty() const;
63         ///
64         void clear();
65         ///
66         void swap(MathArray &);
67         
68         ///
69         void insert(int pos, MathInset * inset);
70         ///
71         void insert(int pos, MathArray const &);
72
73         ///
74         void erase(int pos1, int pos2);
75         ///
76         void erase(int pos);
77         ///
78         void erase();
79         ///
80         int last() const;
81
82
83         ///
84         void push_back(MathInset * inset);
85         ///
86         void push_back(MathArray const &);
87         ///
88         void pop_back();
89         ///
90         MathInset * back() const;
91
92         ///
93         void dump(std::ostream &) const;
94         ///
95         void dump2(std::ostream &) const;
96         ///
97         void substitute(MathMacro const &);
98         ///
99
100         ///
101         MathInset * nextInset(int pos);
102         ///
103         MathInset const * nextInset(int pos) const;
104         ///
105         void write(std::ostream &, bool) const;
106         ///
107         void writeNormal(std::ostream &) const;
108         ///
109         void validate(LaTeXFeatures &) const;
110         ///
111         const_iterator begin() const;   
112         ///
113         const_iterator end() const;     
114         ///
115         iterator begin();
116         ///
117         iterator end();
118 private:
119         ///
120         void deep_copy(iterator from, iterator to);
121         /// Buffer
122         buffer_type bf_;
123 };
124
125
126 std::ostream & operator<<(std::ostream & os, MathArray const & ar);
127
128 #endif