object-introspection/types/std_unordered_map_type.toml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
TOML
Raw Normal View History

2022-12-19 14:37:51 +00:00
[info]
type_name = "std::unordered_map"
stub_template_params = [2,3,4]
2022-12-19 14:37:51 +00:00
ctype = "STD_UNORDERED_MAP_TYPE"
header = "unordered_map"
# Old:
typeName = "std::unordered_map<"
2022-12-19 14:37:51 +00:00
ns = ["namespace std"]
numTemplateParams = 2
2022-12-19 14:37:51 +00:00
replaceTemplateParamIndex = [2, 3]
allocatorIndex = 4
[codegen]
decl = """
template<class K, class T, class H, class KE, class A>
void getSizeType(const %1%<K, T, H, KE, A> &container, size_t& returnArg);
"""
func = """
template<class K, class T, class H, class KE, class A>
void getSizeType(const %1%<K, T, H, KE, A> &container, size_t& returnArg)
{
constexpr size_t nodeSize = sizeof(typename %1%<K, T, H, KE, A>::node_type);
size_t bucketCount = container.bucket_count();
size_t numElems = container.size();
SAVE_SIZE(sizeof(%1%<K, T, H, KE, A>) + (nodeSize * numElems) + (bucketCount * sizeof(uintptr_t)));
SAVE_DATA((uintptr_t)nodeSize);
SAVE_DATA((uintptr_t)bucketCount);
SAVE_DATA((uintptr_t)numElems);
for (auto const& it : container)
{
getSizeType(it.first, returnArg);
getSizeType(it.second, returnArg);
}
}
"""