Code generator for C++ from YAML to generate network protocol parsers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
655 B

static std::span<<%= @out_type %>> get_<%= @name %>(const <%= class_name %>& alter) {
auto ptr = (char*)&alter;
ptr+=<%= @start %>;
return std::span<<%= @out_type %>>((<%= @out_type %>*)ptr, get_<%= @count_name %>(alter));
}
static void set_<%= @name %>(<%= class_name %>& alter, size_t index, const <%= @out_type %>& param) {
auto ptr = (char*)&alter;
ptr+=<%= @start %>;
*(<%= @out_type %>*)ptr = param;
}
static constexpr size_t <%= @name %>_position() {
return <%= @start %>;
}
static size_t <%= @name %>_end_position(<%= class_name %>& alter) {
return <%= @start %>+get_<%= @count_name %>(alter)*sizeof(<%= @out_type %>);
}