00001 #ifndef NOCOMMENT_STREAM_H 00002 #define NOCOMMENT_STREAM_H 00003 // $Id: nocomment.h,v 1.1 2001/08/07 09:16:00 dvermeir Exp $ 00004 00005 #include <string> 00006 #include <iostream> 00007 #include "filterstreambuf.h" 00008 00014 00015 00018 class nocommentstream: public istream { 00019 private: 00021 class NoCommentFilter { 00022 public: 00023 NoCommentFilter(istream& is): is_(is) {} 00024 ~NoCommentFilter() {} 00025 int put(int c) { return EOF; } 00026 int get(); 00027 int sync() { return -1; } 00028 void close() {} 00029 private: 00031 istream& is_; 00032 }; 00033 public: 00035 nocommentstream(istream& stream); 00037 ~nocommentstream() { delete rdbuf(); } 00038 private: 00039 NoCommentFilter filter_; 00040 }; 00041 00042 #endif