mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Remove std::vector<boo> from Json Serializer, simplify affected code
This commit is contained in:
@@ -91,17 +91,6 @@ size_t JsonArraySerializer::size() const
|
||||
return thisNode->Vector().size();
|
||||
}
|
||||
|
||||
//JsonSerializeFormat::LIC
|
||||
JsonSerializeFormat::LIC::LIC(const std::vector<bool> & Standard, TDecoder Decoder, TEncoder Encoder):
|
||||
standard(Standard),
|
||||
decoder(std::move(Decoder)),
|
||||
encoder(std::move(Encoder))
|
||||
{
|
||||
any.resize(standard.size(), false);
|
||||
all.resize(standard.size(), false);
|
||||
none.resize(standard.size(), false);
|
||||
}
|
||||
|
||||
JsonSerializeFormat::LICSet::LICSet(const std::set<si32> & Standard, TDecoder Decoder, TEncoder Encoder):
|
||||
standard(Standard),
|
||||
decoder(std::move(Decoder)),
|
||||
@@ -140,4 +129,16 @@ void JsonSerializeFormat::serializeBool(const std::string & fieldName, bool & va
|
||||
serializeBool<bool>(fieldName, value, true, false, defaultValue);
|
||||
}
|
||||
|
||||
void JsonSerializeFormat::readLICPart(const JsonNode & part, const JsonSerializeFormat::TDecoder & decoder, std::set<si32> & value) const
|
||||
{
|
||||
for(const auto & index : part.Vector())
|
||||
{
|
||||
const std::string & identifier = index.String();
|
||||
|
||||
const si32 rawId = decoder(identifier);
|
||||
if(rawId != -1)
|
||||
value.insert(rawId);
|
||||
}
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user