lyx_mirror/src/BackStack.h
Lars Gullik Bjønnes 45a03f4f67 use the new sstream return non-pods as const, use string instead of char * in a lot of places
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1019 a592a061-630c-0410-9148-cb99ea01b6c8
2000-09-14 17:53:12 +00:00

65 lines
1.2 KiB
C++

// -*- C++ -*-
/* This file is part of
* ======================================================
*
* LyX, The Document Processor
*
* Copyright 1997-2000 The LyX Team.
*
* ====================================================== */
#ifndef BACK_STACK_H
#define BACK_STACK_H
#include <stack>
#include "LString.h"
/** Utility to get back from a reference or from a child document.
@author Alejandro Aguilar Sierra
@version 970806
*/
class BackStack {
private:
///
struct BackStackItem {
///
BackStackItem()
: x(0), y(0) {}
///
BackStackItem(string const & f, int xx, int yy)
: fname(f), x(xx), y(yy) {}
/// Filename
string fname;
/// Cursor x-position
int x;
/// Cursor y-position
int y;
};
public:
///
void push(string f, int x, int y) {
BackStackItem bit(f, x, y);
stakk.push(bit);
}
///
string const pop(int * x, int * y) {
BackStackItem bit = stakk.top();
*x = bit.x;
*y = bit.y;
stakk.pop();
return bit.fname;
}
/**
@return returns #true# if the stack is empty, #false# otherwise.
*/
bool empty() const {
return stakk.empty();
}
private:
///
std::stack<BackStackItem> stakk;
};
#endif