MCPcopy Create free account
hub / github.com/DFHack/dfhack / serialize_to_ostream

Method serialize_to_ostream

plugins/stockpiles/StockpileSerializer.cpp:167–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165StockpileSerializer::~StockpileSerializer() { }
166
167bool StockpileSettingsSerializer::serialize_to_ostream(color_ostream& out, std::ostream* output, uint32_t includedElements) {
168 if (output->fail())
169 return false;
170 mBuffer.Clear();
171 write(out, includedElements);
172 {
173 io::OstreamOutputStream zero_copy_output(output);
174 if (!mBuffer.SerializeToZeroCopyStream(&zero_copy_output))
175 return false;
176 }
177 return output->good();
178}
179
180bool StockpileSettingsSerializer::serialize_to_file(color_ostream& out, const string& file, uint32_t includedElements) {
181 std::fstream output(file, std::ios::out | std::ios::binary | std::ios::trunc);

Callers

nothing calls this directly

Calls 3

writeFunction · 0.50
ClearMethod · 0.45

Tested by

no test coverage detected