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