This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / BackStack.h
blobb56bb641476158fcdbefeb10b119af15def9da88
1 // -*- C++ -*-
2 /* This file is part of
3 * ======================================================
4 *
5 * LyX, The Document Processor
6 *
7 * Copyright (C) 1997-1999 The LyX Team.
9 * ======================================================*/
11 #ifndef BACK_STACK_H
12 #define BACK_STACK_H
14 #include <stack>
15 #include "LString.h"
17 // Created by Alejandro Aguilar Sierra, 970806
19 /** Utility to get back from a reference or from a child document.
21 class BackStack {
22 private:
23 ///
24 struct BackStackItem {
25 BackStackItem(string const & f, int xx, int yy)
26 : fname(f), x(xx), y(yy) {}
27 ///
28 //void set(string f, int xx, int yy) {
29 // fname = f; x = xx; y = yy;
30 //}
31 /// Filename
32 string fname;
33 /// Cursor x-position
34 int x;
35 /// Cursor y-position
36 int y;
38 public:
39 ///
40 void push(string f, int x, int y) {
41 BackStackItem bit(f, x, y);
42 stakk.push(bit);
44 ///
45 string pop(int * x, int * y) {
46 BackStackItem bit = stakk.top();
47 *x = bit.x;
48 *y = bit.y;
49 stakk.pop();
50 return bit.fname;
52 ///
53 bool empty() const {
54 return stakk.empty();
56 private:
57 ///
58 stack<BackStackItem> stakk;
61 #endif