]> git.lyx.org Git - lyx.git/blob - src/BackStack.h
white-space changes, removed definitions.h several enum changes because of this,...
[lyx.git] / src / BackStack.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *       
7  *          Copyright (C) 1997-1999 The LyX Team.
8  *
9  * ====================================================== */
10
11 #ifndef BACK_STACK_H
12 #define BACK_STACK_H
13
14 #include <stack>
15 using std::stack;
16
17 #include "LString.h"
18
19 // Created by Alejandro Aguilar Sierra, 970806
20
21 /**  Utility to get back from a reference or from a child document.
22  */
23 class BackStack {
24 private:
25         ///
26         struct BackStackItem {
27                 BackStackItem(string const & f, int xx, int yy)
28                         : fname(f), x(xx), y(yy) {}
29                 ///
30                 //void set(string f, int xx, int yy) {
31                 //      fname = f;  x = xx;  y = yy;
32                 //}
33                 /// Filename
34                 string fname;
35                 /// Cursor x-position
36                 int x;
37                 /// Cursor y-position
38                 int y;
39         };
40 public:
41         ///
42         void push(string f, int x, int y) {
43                 BackStackItem bit(f, x, y);
44                 stakk.push(bit);
45         }
46         ///
47         string pop(int * x, int * y) {
48                 BackStackItem bit = stakk.top();
49                 *x = bit.x;
50                 *y = bit.y;
51                 stakk.pop();
52                 return bit.fname;
53         }
54         ///
55         bool empty() const {
56                 return stakk.empty();
57         }
58 private:
59         ///
60         stack<BackStackItem> stakk;
61 };
62
63 #endif