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

Method toStringBox

valdi_core/src/valdi_core/cpp/Utils/Value.cpp:465–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463}
464
465StringBox Value::toStringBox() const {
466 if (isInternedString()) {
467 return StringBox(Ref<InternedStringImpl>(toPointer<InternedStringImpl>()));
468 } else if (isStaticString()) {
469 const auto* staticString = getStaticString();
470 switch (staticString->encoding()) {
471 case StaticString::Encoding::UTF8:
472 return StringCache::getGlobal().makeString(staticString->utf8StringView());
473 case StaticString::Encoding::UTF16:
474 return StringCache::getGlobal().makeStringFromUTF16(staticString->utf16Data(), staticString->size());
475 case StaticString::Encoding::UTF32: {
476 auto storage = staticString->utf8Storage();
477 return StringCache::getGlobal().makeString(storage.data, storage.length);
478 }
479 }
480 }
481
482 return StringCache::getGlobal().makeString(toString());
483}
484
485std::vector<StringBox> Value::sortedMapKeys() const {
486 std::vector<StringBox> keys;

Callers 2

operator==Method · 0.45
operator<Method · 0.45

Calls 10

getGlobalFunction · 0.85
makeStringMethod · 0.80
utf8StringViewMethod · 0.80
makeStringFromUTF16Method · 0.80
utf16DataMethod · 0.80
utf8StorageMethod · 0.80
StringBoxClass · 0.70
toStringFunction · 0.50
encodingMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected