object-introspection/types/map_seq_type.toml
Alastair Robertson 68290655b1 TypeGraph: Update container TOML files to new format
This change is fully backwards compatible with the old ContainerInfo
parser, as it is just adding new fields.

The old fields will continue to be used by legacy OICodeGen until that
is removed.

Also add a README to document the format.
2023-05-26 18:21:59 +01:00

37 lines
1.2 KiB
TOML

[info]
type_name = "folly::sorted_vector_map"
ctype = "MAP_SEQ_TYPE"
header = "folly/sorted_vector_types.h"
# Old:
typeName = "folly::sorted_vector_map<"
ns = ["namespace std", "folly::sorted_vector_map"]
numTemplateParams = 2
replaceTemplateParamIndex = []
[codegen]
decl = """
template <class Key, class Value, class Compare, class Allocator, class GrowthPolicy, class Container>
void getSizeType(const %1%<Key, Value, Compare, Allocator, GrowthPolicy, Container> &container, size_t& returnArg);
"""
func = """
template <class Key, class Value, class Compare, class Allocator, class GrowthPolicy, class Container>
void getSizeType(const %1%<Key, Value, Compare, Allocator, GrowthPolicy, Container> &container, size_t& returnArg)
{
SAVE_SIZE(sizeof(%1%<Key,Value,Compare,Allocator,GrowthPolicy,Container>));
SAVE_DATA((uintptr_t)&container);
SAVE_DATA((uintptr_t)container.capacity());
SAVE_DATA((uintptr_t)container.size());
SAVE_SIZE((container.capacity() - container.size()) * (sizeof(Key) + sizeof(Value)));
for (auto const& it : container)
{
getSizeType(it.first, returnArg);
getSizeType(it.second, returnArg);
}
}
"""