object-introspection/types/pair_type.toml
2023-06-30 12:54:02 +01:00

48 lines
1.1 KiB
TOML

[info]
type_name = "std::pair"
ctype = "PAIR_TYPE"
header = "utility"
# Old:
typeName = "std::pair<"
ns = ["namespace std"]
numTemplateParams = 2
replaceTemplateParamIndex = []
[codegen]
decl = """
template<typename P, typename Q>
void getSizeType(const %1%<P,Q> &container, size_t& returnArg);
"""
func = """
template<typename P, typename Q>
void getSizeType(const %1%<P,Q> &container, size_t& returnArg)
{
SAVE_SIZE(sizeof(%1%<P,Q>) - sizeof(P) - sizeof(Q));
getSizeType(container.first, returnArg);
getSizeType(container.second, returnArg);
}
"""
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);
})
);
}
};
"""