5 #include "math_inset.h"
8 #include "mathed/support.h"
13 MathArray::MathArray()
17 MathArray::~MathArray()
23 MathArray::MathArray(MathArray const & array)
26 deep_copy(begin(), end());
30 MathArray::MathArray(MathArray const & array, int from, int to)
31 : bf_(array.begin() + from, array.begin() + to)
33 deep_copy(begin(), end());
37 void MathArray::deep_copy(iterator from, iterator to)
39 for (iterator it = from; it != to; ++it)
44 int MathArray::last() const
50 void MathArray::substitute(MathMacro const & m)
53 for (iterator it = begin(); it != end(); ++it)
54 (*it)->substitute(tmp, m);
59 MathArray & MathArray::operator=(MathArray const & array)
67 MathInset * MathArray::nextInset(int pos)
69 return (pos == size()) ? 0 : bf_[pos];
73 MathInset const * MathArray::nextInset(int pos) const
75 return (pos == size()) ? 0 : bf_[pos];
79 void MathArray::insert(int pos, MathInset * p)
81 bf_.insert(begin() + pos, p);
85 void MathArray::insert(int pos, MathArray const & array)
87 bf_.insert(begin() + pos, array.begin(), array.end());
88 deep_copy(begin() + pos, begin() + pos + array.size());
92 void MathArray::push_back(MathInset * p)
98 void MathArray::push_back(MathArray const & array)
100 insert(size(), array);
104 void MathArray::clear()
110 void MathArray::swap(MathArray & array)
117 bool MathArray::empty() const
123 int MathArray::size() const
129 void MathArray::erase()
135 void MathArray::erase(int pos)
142 void MathArray::erase(int pos1, int pos2)
144 for (iterator it = begin() + pos1; it != begin() + pos2; ++it)
146 bf_.erase(begin() + pos1, begin() + pos2);
150 MathInset * MathArray::back() const
152 return size() ? bf_.back() : 0;
156 void MathArray::dump2(ostream & os) const
158 for (const_iterator it = begin(); it != end(); ++it)
163 void MathArray::dump(ostream & os) const
165 for (const_iterator it = begin(); it != end(); ++it)
166 os << "<" << *it << ">";
170 std::ostream & operator<<(std::ostream & os, MathArray const & ar)
177 void MathArray::write(ostream & os, bool fragile) const
179 for (const_iterator it = begin(); it != end(); ++it)
180 (*it)->write(os, fragile);
184 void MathArray::writeNormal(ostream & os) const
195 void MathArray::validate(LaTeXFeatures & features) const
197 for (const_iterator it = begin(); it != end(); ++it)
198 (*it)->validate(features);
202 void MathArray::pop_back()
205 lyxerr << "pop_back from empty array!\n";
213 MathArray::const_iterator MathArray::begin() const
219 MathArray::const_iterator MathArray::end() const
225 MathArray::iterator MathArray::begin()
231 MathArray::iterator MathArray::end()