MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / FindNextLineToken

Method FindNextLineToken

src/tw/textreportviewer.cpp:783–804  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

781// on the first line
782// returns false if finds "\n#" -- start of new genre
783int 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
806void cTextReportViewer::ReadTextReport(const TSTRING& strFilename) //throw (eTextReportViewer)
807{

Callers

nothing calls this directly

Calls 1

eofMethod · 0.80

Tested by

no test coverage detected