1 /* This file was generated by upbc (the upb compiler) from the input
2 * file:
3 *
4 * google/protobuf/duration.proto
5 *
6 * Do not edit -- your changes will be discarded when the file is
7 * regenerated. */
8
9 #ifndef GOOGLE_PROTOBUF_DURATION_PROTO_UPB_H_
10 #define GOOGLE_PROTOBUF_DURATION_PROTO_UPB_H_
11
12 #include "upb/collections/array_internal.h"
13 #include "upb/collections/map_gencode_util.h"
14 #include "upb/message/accessors.h"
15 #include "upb/message/internal.h"
16 #include "upb/mini_table/enum_internal.h"
17 #include "upb/wire/decode.h"
18 #include "upb/wire/decode_fast.h"
19 #include "upb/wire/encode.h"
20
21 // Must be last.
22 #include "upb/port/def.inc"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 typedef struct google_protobuf_Duration google_protobuf_Duration;
29 extern const upb_MiniTable google_protobuf_Duration_msg_init;
30
31
32
33 /* google.protobuf.Duration */
34
google_protobuf_Duration_new(upb_Arena * arena)35 UPB_INLINE google_protobuf_Duration* google_protobuf_Duration_new(upb_Arena* arena) {
36 return (google_protobuf_Duration*)_upb_Message_New(&google_protobuf_Duration_msg_init, arena);
37 }
google_protobuf_Duration_parse(const char * buf,size_t size,upb_Arena * arena)38 UPB_INLINE google_protobuf_Duration* google_protobuf_Duration_parse(const char* buf, size_t size, upb_Arena* arena) {
39 google_protobuf_Duration* ret = google_protobuf_Duration_new(arena);
40 if (!ret) return NULL;
41 if (upb_Decode(buf, size, ret, &google_protobuf_Duration_msg_init, NULL, 0, arena) != kUpb_DecodeStatus_Ok) {
42 return NULL;
43 }
44 return ret;
45 }
google_protobuf_Duration_parse_ex(const char * buf,size_t size,const upb_ExtensionRegistry * extreg,int options,upb_Arena * arena)46 UPB_INLINE google_protobuf_Duration* google_protobuf_Duration_parse_ex(const char* buf, size_t size,
47 const upb_ExtensionRegistry* extreg,
48 int options, upb_Arena* arena) {
49 google_protobuf_Duration* ret = google_protobuf_Duration_new(arena);
50 if (!ret) return NULL;
51 if (upb_Decode(buf, size, ret, &google_protobuf_Duration_msg_init, extreg, options, arena) !=
52 kUpb_DecodeStatus_Ok) {
53 return NULL;
54 }
55 return ret;
56 }
google_protobuf_Duration_serialize(const google_protobuf_Duration * msg,upb_Arena * arena,size_t * len)57 UPB_INLINE char* google_protobuf_Duration_serialize(const google_protobuf_Duration* msg, upb_Arena* arena, size_t* len) {
58 char* ptr;
59 (void)upb_Encode(msg, &google_protobuf_Duration_msg_init, 0, arena, &ptr, len);
60 return ptr;
61 }
google_protobuf_Duration_serialize_ex(const google_protobuf_Duration * msg,int options,upb_Arena * arena,size_t * len)62 UPB_INLINE char* google_protobuf_Duration_serialize_ex(const google_protobuf_Duration* msg, int options,
63 upb_Arena* arena, size_t* len) {
64 char* ptr;
65 (void)upb_Encode(msg, &google_protobuf_Duration_msg_init, options, arena, &ptr, len);
66 return ptr;
67 }
google_protobuf_Duration_clear_seconds(google_protobuf_Duration * msg)68 UPB_INLINE void google_protobuf_Duration_clear_seconds(google_protobuf_Duration* msg) {
69 const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
70 _upb_Message_ClearNonExtensionField(msg, &field);
71 }
google_protobuf_Duration_seconds(const google_protobuf_Duration * msg)72 UPB_INLINE int64_t google_protobuf_Duration_seconds(const google_protobuf_Duration* msg) {
73 int64_t default_val = (int64_t)0ll;
74 int64_t ret;
75 const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
76 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
77 return ret;
78 }
google_protobuf_Duration_clear_nanos(google_protobuf_Duration * msg)79 UPB_INLINE void google_protobuf_Duration_clear_nanos(google_protobuf_Duration* msg) {
80 const upb_MiniTableField field = {2, 0, 0, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
81 _upb_Message_ClearNonExtensionField(msg, &field);
82 }
google_protobuf_Duration_nanos(const google_protobuf_Duration * msg)83 UPB_INLINE int32_t google_protobuf_Duration_nanos(const google_protobuf_Duration* msg) {
84 int32_t default_val = (int32_t)0;
85 int32_t ret;
86 const upb_MiniTableField field = {2, 0, 0, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
87 _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
88 return ret;
89 }
90
google_protobuf_Duration_set_seconds(google_protobuf_Duration * msg,int64_t value)91 UPB_INLINE void google_protobuf_Duration_set_seconds(google_protobuf_Duration *msg, int64_t value) {
92 const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
93 _upb_Message_SetNonExtensionField(msg, &field, &value);
94 }
google_protobuf_Duration_set_nanos(google_protobuf_Duration * msg,int32_t value)95 UPB_INLINE void google_protobuf_Duration_set_nanos(google_protobuf_Duration *msg, int32_t value) {
96 const upb_MiniTableField field = {2, 0, 0, kUpb_NoSub, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
97 _upb_Message_SetNonExtensionField(msg, &field, &value);
98 }
99
100 extern const upb_MiniTableFile google_protobuf_duration_proto_upb_file_layout;
101
102 #ifdef __cplusplus
103 } /* extern "C" */
104 #endif
105
106 #include "upb/port/undef.inc"
107
108 #endif /* GOOGLE_PROTOBUF_DURATION_PROTO_UPB_H_ */
109