| 458 | typename tok |
| 459 | > |
| 460 | void cpp_pretty_printer_kernel_2<stack,tok>:: |
| 461 | number ( |
| 462 | std::istream& in, |
| 463 | std::ostream& out |
| 464 | ) const |
| 465 | { |
| 466 | if (!out) |
| 467 | throw std::ios::failure("error occurred in cpp_pretty_printer_kernel_2::number"); |
| 468 | |
| 469 | std::string space = " "; |
| 470 | std::ios::int_type ch; |
| 471 | unsigned long count = 1; |
| 472 | while ((ch=in.get()) != EOF) |
| 473 | { |
| 474 | if (ch != '\n') |
| 475 | { |
| 476 | out << (char)ch; |
| 477 | } |
| 478 | else |
| 479 | { |
| 480 | out << "\n<i><font face='Courier New'>" << count << " </font></i> " + space; |
| 481 | ++count; |
| 482 | if (count == 10) |
| 483 | space = " "; |
| 484 | if (count == 100) |
| 485 | space = " "; |
| 486 | if (count == 1000) |
| 487 | space = ""; |
| 488 | } |
| 489 | } |
| 490 | if (!out) |
| 491 | throw std::ios::failure("error occurred in cpp_pretty_printer_kernel_2::number"); |
| 492 | } |
| 493 | |
| 494 | // ---------------------------------------------------------------------------------------- |
| 495 | |