MCPcopy Create free account
hub / github.com/Kitware/VTK / ReadStringArrayFromStream

Method ReadStringArrayFromStream

IO/OMF/core/OMFFile.cxx:353–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353std::vector<std::string> OMFFile::ReadStringArrayFromStream(const std::string& uid)
354{
355 // strings are stored directly in json so no need to worry about decompression or anything
356 const auto& json = this->Impl->JSONRoot[uid];
357 std::vector<std::string> retVal;
358 if (json.isNull() || !json.isObject() || !json.isMember("array") || !json.isMember("__class__") ||
359 json["__class__"] != "StringArray")
360 {
361 return retVal;
362 }
363
364 const auto& arrayJSON = json["array"];
365 if (!arrayJSON.isArray())
366 {
367 return retVal;
368 }
369 retVal.resize(arrayJSON.size());
370 for (Json::Value::ArrayIndex i = 0, vecIdx = 0; i < arrayJSON.size(); ++i, ++vecIdx)
371 {
372 const auto& element = arrayJSON[i];
373 helper::GetStringValue(element, retVal[vecIdx]);
374 }
375 return retVal;
376}
377
378VTK_ABI_NAMESPACE_END
379} // end namespace omf

Callers 1

ProcessDataFieldsMethod · 0.80

Calls 7

isObjectMethod · 0.80
isMemberMethod · 0.80
isArrayMethod · 0.80
GetStringValueFunction · 0.70
isNullMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected