Code generator for C++ from YAML to generate network protocol parsers
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

18 rader
655 B

4 år sedan
  1. static std::span<<%= @out_type %>> get_<%= @name %>(const <%= class_name %>& alter) {
  2. auto ptr = (char*)&alter;
  3. ptr+=<%= @start %>;
  4. return std::span<<%= @out_type %>>((<%= @out_type %>*)ptr, get_<%= @count_name %>(alter));
  5. }
  6. static void set_<%= @name %>(<%= class_name %>& alter, size_t index, const <%= @out_type %>& param) {
  7. auto ptr = (char*)&alter;
  8. ptr+=<%= @start %>;
  9. *(<%= @out_type %>*)ptr = param;
  10. }
  11. static constexpr size_t <%= @name %>_position() {
  12. return <%= @start %>;
  13. }
  14. static size_t <%= @name %>_end_position(<%= class_name %>& alter) {
  15. return <%= @start %>+get_<%= @count_name %>(alter)*sizeof(<%= @out_type %>);
  16. }