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

Function GetDoubleArray

IO/Geometry/vtkGLTFUtils.cxx:147–170  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

145
146//------------------------------------------------------------------------------
147bool GetDoubleArray(const nlohmann::json& root, const std::string& key, std::vector<double>& value)
148{
149 auto it = root.find(key);
150 if (it == root.end() || !it.value().is_array())
151 {
152 return false;
153 }
154 value.reserve(it.value().size());
155 for (const auto& doubleValue : it.value())
156 {
157 if (doubleValue.empty() && !doubleValue.is_number())
158 {
159 value.clear();
160 return false;
161 }
162 value.push_back(doubleValue);
163 }
164 if (value.empty())
165 {
166 value.clear();
167 return false;
168 }
169 return true;
170}
171
172//------------------------------------------------------------------------------
173bool GetStringValue(const nlohmann::json& root, const std::string& key, std::string& value)

Callers 5

LoadAccessorBoundsMethod · 0.70
LoadMaterialMethod · 0.70
LoadNodeMethod · 0.70
LoadTextureInfoMethod · 0.70

Calls 8

findMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected