MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Add

Method Add

src/settingsgen/settingsgen.cpp:100–112  ·  view source on GitHub ↗

* Add text to the output storage. * @param text Text to store. */

Source from the content-addressed store, hash-verified

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.

Callers 2

DumpGroupFunction · 0.45
DumpLineFunction · 0.45

Calls 4

BufferHasRoomMethod · 0.95
emptyMethod · 0.45
sizeMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected