view anagram/support/agcstack.h @ 17:12171da8943f

Don't refer to CVS.
author David A. Holland
date Tue, 31 May 2022 01:56:37 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
 * See the file COPYING for license and usage terms.
 *
 * agcstack.h - character stack
 */

#ifndef AGCSTACK_H
#define AGCSTACK_H

#include "agstack.h"
#include "agstring.h"


class AgCharStack : public AgStack<char> {
public:
  AgCharStack()
    : AgStack<char>()
  {}
  AgCharStack(const int c)
    : AgStack<char>((char) c)
  {}
  AgCharStack(const AgCharStack &s)
    : AgStack<char>(s)
  {}
  AgCharStack &push(const char *s);
  AgCharStack &push(const unsigned char *s) {
    return push((const char *) s);
  }
  AgCharStack &push(const char *s, unsigned n);
  AgCharStack &push(const unsigned char *s, unsigned n) {
    return push((const char *)s, n);
  }

  AgCharStack &operator << (AgString s);
  AgCharStack &operator << (const char *s);

  AgCharStack &operator << (int c) {
    push((char) c);
    return *this;
  }

  AgCharStack &push(const AgString &s) {
    (*this) << s;
    return *this;
  }

  AgCharStack &push(const int c) {
    AgStack<char>::push((char) c);
    return *this;
  }

  AgString popString(unsigned n);
  AgString popString();
};


#endif /* AGCSTACK_H */