2001-07-07 23:16:38 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/stack.h
|
|
|
|
// Purpose: STL stack clone
|
|
|
|
// Author: Lindsay Mathieson
|
|
|
|
// Modified by:
|
|
|
|
// Created: 30.07.2001
|
|
|
|
// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org>
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2001-07-07 23:16:38 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_STACK_H_
|
|
|
|
#define _WX_STACK_H_
|
|
|
|
|
|
|
|
#include "wx/vector.h"
|
|
|
|
|
2001-07-09 22:44:26 +00:00
|
|
|
#define WX_DECLARE_STACK(obj, cls)\
|
2001-07-07 23:16:38 +00:00
|
|
|
class cls : public wxVectorBase\
|
|
|
|
{\
|
2004-09-22 14:38:52 +00:00
|
|
|
WX_DECLARE_VECTORBASE(obj, cls);\
|
2001-07-07 23:16:38 +00:00
|
|
|
public:\
|
2004-09-22 14:38:52 +00:00
|
|
|
void push(const obj& o)\
|
|
|
|
{\
|
|
|
|
bool rc = Alloc(size() + 1);\
|
|
|
|
wxASSERT(rc);\
|
|
|
|
Append(new obj(o));\
|
|
|
|
};\
|
2001-07-07 23:16:38 +00:00
|
|
|
\
|
2004-09-22 14:38:52 +00:00
|
|
|
void pop()\
|
|
|
|
{\
|
|
|
|
RemoveAt(size() - 1);\
|
|
|
|
};\
|
2001-07-07 23:16:38 +00:00
|
|
|
\
|
2004-09-22 14:38:52 +00:00
|
|
|
obj& top()\
|
|
|
|
{\
|
|
|
|
return *(obj *) GetItem(size() - 1);\
|
|
|
|
};\
|
|
|
|
const obj& top() const\
|
|
|
|
{\
|
|
|
|
return *(obj *) GetItem(size() - 1);\
|
|
|
|
};\
|
2001-07-07 23:16:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _WX_STACK_H_
|
|
|
|
|