idep_TokenIter Class Reference

#include <idep_tokeniter.h>

List of all members.

Public Member Functions

 idep_TokenIter (std::istream &in)
 ~idep_TokenIter ()
void operator++ ()
 operator const void * () const
const char * operator() () const

Private Member Functions

 idep_TokenIter (const idep_TokenIter &)
idep_TokenIteroperator= (const idep_TokenIter &)

Private Attributes

idep_TokenIter_id_this

Detailed Description

Definition at line 11 of file idep_tokeniter.h.


Constructor & Destructor Documentation

idep_TokenIter::idep_TokenIter ( const idep_TokenIter  )  [private]
idep_TokenIter::idep_TokenIter ( std::istream &  in  ) 

Definition at line 69 of file idep_tokitr.cxx.

00070 : d_this(new idep_TokenIter_i(in))
00071 {
00072     ++*this; // load first occurrence
00073 }

idep_TokenIter::~idep_TokenIter (  ) 

Definition at line 75 of file idep_tokitr.cxx.

References d_this.

00076 {
00077     delete d_this;
00078 }


Member Function Documentation

idep_TokenIter::operator const void * (  )  const

Definition at line 124 of file idep_tokitr.cxx.

References idep_TokenIter_i::d_length, and d_this.

00125 { 
00126     return d_this->d_length >= 0 ? this : 0;
00127 }

const char * idep_TokenIter::operator() (  )  const

Definition at line 129 of file idep_tokitr.cxx.

References idep_TokenIter_i::d_buf_p, and d_this.

00130 { 
00131     return d_this->d_buf_p;
00132 }

void idep_TokenIter::operator++ (  ) 

Definition at line 80 of file idep_tokitr.cxx.

References idep_TokenIter_i::addChar(), idep_TokenIter_i::d_in, idep_TokenIter_i::d_length, idep_TokenIter_i::d_newlineFlag, d_this, NEWLINE_CHAR, and NULL_CHAR.

00081 { 
00082     assert(*this);
00083 
00084     d_this->d_length = 0;
00085 
00086     if (d_this->d_newlineFlag) {                   // left over newline
00087         d_this->d_newlineFlag = 0;
00088         d_this->addChar(NEWLINE_CHAR);
00089     }
00090     else {
00091         char c;
00092         while (d_this->d_in && !d_this->d_in.get(c).eof()) {
00093             if (d_this->d_length > 0) {            // "word" in progress
00094                 if (isspace(c)) {
00095                     if (NEWLINE_CHAR == c) {
00096                         d_this->d_newlineFlag = 1; // note newline for later
00097                     }
00098                     break;                         // end of "word" in any case
00099                 }
00100                 d_this->addChar(c);                // start of "word"
00101             }
00102             else {                                 // nothing found yet
00103                 if (isspace(c)) {
00104                     if (NEWLINE_CHAR == c) {
00105                         d_this->addChar(NEWLINE_CHAR);
00106                         break;                     // found a newline
00107                     }
00108                     continue;                      // found an ordinary space
00109                 }
00110                 d_this->addChar(c);                // add character to "word"
00111             }
00112         }
00113     }
00114 
00115     if (d_this->d_length > 0) {
00116         d_this->addChar(NULL_CHAR);                // always append a null char
00117     }
00118     else { 
00119         d_this->d_length = -1;                     // or make iterator invalid
00120     }
00121 }    

idep_TokenIter& idep_TokenIter::operator= ( const idep_TokenIter  )  [private]

Member Data Documentation

Definition at line 12 of file idep_tokeniter.h.

Referenced by operator const void *(), operator()(), operator++(), and ~idep_TokenIter().


The documentation for this class was generated from the following files:

Generated on 17 Jun 2018 for loon by  doxygen 1.6.1