mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 19:19:05 +01:00
f9cb0115e1
Summary: Handlers were added in an intermediate form of tbv2 but those intermediate forms have now been removed. Remove all the handlers to make grepping/find and replaces easier across the types. Test Plan: - CI
86 lines
2.4 KiB
TOML
86 lines
2.4 KiB
TOML
[info]
|
|
type_name = "std::__cxx11::basic_string"
|
|
stub_template_params = [2]
|
|
ctype = "STRING_TYPE"
|
|
header = "string"
|
|
|
|
# Old:
|
|
typeName = "std::__cxx11::basic_string<"
|
|
ns = ["namespace std"]
|
|
numTemplateParams = 1
|
|
replaceTemplateParamIndex = []
|
|
|
|
[codegen]
|
|
decl = """
|
|
template<typename T, typename Traits, typename Allocator>
|
|
void getSizeType(const %1%<T, Traits, Allocator> &container, size_t& returnArg);
|
|
"""
|
|
|
|
func = """
|
|
template<typename T, typename Traits, typename Allocator>
|
|
void getSizeType(const %1%<T, Traits, Allocator> &container, size_t& returnArg)
|
|
{
|
|
SAVE_SIZE(sizeof(%1%<T>));
|
|
|
|
SAVE_DATA((uintptr_t)container.capacity());
|
|
SAVE_DATA((uintptr_t)container.size());
|
|
|
|
// Test for small string optimisation - whether the underlying string is
|
|
// contained within the string object.
|
|
SAVE_SIZE(
|
|
(((uintptr_t)container.data() < (uintptr_t)(&container + sizeof(%1%<T>)))
|
|
&&
|
|
((uintptr_t)container.data() >= (uintptr_t)&container))
|
|
? 0 : (container.capacity() * sizeof(T))
|
|
);
|
|
}
|
|
"""
|
|
|
|
extra = """
|
|
template <typename DB, typename CharT, typename Traits, typename Allocator>
|
|
class CaptureKeyHandler<DB, std::__cxx11::basic_string<CharT, Traits, Allocator>> {
|
|
public:
|
|
// List of characters
|
|
using type = types::st::List<DB, types::st::VarInt<DB>>;
|
|
|
|
static auto captureKey(const std::__cxx11::basic_string<CharT, Traits, Allocator>& key, auto returnArg) {
|
|
auto tail = returnArg.write(key.size());
|
|
for (auto c : key) {
|
|
tail = returnArg.write((uintptr_t)c);
|
|
}
|
|
return tail.finish();
|
|
}
|
|
};
|
|
"""
|
|
|
|
traversal_func = """
|
|
bool sso = ((uintptr_t)container.data() <
|
|
(uintptr_t)(&container + sizeof(std::__cxx11::basic_string<T0>))) &&
|
|
((uintptr_t)container.data() >= (uintptr_t)&container);
|
|
|
|
return returnArg.write(container.capacity())
|
|
.write(sso)
|
|
.write(container.size());
|
|
"""
|
|
|
|
[[codegen.processor]]
|
|
type = "types::st::VarInt<DB>"
|
|
func = """
|
|
uint64_t capacity = std::get<ParsedData::VarInt>(d.val).value;
|
|
el.container_stats.emplace(result::Element::ContainerStats { .capacity = capacity });
|
|
"""
|
|
|
|
[[codegen.processor]]
|
|
type = "types::st::VarInt<DB>"
|
|
func = """
|
|
bool sso = std::get<ParsedData::VarInt>(d.val).value;
|
|
if (!sso)
|
|
el.exclusive_size += el.container_stats->capacity * sizeof(T0);
|
|
"""
|
|
|
|
[[codegen.processor]]
|
|
type = "types::st::VarInt<DB>"
|
|
func = """
|
|
el.container_stats->length = std::get<ParsedData::VarInt>(d.val).value;
|
|
"""
|