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