1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/*
|
|
|
|
|
* Purpose: A general purpose resizable array.
|
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
|
* Created: January 1996
|
|
|
|
|
*
|
|
|
|
|
* Dependencies: None (almost)
|
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
|
* Copyright: 1996, Alejandro Aguilar Sierra
|
1999-09-27 18:44:28 +00:00
|
|
|
|
* 1997 The LyX Team!
|
|
|
|
|
*
|
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
#ifndef MATHEDARRAY_H
|
|
|
|
|
#define MATHEDARRAY_H
|
|
|
|
|
|
2001-02-09 17:17:08 +00:00
|
|
|
|
#include <vector>
|
2001-02-28 17:21:16 +00:00
|
|
|
|
#include <iosfwd>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class MathInset;
|
2001-04-24 16:13:38 +00:00
|
|
|
|
class MathMacro;
|
2001-07-13 14:54:56 +00:00
|
|
|
|
class LaTeXFeatures;
|
2001-02-12 08:55:14 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
/** \class MathArray
|
2001-07-12 07:18:29 +00:00
|
|
|
|
\brief Low level container for math insets
|
2001-02-12 08:55:14 +00:00
|
|
|
|
|
|
|
|
|
\author Alejandro Aguilar Sierra
|
|
|
|
|
\author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
\author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
\version February 2001
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class MathArray {
|
2001-08-09 08:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
typedef std::vector<MathInset *> buffer_type;
|
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::const_iterator const_iterator;
|
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::iterator iterator;
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
public:
|
2001-02-09 17:17:08 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
MathArray();
|
2001-02-19 14:16:57 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
MathArray(MathArray const &);
|
2001-02-19 14:16:57 +00:00
|
|
|
|
///
|
2001-07-16 15:53:25 +00:00
|
|
|
|
MathArray(MathArray const &, int from, int to);
|
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
MathArray & operator=(MathArray const &);
|
2001-02-19 14:16:57 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
~MathArray();
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
int size() const;
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
bool empty() const;
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void clear();
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void swap(MathArray &);
|
2001-02-14 17:50:58 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void insert(int pos, MathInset * inset);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void insert(int pos, MathArray const &);
|
2001-02-14 17:50:58 +00:00
|
|
|
|
|
2001-02-19 14:16:57 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void erase(int pos1, int pos2);
|
|
|
|
|
///
|
|
|
|
|
void erase(int pos);
|
2001-02-20 13:16:07 +00:00
|
|
|
|
///
|
2001-07-16 15:53:25 +00:00
|
|
|
|
void erase();
|
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
|
int last() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-02-19 14:16:57 +00:00
|
|
|
|
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void push_back(MathInset * inset);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void push_back(MathArray const &);
|
2001-02-17 18:52:53 +00:00
|
|
|
|
///
|
2001-07-26 06:46:50 +00:00
|
|
|
|
void pop_back();
|
|
|
|
|
///
|
2001-08-03 17:10:22 +00:00
|
|
|
|
MathInset * back() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void dump(std::ostream &) const;
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void dump2(std::ostream &) const;
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void substitute(MathMacro const &);
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
|
MathInset * nextInset(int pos);
|
2001-02-28 17:21:16 +00:00
|
|
|
|
///
|
2001-08-06 17:20:26 +00:00
|
|
|
|
MathInset const * nextInset(int pos) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
|
void write(std::ostream &, bool) const;
|
2001-04-27 12:35:55 +00:00
|
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
|
void writeNormal(std::ostream &) const;
|
2001-07-13 14:54:56 +00:00
|
|
|
|
///
|
2001-07-26 06:56:43 +00:00
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-08-09 08:53:16 +00:00
|
|
|
|
const_iterator begin() const;
|
|
|
|
|
///
|
|
|
|
|
const_iterator end() const;
|
|
|
|
|
///
|
|
|
|
|
iterator begin();
|
|
|
|
|
///
|
|
|
|
|
iterator end();
|
|
|
|
|
private:
|
2001-08-01 09:18:21 +00:00
|
|
|
|
///
|
2001-08-09 08:53:16 +00:00
|
|
|
|
void deep_copy(iterator from, iterator to);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Buffer
|
2001-02-12 08:55:14 +00:00
|
|
|
|
buffer_type bf_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
2001-04-24 16:13:38 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & os, MathArray const & ar);
|
2001-04-24 16:13:38 +00:00
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
#endif
|