| 424 | |
| 425 | |
| 426 | class Text(Printable): |
| 427 | |
| 428 | def __init__(self): |
| 429 | self.objs = [] |
| 430 | self.width = 0 |
| 431 | |
| 432 | def output(self, stream, output_width): |
| 433 | for obj in self.objs: |
| 434 | stream.write(obj) |
| 435 | return output_width + self.width |
| 436 | |
| 437 | def add(self, obj, width): |
| 438 | self.objs.append(obj) |
| 439 | self.width += width |
| 440 | |
| 441 | |
| 442 | class Breakable(Printable): |