mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
11398a3316
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4798 a592a061-630c-0410-9148-cb99ea01b6c8
67 lines
1.5 KiB
C++
67 lines
1.5 KiB
C++
// -*- C++ -*-
|
|
#ifndef MATH_ITERATOR_H
|
|
#define MATH_ITERATOR_H
|
|
|
|
#include "math_pos.h"
|
|
#include <vector>
|
|
|
|
// this is used for traversing math insets
|
|
|
|
class MathIterator : private std::vector<MathCursorPos> {
|
|
public:
|
|
// re-use inherited stuff
|
|
typedef std::vector<MathCursorPos> base_type;
|
|
using base_type::clear;
|
|
using base_type::size;
|
|
using base_type::push_back;
|
|
using base_type::pop_back;
|
|
using base_type::back;
|
|
using base_type::begin;
|
|
using base_type::end;
|
|
using base_type::operator[];
|
|
using base_type::size_type;
|
|
using base_type::difference_type;
|
|
using base_type::const_iterator;
|
|
friend bool operator!=(MathIterator const &, MathIterator const &);
|
|
friend bool operator==(MathIterator const &, MathIterator const &);
|
|
|
|
/// default constructor
|
|
MathIterator();
|
|
/// start with given inset
|
|
explicit MathIterator(MathInset * p);
|
|
///
|
|
MathCursorPos const & operator*() const;
|
|
///
|
|
MathCursorPos const & operator->() const;
|
|
/// move on one step
|
|
void operator++();
|
|
/// move on several steps
|
|
void jump(difference_type);
|
|
/// read access to top most inset
|
|
MathInset const * par() const;
|
|
/// read access to top most inset
|
|
MathInset * par();
|
|
/// helper for iend
|
|
void goEnd();
|
|
/// read access to top most item
|
|
MathArray const & cell() const;
|
|
|
|
private:
|
|
/// own level down
|
|
void push(MathInset *);
|
|
/// own level up
|
|
void pop();
|
|
};
|
|
|
|
///
|
|
bool operator==(MathIterator const &, MathIterator const &);
|
|
///
|
|
bool operator!=(MathIterator const &, MathIterator const &);
|
|
|
|
///
|
|
MathIterator ibegin(MathInset * p);
|
|
///
|
|
MathIterator iend(MathInset * p);
|
|
|
|
#endif
|