[info] type_name = "std::__cxx11::basic_string" stub_template_params = [2] ctype = "STRING_TYPE" header = "string" # Old: typeName = "std::__cxx11::basic_string<" ns = ["namespace std"] numTemplateParams = 1 replaceTemplateParamIndex = [] [codegen] decl = """ template void getSizeType(const %1% &container, size_t& returnArg); """ func = """ template void getSizeType(const %1% &container, size_t& returnArg) { SAVE_SIZE(sizeof(%1%)); SAVE_DATA((uintptr_t)container.capacity()); SAVE_DATA((uintptr_t)container.size()); // Test for small string optimisation - whether the underlying string is // contained within the string object. SAVE_SIZE( isStorageInline(container) ? 0 : (container.capacity() * sizeof(T)) ); } """ extra = """ template class CaptureKeyHandler> { using DB = typename Ctx::DataBuffer; public: // List of characters using type = types::st::List>; static auto captureKey(const std::__cxx11::basic_string& key, auto returnArg) { auto tail = returnArg.write(key.size()); for (auto c : key) { tail = returnArg.write((uintptr_t)c); } return tail.finish(); } }; """ traversal_func = """ bool sso = isStorageInline(container); return returnArg.write(container.capacity()) .write(sso) .write(container.size()); """ [[codegen.processor]] type = "types::st::VarInt" func = """ uint64_t capacity = std::get(d.val).value; el.container_stats.emplace(result::Element::ContainerStats { .capacity = capacity }); """ [[codegen.processor]] type = "types::st::VarInt" func = """ bool sso = std::get(d.val).value; if (!sso) el.exclusive_size += el.container_stats->capacity * sizeof(T0); """ [[codegen.processor]] type = "types::st::VarInt" func = """ el.container_stats->length = std::get(d.val).value; """