| 57 | |
| 58 | |
| 59 | TabLineStatus TabFile::GetNextTabLine(TAB_FIELDS &tabFields, int &lineNum) { |
| 60 | |
| 61 | // make sure there are still lines to process. |
| 62 | // if so, tokenize, return the TAB_FIELDS. |
| 63 | if (_tabStream->good() == true) { |
| 64 | string tabLine; |
| 65 | tabFields.reserve(20); |
| 66 | |
| 67 | // parse the tabStream pointer |
| 68 | getline(*_tabStream, tabLine); |
| 69 | |
| 70 | if (tabLine[tabLine.size()-1] == '\r') { |
| 71 | tabLine.resize(tabLine.size()-1); |
| 72 | } |
| 73 | |
| 74 | lineNum++; |
| 75 | |
| 76 | // split into a string vector. |
| 77 | Tokenize(tabLine, tabFields); |
| 78 | |
| 79 | // parse the line and validate it |
| 80 | return parseTabLine(tabFields, lineNum); |
| 81 | } |
| 82 | |
| 83 | // default if file is closed or EOF |
| 84 | return TAB_INVALID; |
| 85 | } |