|
|
1.1 ! root 1: /* ! 2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. ! 3: ! 4: Governed by the TrueCrypt License 2.4 the full text of which is contained ! 5: in the file License.txt included in TrueCrypt binary and source code ! 6: distribution packages. ! 7: */ ! 8: ! 9: #include "TextReader.h" ! 10: ! 11: namespace TrueCrypt ! 12: { ! 13: TextReader::TextReader (const FilePath &path) ! 14: { ! 15: InputFile.reset (new File); ! 16: InputFile->Open (path); ! 17: InputStream = shared_ptr <Stream> (new FileStream (InputFile)); ! 18: } ! 19: ! 20: bool TextReader::ReadLine (string &outputString) ! 21: { ! 22: outputString.erase(); ! 23: ! 24: char c; ! 25: while (InputStream->Read (BufferPtr ((byte *) &c, sizeof (c))) == sizeof (c)) ! 26: { ! 27: if (c == '\r') ! 28: continue; ! 29: ! 30: if (c == '\n') ! 31: return true; ! 32: ! 33: outputString += c; ! 34: } ! 35: return !outputString.empty(); ! 36: } ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.