--- /dev/null
+\r
+/************************************************************/\r
+/* */\r
+/* Predefined char stream: Input from (c++) stream. */\r
+/* */\r
+/* By Hubert Holin (Hubert.Holin@Bigfoot.com), 1998. */\r
+/* */\r
+/* This is completely free stuff, do whatever you want with */\r
+/* it (but then, I will take no responsability for whatever */\r
+/* may happen if you do either... caveat emptor!). */\r
+/* */\r
+/************************************************************/\r
+\r
+#ifndef _DLG_STREAM_INPUT_H\r
+#define _DLG_STREAM_INPUT_H\r
+\r
+#include "pccts_istream.h"\r
+\r
+PCCTS_NAMESPACE_STD\r
+\r
+#ifndef DLGX_H\r
+#include "DLexerBase.h"\r
+#endif\r
+\r
+\r
+// NOTES: The semantics of the copy constructor\r
+// and the affectation operator may be unwaranted...\r
+// and the stream may not be reset.\r
+//\r
+// It would have been so much nicer for nextChar()\r
+// to throw (of for the DLGInputStream to change status)\r
+// upon hiting EOF than to return an "int"...\r
+\r
+template <\r
+ class E,\r
+ class T = ::std::char_traits<E>\r
+ >\r
+class DLG_stream_input : public DLGInputStream\r
+{\r
+public:\r
+ \r
+ DLG_stream_input(::std::basic_istream<E,T> * p_input_stream)\r
+ : input(p_input_stream)\r
+ {\r
+ // nothing to do!\r
+ };\r
+ \r
+ DLG_stream_input(const DLG_stream_input & a_recopier)\r
+ : input(a_recopier.input)\r
+ {\r
+ // nothing to do!\r
+ };\r
+ \r
+ virtual ~DLG_stream_input()\r
+ {\r
+ this->purge(); // bloody templarized lookup...\r
+ };\r
+ \r
+ DLG_stream_input operator = (const DLG_stream_input & a_affecter)\r
+ {\r
+ if (this != &a_affecter)\r
+ {\r
+ input = a_affecter.input;\r
+ }\r
+\r
+ return(*this);\r
+ };\r
+ \r
+ virtual int nextChar()\r
+ {\r
+ E extracted_stuff;\r
+ \r
+ input->get(extracted_stuff);\r
+ \r
+ if (*input)\r
+ {\r
+ return(int(extracted_stuff));\r
+ }\r
+ else\r
+ {\r
+ return(EOF);\r
+ }\r
+ };\r
+ \r
+protected:\r
+ \r
+ ::std::basic_istream<E,T> * input;\r
+ \r
+private:\r
+ \r
+ void purge()\r
+ {\r
+ // nothing to do!\r
+ };\r
+};\r
+\r
+#endif /* _DLG_STREAM_INPUT_H */\r
+\r