00001 // idep_tokeniter.h 00002 #ifndef INCLUDED_IDEP_TOKENITER 00003 #define INCLUDED_IDEP_TOKENITER 00004 00005 // This component defines 1 fully insulated iterator class: 00006 // idep_TokenIter: iterate over the tokens in an input stream 00007 00008 #include <iosfwd> 00009 00010 class idep_TokenIter_i; 00011 class idep_TokenIter { 00012 idep_TokenIter_i *d_this; 00013 00014 private: 00015 idep_TokenIter(const idep_TokenIter&); // not implemented 00016 idep_TokenIter& operator=(const idep_TokenIter&); // not implemented 00017 00018 public: 00019 // CREATORS 00020 idep_TokenIter(std::istream& in); 00021 // Create a token iterator for the specified stream. A "token" is 00022 // either a newline ('\n') or a "word" consisting of a contiguous 00023 // sequence of non-white-space characters. The stream object must 00024 // continue to exist while the iterator is in use. 00025 00026 ~idep_TokenIter(); 00027 00028 void operator++(); 00029 // Advance to next token (i.e., "word" or newline). The behavior is 00030 // undefined if the iteration state is not valid. 00031 00032 // ACCESSORS 00033 operator const void *() const; 00034 // Return non-zero if current token is valid; else 0. 00035 00036 const char *operator()() const; 00037 // Return the current token (i.e., "word" or newline). The behavior 00038 // is undefined if the iteration state is not valid. 00039 }; 00040 00041 #endif 00042
1.3.9.1