ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/utils/StreamTokenizer.cpp
Revision: 1737
Committed: Fri Nov 12 22:44:03 2004 UTC (19 years, 7 months ago) by tim
File size: 664 byte(s)
Log Message:
bug fix in hasMoreTokens

File Contents

# User Rev Content
1 gezelter 1490 //: C07:StreamTokenizer.cpp {O}
2     // From "Thinking in C++, 2nd Edition, Volume 2"
3     // by Bruce Eckel & Chuck Allison, (c) 2001 MindView, Inc.
4     // Available at www.BruceEckel.com.
5     //{-g++295}
6    
7 tim 1492 #include "utils/StreamTokenizer.hpp"
8 gezelter 1490 using namespace std;
9    
10     string StreamTokenizer::next() {
11     string result;
12     if(p != end) {
13     insert_iterator<string>
14     ii(result, result.begin());
15     while(isDelimiter(*p) && p != end)
16     p++;
17 tim 1737
18     // There is a bug here, if p is equal to end at this point, dereference it is a undefine behavior
19     //while (!isDelimiter(*p) && p != end)
20     while (p != end && !isDelimiter(*p))
21 gezelter 1490 *ii++ = *p++;
22     }
23     return result;
24     } ///:~