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

Function serializeValue

valdi_core/src/valdi_core/cpp/Utils/ValueUtils.cpp:47–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47Ref<ByteBuffer> serializeValue(const Value& value) {
48 auto out = makeShared<ByteBuffer>();
49
50 const auto* map = value.getMap();
51 if (map != nullptr) {
52 auto keys = value.sortedMapKeys();
53
54 for (const auto& key : keys) {
55 auto value = map->find(key)->second.toStringBox();
56
57 auto keyStrView = key.toStringView();
58 auto valueStrView = value.toStringView();
59
60 out->append(keyStrView.begin(), keyStrView.end());
61 out->append('=');
62 out->append(valueStrView.begin(), valueStrView.end());
63 out->append('\n');
64 }
65 }
66
67 return out;
68}
69
70static void writeTypedObjectToJSONWriter(const ValueTypedObject& typedObject, JSONWriter& writer) {
71 writer.writeBeginObject();

Callers 2

TESTFunction · 0.85
storeInCacheFunction · 0.85

Calls 8

sortedMapKeysMethod · 0.80
getMapMethod · 0.65
appendMethod · 0.65
endMethod · 0.65
toStringBoxMethod · 0.45
findMethod · 0.45
toStringViewMethod · 0.45
beginMethod · 0.45

Tested by 1

TESTFunction · 0.68