MCPcopy Create free account
hub / github.com/argotorg/solidity / parseCBORMetadata

Function parseCBORMetadata

test/Metadata.cpp:155–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153};
154
155std::optional<std::map<std::string, std::string>> parseCBORMetadata(bytes const& _metadata)
156{
157 try
158 {
159 TinyCBORParser parser(_metadata);
160 std::map<std::string, std::string> ret;
161 unsigned count = parser.mapItemCount();
162 for (unsigned i = 0; i < count; i++)
163 {
164 std::string key = parser.readKey();
165 std::string value = parser.readValue();
166 ret[std::move(key)] = std::move(value);
167 }
168 return ret;
169 }
170 catch (CBORException const&)
171 {
172 return {};
173 }
174}
175
176bool isValidMetadata(std::string const& _serialisedMetadata)
177{

Callers 1

Calls 3

mapItemCountMethod · 0.80
readKeyMethod · 0.80
readValueMethod · 0.80

Tested by

no test coverage detected