source:
trunk/packages/vizservers/nanovis/vrutil/vrStringParser.cpp
@
2841
Last change on this file since 2841 was 2841, checked in by ldelgass, 12 years ago | |
---|---|
|
|
File size: 543 bytes |
Rev | Line | |
---|---|---|
[2798] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
[1700] | 2 | #include <vrutil/vrStringParser.h> |
3 | ||
[2841] | 4 | vrStringParser::vrStringParser(std::istream& stream) : |
5 | _stream(stream) | |
[1700] | 6 | { |
7 | } | |
8 | ||
9 | int vrStringParser::getToken() | |
10 | { | |
[2841] | 11 | int index = 0; |
12 | char ch = 0; | |
13 | if (_stream.eof()) return 0; | |
[1700] | 14 | |
[2841] | 15 | while (!_stream.eof() && isWhiteChar(ch = _stream.get())); |
16 | if (ch == 0 || isWhiteChar(ch)) return 0; | |
[1700] | 17 | |
[2841] | 18 | do { |
19 | _buff[index++] = ch; | |
20 | } while (!_stream.eof() && !isWhiteChar(ch = _stream.get())); | |
[1700] | 21 | |
[2841] | 22 | _buff[index] = 0; |
[1700] | 23 | |
[2841] | 24 | return index; |
[1700] | 25 | } |
Note: See TracBrowser
for help on using the repository browser.