diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-29 21:02:57 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-29 21:02:57 +0000 |
commit | 6ecbc48d799a39d98a992c0c86e9563bcf4e14f4 (patch) | |
tree | 6395d8c7b9ff0550b8c4bfe67d5c43c982b1116a /TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp | |
parent | 8e74d5c4835d2697a751d14f34e8fce8dd2bb815 (diff) | |
download | ATCD-6ecbc48d799a39d98a992c0c86e9563bcf4e14f4.tar.gz |
This commit was manufactured by cvs2svn to create branch 'CCF'.
Diffstat (limited to 'TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp')
-rw-r--r-- | TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp b/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp new file mode 100644 index 00000000000..a157cfeb71b --- /dev/null +++ b/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp @@ -0,0 +1,65 @@ +#ifndef TOKEN_STREAM_HPP +#define TOKEN_STREAM_HPP + +#include <string> +#include <istream> + +namespace CCF +{ + template <typename Token> + class TokenStream + { + public: + virtual Token + next () = 0; + }; + + + template <> + class TokenStream<char> + { + public: + typedef std::char_traits<char> traits; + + typedef traits::int_type int_type; + typedef traits::char_type char_type; + + public: + virtual int_type + next () = 0; + + char_type + to_char_type (int_type i) + { + return traits::to_char_type (i); + } + + bool + eos (int_type i) + { + return i == traits::eof (); + } + }; + + class InputStreamAdapter : public TokenStream<char> + { + public: + InputStreamAdapter (std::istream& is) + : is_ (is) + { + } + + public: + + virtual int_type + next () + { + return is_.get (); + } + + private: + std::istream& is_; + }; +} + +#endif //TOKEN_STREAM_HPP |