Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Aug 17, 2023
1 parent ee9e6dc commit 86de331
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/model/zcl_protobuf2_enum.clas.abap
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
CLASS zcl_protobuf2_enum DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES zif_protobuf2_serializable.
ENDCLASS.

CLASS zcl_protobuf2_enum IMPLEMENTATION.

METHOD zif_protobuf2_serializable~serialize.
ASSERT 1 = 'todo'.
ENDMETHOD.

ENDCLASS.
6 changes: 6 additions & 0 deletions src/model/zcl_protobuf2_field.clas.abap
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CLASS zcl_protobuf2_field DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES zif_protobuf2_serializable.

DATA mv_label TYPE string.
DATA mv_type TYPE string.
DATA mv_field_name TYPE string.
Expand All @@ -8,4 +10,8 @@ ENDCLASS.

CLASS zcl_protobuf2_field IMPLEMENTATION.

METHOD zif_protobuf2_serializable~serialize.
ASSERT 1 = 'todo'.
ENDMETHOD.

ENDCLASS.
10 changes: 10 additions & 0 deletions src/model/zcl_protobuf2_file.clas.abap
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
CLASS zcl_protobuf2_file DEFINITION PUBLIC.
PUBLIC SECTION.
* https://protobuf.dev/reference/protobuf/proto2-spec/#proto_file

INTERFACES zif_protobuf2_serializable.

DATA mt_messages TYPE STANDARD TABLE OF REF TO zcl_protobuf2_message WITH EMPTY KEY.
* DATA mt_enums TYPE STANDARD TABLE OF REF TO zcl_protobuf2_enum WITH EMPTY KEY.
ENDCLASS.

CLASS zcl_protobuf2_file IMPLEMENTATION.

METHOD zif_protobuf2_serializable~serialize.
rv_string = |syntax = "proto2";\n|.
LOOP AT mt_messages INTO DATA(lo_message).
rv_string = rv_string && lo_message->zif_protobuf2_serializable~serialize( ).
ENDLOOP.
ENDMETHOD.

ENDCLASS.
6 changes: 6 additions & 0 deletions src/model/zcl_protobuf2_message.clas.abap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CLASS zcl_protobuf2_message DEFINITION PUBLIC.
PUBLIC SECTION.
* https://protobuf.dev/reference/protobuf/proto2-spec/#message_definition
INTERFACES zif_protobuf2_serializable.
METHODS constructor IMPORTING iv_name TYPE string.
DATA mv_name TYPE string.
DATA mt_fields TYPE STANDARD TABLE OF REF TO zcl_protobuf2_field WITH EMPTY KEY.
Expand All @@ -12,4 +13,9 @@ CLASS zcl_protobuf2_message IMPLEMENTATION.
mv_name = iv_name.
ENDMETHOD.

METHOD zif_protobuf2_serializable~serialize.
ASSERT 1 = 'todo'.
* rv_string =
ENDMETHOD.

ENDCLASS.

0 comments on commit 86de331

Please sign in to comment.