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-12-10 10:09:00 +00:00
|
|
|
|
#ifndef MATH_DATA_H
|
|
|
|
|
#define MATH_DATA_H
|
2001-02-12 08:55:14 +00:00
|
|
|
|
|
2001-12-11 10:14:51 +00:00
|
|
|
|
#include <iosfwd>
|
2001-02-09 17:17:08 +00:00
|
|
|
|
#include <vector>
|
2001-11-07 08:51:35 +00:00
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
#include "math_atom.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-04-24 16:13:38 +00:00
|
|
|
|
class MathMacro;
|
2001-11-08 12:06:56 +00:00
|
|
|
|
class LaTeXFeatures;
|
2001-11-16 09:55:37 +00:00
|
|
|
|
class ReplaceData;
|
2001-11-08 12:06:56 +00:00
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-11-07 08:51:35 +00:00
|
|
|
|
|
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-09-11 10:58:17 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class MathArray {
|
2001-08-09 08:53:16 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
2001-09-11 10:58:17 +00:00
|
|
|
|
typedef std::vector<MathAtom> buffer_type;
|
2001-08-09 08:53:16 +00:00
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::const_iterator const_iterator;
|
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::iterator iterator;
|
2001-09-14 14:05:57 +00:00
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::size_type size_type;
|
2001-12-10 10:09:00 +00:00
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::size_type idx_type;
|
|
|
|
|
///
|
|
|
|
|
typedef buffer_type::size_type pos_type;
|
2001-08-09 08:53:16 +00:00
|
|
|
|
|
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-09-14 14:05:57 +00:00
|
|
|
|
MathArray(MathArray const &, size_type from, size_type to);
|
2001-11-09 10:44:24 +00:00
|
|
|
|
///
|
|
|
|
|
MathArray(iterator from, iterator to);
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-09-14 14:05:57 +00:00
|
|
|
|
size_type 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-10-12 12:02:49 +00:00
|
|
|
|
void insert(size_type pos, MathAtom const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-09-14 14:05:57 +00:00
|
|
|
|
void insert(size_type pos, MathArray const &);
|
2001-02-14 17:50:58 +00:00
|
|
|
|
|
2001-11-09 10:44:24 +00:00
|
|
|
|
///
|
|
|
|
|
void erase(iterator pos1, iterator pos2);
|
|
|
|
|
///
|
|
|
|
|
void erase(iterator pos);
|
2001-02-19 14:16:57 +00:00
|
|
|
|
///
|
2001-09-14 14:05:57 +00:00
|
|
|
|
void erase(size_type pos1, size_type pos2);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-09-14 14:05:57 +00:00
|
|
|
|
void erase(size_type pos);
|
2001-02-20 13:16:07 +00:00
|
|
|
|
///
|
2001-07-16 15:53:25 +00:00
|
|
|
|
void erase();
|
2001-02-19 14:16:57 +00:00
|
|
|
|
|
2001-02-14 17:50:58 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
void push_back(MathAtom const &);
|
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-09-11 10:58:17 +00:00
|
|
|
|
MathAtom & back();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-11-09 16:27:44 +00:00
|
|
|
|
///
|
|
|
|
|
MathAtom & front();
|
|
|
|
|
///
|
|
|
|
|
MathAtom const & front() const;
|
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
void dump() const;
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-11-08 12:06:56 +00:00
|
|
|
|
void dump2() const;
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void substitute(MathMacro const &);
|
2001-11-16 09:07:40 +00:00
|
|
|
|
///
|
|
|
|
|
bool match(MathArray const &) const;
|
2001-11-16 09:55:37 +00:00
|
|
|
|
///
|
|
|
|
|
void replace(ReplaceData &);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
MathAtom & at(size_type pos);
|
2001-02-28 17:21:16 +00:00
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
MathAtom const & at(size_type pos) 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();
|
2001-11-07 10:21:51 +00:00
|
|
|
|
|
2001-08-09 08:53:16 +00:00
|
|
|
|
private:
|
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-12-11 10:14:51 +00:00
|
|
|
|
///
|
|
|
|
|
std::ostream & operator<<(std::ostream & os, MathArray const & ar);
|
|
|
|
|
|
|
|
|
|
|
2001-02-12 08:55:14 +00:00
|
|
|
|
#endif
|