Bump for 3.6-28
[LibreOffice.git] / autodoc / source / inc / estack.hxx
blob3eb5b838dbf3c1b023c1fc9a61f6f7889754d9ef
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef ARY_ESTACK_HXX
30 #define ARY_ESTACK_HXX
34 // USED SERVICES
35 // BASE CLASSES
36 #include <list>
37 // COMPONENTS
38 // PARAMETERS
42 template <class ELEM>
43 class EStack : private std::list<ELEM>
45 private:
46 typedef std::list<ELEM> base;
47 const base & Base() const { return *this; }
48 base & Base() { return *this; }
50 public:
51 typedef ELEM value_type;
52 typedef typename std::list<ELEM>::size_type size_type;
54 // LIFECYCLE
55 EStack() {}
56 EStack(
57 const EStack & i_rStack )
58 : base( (const base &)(i_rStack) ) {}
59 ~EStack() {}
60 // OPERATORS
61 EStack & operator=(
62 const EStack & i_rStack )
63 { base::operator=( i_rStack.Base() );
64 return *this; }
65 bool operator==(
66 const EStack<ELEM> & ) const
67 { return std::operator==( Base(), this->i_rStack.Base() ); }
68 bool operator<(
69 const EStack<ELEM> & ) const
70 { return std::operator<( Base(), this->i_rStack.Base() ); }
71 // OPERATIONS
72 void push(
73 const value_type & i_rElem )
74 { base::push_front(i_rElem); }
75 void pop() { base::pop_front(); }
76 void erase_all() { while (NOT empty()) pop(); }
78 // INQUIRY
79 const value_type & top() const { return base::front(); }
80 size_type size() const { return base::size(); }
81 bool empty() const { return base::empty(); }
83 // ACCESS
84 value_type & top() { return base::front(); }
89 // IMPLEMENTATION
92 #endif
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */