comparison anagram/support/agcstack.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * agcstack.h - character stack
7 */
8
9 #ifndef AGCSTACK_H
10 #define AGCSTACK_H
11
12 #include "agstack.h"
13 #include "agstring.h"
14
15
16 class AgCharStack : public AgStack<char> {
17 public:
18 AgCharStack()
19 : AgStack<char>()
20 {}
21 AgCharStack(const int c)
22 : AgStack<char>((char) c)
23 {}
24 AgCharStack(const AgCharStack &s)
25 : AgStack<char>(s)
26 {}
27 AgCharStack &push(const char *s);
28 AgCharStack &push(const unsigned char *s) {
29 return push((const char *) s);
30 }
31 AgCharStack &push(const char *s, unsigned n);
32 AgCharStack &push(const unsigned char *s, unsigned n) {
33 return push((const char *)s, n);
34 }
35
36 AgCharStack &operator << (AgString s);
37 AgCharStack &operator << (const char *s);
38
39 AgCharStack &operator << (int c) {
40 push((char) c);
41 return *this;
42 }
43
44 AgCharStack &push(const AgString &s) {
45 (*this) << s;
46 return *this;
47 }
48
49 AgCharStack &push(const int c) {
50 AgStack<char>::push((char) c);
51 return *this;
52 }
53
54 AgString popString(unsigned n);
55 AgString popString();
56 };
57
58
59 #endif /* AGCSTACK_H */