view anagram/support/agcstack.h @ 4:bebb2ba69e1d

maybe help with getting tex to fail properly on error
author David A. Holland
date Sat, 18 Apr 2020 17:12:17 -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 */