MCPcopy Create free account
hub / github.com/apple/foundationdb / toStringRef

Method toStringRef

fdbrpc/JsonWebKeySet.cpp:800–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798}
799
800Optional<StringRef> JsonWebKeySet::toStringRef(Arena& arena) {
801 using Buffer = rapidjson::StringBuffer;
802 using Writer = rapidjson::Writer<Buffer>;
803 auto buffer = Buffer();
804 auto writer = Writer(buffer);
805 writer.StartObject();
806 writer.Key("keys");
807 writer.StartArray();
808 for (const auto& [keyName, key] : keys) {
809 if (!encodeKey(writer, keyName, key)) {
810 return {};
811 }
812 }
813 writer.EndArray();
814 writer.EndObject();
815 auto buf = new (arena) uint8_t[buffer.GetSize()];
816 ::memcpy(buf, buffer.GetString(), buffer.GetSize());
817 return StringRef(buf, buffer.GetSize());
818}
819
820void forceLinkJsonWebKeySetTests() {}
821

Callers 2

testPublicKeyFunction · 0.45
testPrivateKeyFunction · 0.45

Calls 10

memcpyFunction · 0.85
GetSizeMethod · 0.80
encodeKeyFunction · 0.70
WriterFunction · 0.50
StringRefClass · 0.50
StartObjectMethod · 0.45
KeyMethod · 0.45
StartArrayMethod · 0.45
EndArrayMethod · 0.45
EndObjectMethod · 0.45

Tested by

no test coverage detected