* Add text to the output storage. * @param text Text to store. */
| 98 | * @param text Text to store. |
| 99 | */ |
| 100 | void Add(std::string_view text) |
| 101 | { |
| 102 | if (!text.empty() && this->BufferHasRoom()) { |
| 103 | size_t stored_size = this->output_buffer[this->output_buffer.size() - 1].Add(text); |
| 104 | text.remove_prefix(stored_size); |
| 105 | } |
| 106 | while (!text.empty()) { |
| 107 | OutputBuffer &block = this->output_buffer.emplace_back(); |
| 108 | block.Clear(); // Initialize the new block. |
| 109 | size_t stored_size = block.Add(text); |
| 110 | text.remove_prefix(stored_size); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Write all stored output to the output stream. |