looks for "\n[" and leaves the file pointer at the next character could be a problem if the ballot box is the first line in the file, then "\n[" wouldn't be encountered, only "[", so make sure that the ballots aren't on the first line returns false if finds "\n#" -- start of new genre
| 781 | // on the first line |
| 782 | // returns false if finds "\n#" -- start of new genre |
| 783 | int cTextReportViewer::FindNextLineToken() |
| 784 | { |
| 785 | // loop over chars until (1) EOF is hit, or (2) we find "\n[" or '\n#' |
| 786 | for (GetChar(); !mpIn->eof(); GetChar()) |
| 787 | { |
| 788 | if (mCurrentChar[0] == '\n') |
| 789 | { |
| 790 | // we'll only compare to single byte chars |
| 791 | // so it's ok to use PeekChar() instead of our GetChar() |
| 792 | if (PeekChar() == '[') |
| 793 | { |
| 794 | return TOKEN_BALLOT_BOX; |
| 795 | } |
| 796 | else if (PeekChar() == '#') // start of new genre |
| 797 | { |
| 798 | return TOKEN_GENRE; |
| 799 | } |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | return (TOKEN_EOF); |
| 804 | } |
| 805 | |
| 806 | void cTextReportViewer::ReadTextReport(const TSTRING& strFilename) //throw (eTextReportViewer) |
| 807 | { |