object-introspection/types/seq_type.toml

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

35 lines
801 B
TOML
Raw Normal View History

2022-12-19 14:37:51 +00:00
[info]
typeName = "std::vector<"
numTemplateParams = 1
ctype = "SEQ_TYPE"
header = "vector"
ns = ["namespace std"]
replaceTemplateParamIndex = []
allocatorIndex = 1
# underlyingContainerIndex = 0
[codegen]
decl = """
template<typename T>
void getSizeType(const %1%<T> &container, size_t& returnArg);
"""
func = """
template<typename T>
void getSizeType(const %1%<T> &container, size_t& returnArg)
{
SAVE_SIZE(sizeof(%1%<T>));
SAVE_DATA((uintptr_t)&container);
SAVE_DATA((uintptr_t)container.capacity());
SAVE_DATA((uintptr_t)container.size());
SAVE_SIZE((container.capacity() - container.size()) * sizeof(T));
// The double ampersand is needed otherwise this loop doesn't work with vector<bool>
for (auto&& it: container) {
getSizeType(it, returnArg);
}
}
"""