⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 containerpresentation.h

📁 用于词法分析的词法分析器
💻 H
字号:
/*  $Id: ContainerPresentation.h,v 1.2 1997/02/02 01:31:05 matt Exp $    Container presentation class.    (c) Mat 95 Matt Phillips.  */#ifndef _CONTPRES_H#define _CONTPRES_H#include <iostream.h>#include "ContainerIter.h"#include "Data.h"template <class T>class ContainerPresentation{public:     virtual ~ContainerPresentation () {}     // class name  virtual const char *name () const {return "ContainerPresentation";}  // number of items  virtual int nItems () const = 0;  // is empty  int isEmpty () const {return nItems () == 0;}  // is full (default is never full)  virtual int isFull () const {return 0;}  // clear container  virtual void clear () = 0;  // iterator  virtual ContainerIter<T> *makeIter () const = 0;  // print  virtual void printTo (ostream &s) const;};template <class T>void ContainerPresentation<T>::printTo (ostream &s) const{  ContainerIter<T> *i;     for (i = makeIter (); *i; (*i)++)    s << i->ref () << endl;     delete i;}template <class T>ostream &operator << (ostream &s,		      const ContainerPresentation<T> &c){  c.printTo (s);  return s;}#ifdef __BCC__// the below is necessary for Borland C++ 4.0, something to do with// its nonstandard (I think) ostream_withassign classtemplate <class T>ostream &operator << (ostream_withassign &s,		      const ContainerPresentation<T> &c){  c.printTo (s);  return s;}#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -