dolphin/Externals/wxWidgets3/include/wx/stack.h
Soren Jorvang d14efe561b Import r67258 of the wxWidgets trunk, which I expect will before
long become wxWidgets 2.9.2, which in turn is expected to be the
last 2.9 release before the 3.0 stable release.

Since the full wxWidgets distribution is rather large, I have
imported only the parts that we use, on a subdirectory basis:

art
include/wx/*.*
include/wx/aui
include/wx/cocoa
include/wx/generic
include/wx/gtk
include/wx/meta
include/wx/msw
include/wx/osx
include/wx/persist
include/wx/private
include/wx/protocol
include/wx/unix
src/aui
src/common
src/generic
src/gtk
src/msw
src/osx
src/unix


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
2011-03-20 18:05:19 +00:00

85 lines
2.1 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: wx/stack.h
// Purpose: STL stack clone
// Author: Lindsay Mathieson, Vadim Zeitlin
// Created: 30.07.2001
// Copyright: (c) 2001 Lindsay Mathieson <lindsay@mathieson.org> (WX_DECLARE_STACK)
// 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STACK_H_
#define _WX_STACK_H_
#include "wx/vector.h"
#if wxUSE_STL
#include <stack>
#define wxStack std::stack
#else // !wxUSE_STL
// Notice that unlike std::stack, wxStack currently always uses wxVector and
// can't be used with any other underlying container type.
//
// Another difference is that comparison operators between stacks are not
// implemented (but they should be, see 23.2.3.3 of ISO/IEC 14882:1998).
template <typename T>
class wxStack
{
public:
typedef wxVector<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
wxStack() { }
explicit wxStack(const container_type& cont) : m_cont(cont) { }
// Default copy ctor, assignment operator and dtor are ok.
bool empty() const { return m_cont.empty(); }
size_type size() const { return m_cont.size(); }
value_type& top() { return m_cont.back(); }
const value_type& top() const { return m_cont.back(); }
void push(const value_type& val) { m_cont.push_back(val); }
void pop() { m_cont.pop_back(); }
private:
container_type m_cont;
};
#endif // wxUSE_STL/!wxUSE_STL
// Deprecated macro-based class for compatibility only, don't use any more.
#define WX_DECLARE_STACK(obj, cls) \
class cls : public wxVector<obj> \
{\
public:\
void push(const obj& o)\
{\
push_back(o); \
};\
\
void pop()\
{\
pop_back(); \
};\
\
obj& top()\
{\
return at(size() - 1);\
};\
const obj& top() const\
{\
return at(size() - 1); \
};\
}
#endif // _WX_STACK_H_