MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / formatCinToCout

Method formatCinToCout

other_src/astyle/src/astyle_main.cpp:427–449  ·  view source on GitHub ↗

* If no files have been given, use cin for input and cout for output. * * This is used to format text for text editors like TextWrangler (Mac). * Do NOT display any console messages when this function is used. */

Source from the content-addressed store, hash-verified

425 * Do NOT display any console messages when this function is used.
426 */
427void ASConsole::formatCinToCout() const
428{
429 verifyCinPeek();
430 ASStreamIterator<istream> streamIterator(&cin); // create iterator for cin
431 formatter.init(&streamIterator);
432
433 while (formatter.hasMoreLines())
434 {
435 cout << formatter.nextLine();
436 if (formatter.hasMoreLines())
437 cout << streamIterator.getOutputEOL();
438 else
439 {
440 // this can happen if the file if missing a closing bracket and break-blocks is requested
441 if (formatter.getIsLineReady())
442 {
443 cout << streamIterator.getOutputEOL();
444 cout << formatter.nextLine();
445 }
446 }
447 }
448 cout.flush();
449}
450
451/**
452 * Verify that tellg() works with cin.

Callers 1

mainFunction · 0.80

Calls 6

getOutputEOLMethod · 0.80
getIsLineReadyMethod · 0.80
initMethod · 0.45
hasMoreLinesMethod · 0.45
nextLineMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected