MCPcopy Create free account
hub / github.com/Snapchat/Valdi / getDataBytesForKey

Function getDataBytesForKey

valdi/src/valdi/runtime/Debugger/DaemonClient.cpp:111–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111static BytesView getDataBytesForKey(const Value& value, std::string_view stringKey, std::string_view base64Key) {
112 auto stringValue = value.getMapValue(stringKey);
113 if (stringValue.isString()) {
114 auto str = stringValue.toStringBox();
115 return BytesView(str.getInternedString(), reinterpret_cast<const Byte*>(str.getCStr()), str.length());
116 }
117
118 auto base64String = value.getMapValue(base64Key).toStringBox();
119 auto data = makeShared<Bytes>();
120 snap::utils::encoding::base64ToBinary(base64String.toStringView(), *data);
121 return BytesView(data);
122}
123
124void DaemonClient::processEvent(const Value& event) {
125 auto updatedResources = event.getMapValue("updated_resources");

Callers 1

processEventMethod · 0.85

Calls 9

base64ToBinaryFunction · 0.85
getMapValueMethod · 0.80
getInternedStringMethod · 0.80
BytesViewClass · 0.70
isStringMethod · 0.45
toStringBoxMethod · 0.45
getCStrMethod · 0.45
lengthMethod · 0.45
toStringViewMethod · 0.45

Tested by

no test coverage detected