OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2014 Google Inc. All rights reserved. | 2 // Copyright 2014 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 struct DescriptorPool { | 105 struct DescriptorPool { |
106 upb_symtab* symtab; | 106 upb_symtab* symtab; |
107 }; | 107 }; |
108 | 108 |
109 struct Descriptor { | 109 struct Descriptor { |
110 const upb_msgdef* msgdef; | 110 const upb_msgdef* msgdef; |
111 MessageLayout* layout; | 111 MessageLayout* layout; |
112 VALUE klass; // begins as nil | 112 VALUE klass; // begins as nil |
113 const upb_handlers* fill_handlers; | 113 const upb_handlers* fill_handlers; |
114 const upb_pbdecodermethod* fill_method; | 114 const upb_pbdecodermethod* fill_method; |
| 115 const upb_json_parsermethod* json_fill_method; |
115 const upb_handlers* pb_serialize_handlers; | 116 const upb_handlers* pb_serialize_handlers; |
116 const upb_handlers* json_serialize_handlers; | 117 const upb_handlers* json_serialize_handlers; |
| 118 const upb_handlers* json_serialize_handlers_preserve; |
117 // Handlers hold type class references for sub-message fields directly in some | 119 // Handlers hold type class references for sub-message fields directly in some |
118 // cases. We need to keep these rooted because they might otherwise be | 120 // cases. We need to keep these rooted because they might otherwise be |
119 // collected. | 121 // collected. |
120 VALUE typeclass_references; | 122 VALUE typeclass_references; |
121 }; | 123 }; |
122 | 124 |
123 struct FieldDescriptor { | 125 struct FieldDescriptor { |
124 const upb_fielddef* fielddef; | 126 const upb_fielddef* fielddef; |
125 }; | 127 }; |
126 | 128 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 VALUE Message_deep_copy(VALUE _self); | 492 VALUE Message_deep_copy(VALUE _self); |
491 VALUE Message_eq(VALUE _self, VALUE _other); | 493 VALUE Message_eq(VALUE _self, VALUE _other); |
492 VALUE Message_hash(VALUE _self); | 494 VALUE Message_hash(VALUE _self); |
493 VALUE Message_inspect(VALUE _self); | 495 VALUE Message_inspect(VALUE _self); |
494 VALUE Message_index(VALUE _self, VALUE field_name); | 496 VALUE Message_index(VALUE _self, VALUE field_name); |
495 VALUE Message_index_set(VALUE _self, VALUE field_name, VALUE value); | 497 VALUE Message_index_set(VALUE _self, VALUE field_name, VALUE value); |
496 VALUE Message_descriptor(VALUE klass); | 498 VALUE Message_descriptor(VALUE klass); |
497 VALUE Message_decode(VALUE klass, VALUE data); | 499 VALUE Message_decode(VALUE klass, VALUE data); |
498 VALUE Message_encode(VALUE klass, VALUE msg_rb); | 500 VALUE Message_encode(VALUE klass, VALUE msg_rb); |
499 VALUE Message_decode_json(VALUE klass, VALUE data); | 501 VALUE Message_decode_json(VALUE klass, VALUE data); |
500 VALUE Message_encode_json(VALUE klass, VALUE msg_rb); | 502 VALUE Message_encode_json(int argc, VALUE* argv, VALUE klass); |
501 | 503 |
502 VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj); | 504 VALUE Google_Protobuf_deep_copy(VALUE self, VALUE obj); |
503 | 505 |
504 VALUE build_module_from_enumdesc(EnumDescriptor* enumdef); | 506 VALUE build_module_from_enumdesc(EnumDescriptor* enumdef); |
505 VALUE enum_lookup(VALUE self, VALUE number); | 507 VALUE enum_lookup(VALUE self, VALUE number); |
506 VALUE enum_resolve(VALUE self, VALUE sym); | 508 VALUE enum_resolve(VALUE self, VALUE sym); |
507 | 509 |
508 const upb_pbdecodermethod *new_fillmsg_decodermethod( | 510 const upb_pbdecodermethod *new_fillmsg_decodermethod( |
509 Descriptor* descriptor, const void *owner); | 511 Descriptor* descriptor, const void *owner); |
510 | 512 |
(...skipping 16 matching lines...) Expand all Loading... |
527 | 529 |
528 #define CHECK_UPB(code, msg) do { \ | 530 #define CHECK_UPB(code, msg) do { \ |
529 upb_status status = UPB_STATUS_INIT; \ | 531 upb_status status = UPB_STATUS_INIT; \ |
530 code; \ | 532 code; \ |
531 check_upb_status(&status, msg); \ | 533 check_upb_status(&status, msg); \ |
532 } while (0) | 534 } while (0) |
533 | 535 |
534 extern ID descriptor_instancevar_interned; | 536 extern ID descriptor_instancevar_interned; |
535 | 537 |
536 #endif // __GOOGLE_PROTOBUF_RUBY_PROTOBUF_H__ | 538 #endif // __GOOGLE_PROTOBUF_RUBY_PROTOBUF_H__ |
OLD | NEW |