MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / getValueBoolVector

Method getValueBoolVector

framework/serialization/serialize.cpp:361–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359void XMLSerializationNode::setValueBool(bool b) { node.text().set(b); }
360
361std::vector<bool> XMLSerializationNode::getValueBoolVector()
362{
363 std::vector<bool> vec;
364 auto string = this->getValue();
365
366 vec.resize(string.length());
367 for (size_t i = 0; i < string.length(); i++)
368 {
369 auto c = string[i];
370 if (c == '1')
371 vec[i] = true;
372 else if (c == '0')
373 vec[i] = false;
374 else
375 throw SerializationException(format("Unknown char '%c' in bool vector", c), this);
376 }
377 return vec;
378}
379
380void XMLSerializationNode::setValueBoolVector(const std::vector<bool> &vec)
381{

Callers 1

serializeInFunction · 0.80

Calls 3

getValueMethod · 0.95
formatFunction · 0.85

Tested by

no test coverage detected