object-introspection/types/shrd_ptr_type.toml

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

36 lines
718 B
TOML
Raw Normal View History

2022-12-19 14:37:51 +00:00
[info]
type_name = "std::shared_ptr"
2022-12-19 14:37:51 +00:00
ctype = "SHRD_PTR_TYPE"
header = "memory"
# Old:
typeName = "std::shared_ptr"
2022-12-19 14:37:51 +00:00
ns = ["namespace std"]
numTemplateParams = 1
2022-12-19 14:37:51 +00:00
replaceTemplateParamIndex = []
[codegen]
decl = """
template<typename T>
void getSizeType(const %1%<T> &s_ptr, size_t& returnArg);
"""
func = """
template<typename T>
void getSizeType(const %1%<T> &s_ptr, size_t& returnArg)
{
SAVE_SIZE(sizeof(%1%<T>));
if constexpr (!std::is_void<T>::value) {
2023-04-05 20:55:40 +01:00
SAVE_DATA((uintptr_t)(s_ptr.get()));
2022-12-19 14:37:51 +00:00
2023-04-05 20:55:40 +01:00
if (s_ptr && pointers.add((uintptr_t)(s_ptr.get()))) {
SAVE_DATA(1);
getSizeType(*(s_ptr.get()), returnArg);
} else {
SAVE_DATA(0);
}
2022-12-19 14:37:51 +00:00
}
}
"""