• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

KHolidays Library

  • kholidays
  • parsers
  • plan2
stack.hh
1
2/* A Bison parser, made by GNU Bison 2.4.1. */
3
4/* Stack handling for Bison parsers in C++
5
6 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
7 Foundation, Inc.
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22/* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
31
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35#ifndef BISON_STACK_HH
36# define BISON_STACK_HH
37
38#include <deque>
39
40
41/* Line 1067 of lalr1.cc */
42#line 1 "[Bison:b4_percent_define_default]"
43
44namespace KHolidays {
45
46/* Line 1067 of lalr1.cc */
47#line 48 "stack.hh"
48 template <class T, class S = std::deque<T> >
49 class stack
50 {
51 public:
52
53 // Hide our reversed order.
54 typedef typename S::reverse_iterator iterator;
55 typedef typename S::const_reverse_iterator const_iterator;
56
57 stack () : seq_ ()
58 {
59 }
60
61 stack (unsigned int n) : seq_ (n)
62 {
63 }
64
65 inline
66 T&
67 operator [] (unsigned int i)
68 {
69 return seq_[i];
70 }
71
72 inline
73 const T&
74 operator [] (unsigned int i) const
75 {
76 return seq_[i];
77 }
78
79 inline
80 void
81 push (const T& t)
82 {
83 seq_.push_front (t);
84 }
85
86 inline
87 void
88 pop (unsigned int n = 1)
89 {
90 for (; n; --n)
91 seq_.pop_front ();
92 }
93
94 inline
95 unsigned int
96 height () const
97 {
98 return seq_.size ();
99 }
100
101 inline const_iterator begin () const { return seq_.rbegin (); }
102 inline const_iterator end () const { return seq_.rend (); }
103
104 private:
105
106 S seq_;
107 };
108
110 template <class T, class S = stack<T> >
111 class slice
112 {
113 public:
114
115 slice (const S& stack,
116 unsigned int range) : stack_ (stack),
117 range_ (range)
118 {
119 }
120
121 inline
122 const T&
123 operator [] (unsigned int i) const
124 {
125 return stack_[range_ - i];
126 }
127
128 private:
129
130 const S& stack_;
131 unsigned int range_;
132 };
133
134/* Line 1153 of lalr1.cc */
135#line 1 "[Bison:b4_percent_define_default]"
136
137} // KHolidays
138
139/* Line 1153 of lalr1.cc */
140#line 141 "stack.hh"
141
142#endif // not BISON_STACK_HH[]dnl
143
KHolidays::slice
Present a slice of the top of a stack.
Definition: stack.hh:112
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHolidays Library

Skip menu "KHolidays Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal