* 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. */
| 425 | * Do NOT display any console messages when this function is used. |
| 426 | */ |
| 427 | void 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. |
no test coverage detected