object-introspection/types/pair_type.toml

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

68 lines
1.7 KiB
TOML
Raw Normal View History

2022-12-19 14:37:51 +00:00
[info]
type_name = "std::pair"
2022-12-19 14:37:51 +00:00
ctype = "PAIR_TYPE"
header = "utility"
# Old:
typeName = "std::pair<"
2022-12-19 14:37:51 +00:00
ns = ["namespace std"]
numTemplateParams = 2
2022-12-19 14:37:51 +00:00
replaceTemplateParamIndex = []
[codegen]
decl = """
template<typename P, typename Q>
void getSizeType(const %1%<P,Q> &container, size_t& returnArg);
2022-12-19 14:37:51 +00:00
"""
func = """
template<typename P, typename Q>
void getSizeType(const %1%<P,Q> &container, size_t& returnArg)
2022-12-19 14:37:51 +00:00
{
SAVE_SIZE(sizeof(%1%<P,Q>) - sizeof(P) - sizeof(Q));
getSizeType(container.first, returnArg);
getSizeType(container.second, returnArg);
2022-12-19 14:37:51 +00:00
}
"""
handler = """
template <typename DB, typename T0, typename T1>
struct TypeHandler<DB, %1%<T0, T1>> {
using type = types::st::Pair<DB,
typename TypeHandler<DB, T0>::type,
typename TypeHandler<DB, T1>::type>;
static types::st::Unit<DB> getSizeType(
const %1%<T0, T1> & container,
typename TypeHandler<DB, %1%<T0, T1>>::type returnArg) {
return OIInternal::getSizeType<DB>(
container.second,
returnArg.delegate([&container](auto ret) {
return OIInternal::getSizeType<DB>(container.first, ret);
})
);
}
};
"""
2023-08-16 20:40:36 +01:00
traversal_func = """
return OIInternal::getSizeType<DB>(
container.second,
returnArg.delegate([&container](auto ret) {
return OIInternal::getSizeType<DB>(container.first, ret);
})
);
"""
[[codegen.processor]]
type = "types::st::Pair<DB, typename TypeHandler<DB, T0>::type, typename TypeHandler<DB, T1>::type>"
func = """
2023-08-25 18:36:42 +01:00
static constexpr auto firstField = make_field<DB, T0>("first");
static constexpr auto secondField = make_field<DB, T1>("second");
2023-08-16 20:40:36 +01:00
el.exclusive_size = sizeof(std::pair<T0, T1>) - sizeof(T0) - sizeof(T1);
stack_ins(secondField);
stack_ins(firstField);
2023-08-16 20:40:36 +01:00
"""