2001-07-07 19:16:38 -04: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 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-07-07 19:16:38 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_STACK_H_
|
|
|
|
#define _WX_STACK_H_
|
|
|
|
|
|
|
|
#include "wx/vector.h"
|
|
|
|
|
2001-07-09 18:44:26 -04:00
|
|
|
#define WX_DECLARE_STACK(obj, cls)\
|
2001-07-07 19:16:38 -04:00
|
|
|
class cls : public wxVectorBase\
|
|
|
|
{\
|
2004-09-22 10:38:52 -04:00
|
|
|
WX_DECLARE_VECTORBASE(obj, cls);\
|
2001-07-07 19:16:38 -04:00
|
|
|
public:\
|
2004-09-22 10:38:52 -04:00
|
|
|
void push(const obj& o)\
|
|
|
|
{\
|
|
|
|
bool rc = Alloc(size() + 1);\
|
|
|
|
wxASSERT(rc);\
|
|
|
|
Append(new obj(o));\
|
|
|
|
};\
|
2001-07-07 19:16:38 -04:00
|
|
|
\
|
2004-09-22 10:38:52 -04:00
|
|
|
void pop()\
|
|
|
|
{\
|
|
|
|
RemoveAt(size() - 1);\
|
|
|
|
};\
|
2001-07-07 19:16:38 -04:00
|
|
|
\
|
2004-09-22 10:38:52 -04:00
|
|
|
obj& top()\
|
|
|
|
{\
|
|
|
|
return *(obj *) GetItem(size() - 1);\
|
|
|
|
};\
|
|
|
|
const obj& top() const\
|
|
|
|
{\
|
|
|
|
return *(obj *) GetItem(size() - 1);\
|
|
|
|
};\
|
2001-07-07 19:16:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _WX_STACK_H_
|
|
|
|
|