#include <word.h>
Public Methods | |
Word (const string &w="") | |
Constructor. More... | |
operator string () const | |
Convert to string. More... | |
const string & | str () const |
Friends | |
istream & | operator>> (istream &, Word &w) |
Read a word from a stream. More... | |
bool | operator== (const Word &w1, const Word &w2) |
bool | operator< (const Word &w1, const Word &w2) |
The only way to obtain a non-empty wordt is via the input operator operator<<(istream &, Word &).
test-stringpool.C, and test-word.C.
Definition at line 14 of file word.h.
|
Constructor.
Definition at line 5 of file word.C.
00005 : w_(w) { 00006 } |
|
Convert to string.
Definition at line 24 of file word.h.
00024 { return w_; } |
|
Definition at line 28 of file word.h. Referenced by operator>>().
00028 { return w_; } |
|
Read a word from a stream. Non-alhabetic characters before and after the word will be skipped.
Definition at line 9 of file word.C.
00009 { 00010 w.w_.resize(0); 00011 char c(EOF); 00012 while (is.get(c) && ! isalpha(c)) 00013 ; 00014 if ( isalpha(c) ) { 00015 do 00016 w.w_ += tolower(c); 00017 while (is.get(c) && isalpha(c)); 00018 // operation succeeded, so we want stream in ok state 00019 // otherwise is >> w would fail if w was followed in is by EOF 00020 is.clear(); 00021 } 00022 return is; 00023 } |
|
Definition at line 39 of file word.h.
|
|
Definition at line 41 of file word.h.
|
textindexer-0.2 | [27 March, 2002] |