mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
68290655b1
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.
38 lines
973 B
TOML
38 lines
973 B
TOML
[info]
|
|
type_name = "std::set"
|
|
stub_template_params = [1,2]
|
|
ctype = "SET_TYPE"
|
|
header = "set"
|
|
|
|
# Old:
|
|
typeName = "std::set<"
|
|
ns = ["namespace std"]
|
|
numTemplateParams = 1
|
|
replaceTemplateParamIndex = [1]
|
|
allocatorIndex = 2
|
|
|
|
[codegen]
|
|
decl = """
|
|
template<typename Key, typename Compare, typename Alloc>
|
|
void getSizeType(const %1%<Key, Compare, Alloc> &container, size_t& returnArg);
|
|
"""
|
|
|
|
func = """
|
|
template<typename Key, typename Compare, typename Alloc>
|
|
void getSizeType(const %1%<Key, Compare, Alloc> &container, size_t& returnArg)
|
|
{
|
|
constexpr size_t nodeSize = sizeof(typename %1%<Key, Compare, Alloc>::node_type);
|
|
size_t numElems = container.size();
|
|
|
|
SAVE_SIZE(sizeof(%1%<Key, Compare, Alloc>) + (nodeSize * numElems));
|
|
|
|
SAVE_DATA((uintptr_t)nodeSize);
|
|
SAVE_DATA((uintptr_t)numElems);
|
|
|
|
// The double ampersand is needed otherwise this loop doesn't work with vector<bool>
|
|
for (auto&& it: container) {
|
|
getSizeType(it, returnArg);
|
|
}
|
|
}
|
|
"""
|