Code generator for C++ from YAML to generate network protocol parsers
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
552 B

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