xref: /aosp_15_r20/external/grpc-grpc/src/core/ext/upb-gen/google/protobuf/timestamp.upb.h (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1 /* This file was generated by upb_generator from the input file:
2  *
3  *     google/protobuf/timestamp.proto
4  *
5  * Do not edit -- your changes will be discarded when the file is
6  * regenerated. */
7 
8 #ifndef GOOGLE_PROTOBUF_TIMESTAMP_PROTO_UPB_H_
9 #define GOOGLE_PROTOBUF_TIMESTAMP_PROTO_UPB_H_
10 
11 #include "upb/generated_code_support.h"
12 
13 #include "google/protobuf/timestamp.upb_minitable.h"
14 
15 // Must be last.
16 #include "upb/port/def.inc"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 typedef struct google_protobuf_Timestamp { upb_Message UPB_PRIVATE(base); } google_protobuf_Timestamp;
23 
24 
25 
26 /* google.protobuf.Timestamp */
27 
google_protobuf_Timestamp_new(upb_Arena * arena)28 UPB_INLINE google_protobuf_Timestamp* google_protobuf_Timestamp_new(upb_Arena* arena) {
29   return (google_protobuf_Timestamp*)_upb_Message_New(&google__protobuf__Timestamp_msg_init, arena);
30 }
google_protobuf_Timestamp_parse(const char * buf,size_t size,upb_Arena * arena)31 UPB_INLINE google_protobuf_Timestamp* google_protobuf_Timestamp_parse(const char* buf, size_t size, upb_Arena* arena) {
32   google_protobuf_Timestamp* ret = google_protobuf_Timestamp_new(arena);
33   if (!ret) return NULL;
34   if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__Timestamp_msg_init, NULL, 0, arena) !=
35       kUpb_DecodeStatus_Ok) {
36     return NULL;
37   }
38   return ret;
39 }
google_protobuf_Timestamp_parse_ex(const char * buf,size_t size,const upb_ExtensionRegistry * extreg,int options,upb_Arena * arena)40 UPB_INLINE google_protobuf_Timestamp* google_protobuf_Timestamp_parse_ex(const char* buf, size_t size,
41                            const upb_ExtensionRegistry* extreg,
42                            int options, upb_Arena* arena) {
43   google_protobuf_Timestamp* ret = google_protobuf_Timestamp_new(arena);
44   if (!ret) return NULL;
45   if (upb_Decode(buf, size, UPB_UPCAST(ret), &google__protobuf__Timestamp_msg_init, extreg, options,
46                  arena) != kUpb_DecodeStatus_Ok) {
47     return NULL;
48   }
49   return ret;
50 }
google_protobuf_Timestamp_serialize(const google_protobuf_Timestamp * msg,upb_Arena * arena,size_t * len)51 UPB_INLINE char* google_protobuf_Timestamp_serialize(const google_protobuf_Timestamp* msg, upb_Arena* arena, size_t* len) {
52   char* ptr;
53   (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__Timestamp_msg_init, 0, arena, &ptr, len);
54   return ptr;
55 }
google_protobuf_Timestamp_serialize_ex(const google_protobuf_Timestamp * msg,int options,upb_Arena * arena,size_t * len)56 UPB_INLINE char* google_protobuf_Timestamp_serialize_ex(const google_protobuf_Timestamp* msg, int options,
57                                  upb_Arena* arena, size_t* len) {
58   char* ptr;
59   (void)upb_Encode(UPB_UPCAST(msg), &google__protobuf__Timestamp_msg_init, options, arena, &ptr, len);
60   return ptr;
61 }
google_protobuf_Timestamp_clear_seconds(google_protobuf_Timestamp * msg)62 UPB_INLINE void google_protobuf_Timestamp_clear_seconds(google_protobuf_Timestamp* msg) {
63   const upb_MiniTableField field = {1, 16, 0, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
64   upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
65 }
google_protobuf_Timestamp_seconds(const google_protobuf_Timestamp * msg)66 UPB_INLINE int64_t google_protobuf_Timestamp_seconds(const google_protobuf_Timestamp* msg) {
67   int64_t default_val = (int64_t)0ll;
68   int64_t ret;
69   const upb_MiniTableField field = {1, 16, 0, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
70   _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
71                                     &default_val, &ret);
72   return ret;
73 }
google_protobuf_Timestamp_clear_nanos(google_protobuf_Timestamp * msg)74 UPB_INLINE void google_protobuf_Timestamp_clear_nanos(google_protobuf_Timestamp* msg) {
75   const upb_MiniTableField field = {2, 8, 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
76   upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
77 }
google_protobuf_Timestamp_nanos(const google_protobuf_Timestamp * msg)78 UPB_INLINE int32_t google_protobuf_Timestamp_nanos(const google_protobuf_Timestamp* msg) {
79   int32_t default_val = (int32_t)0;
80   int32_t ret;
81   const upb_MiniTableField field = {2, 8, 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
82   _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
83                                     &default_val, &ret);
84   return ret;
85 }
86 
google_protobuf_Timestamp_set_seconds(google_protobuf_Timestamp * msg,int64_t value)87 UPB_INLINE void google_protobuf_Timestamp_set_seconds(google_protobuf_Timestamp *msg, int64_t value) {
88   const upb_MiniTableField field = {1, 16, 0, kUpb_NoSub, 3, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
89   _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
90 }
google_protobuf_Timestamp_set_nanos(google_protobuf_Timestamp * msg,int32_t value)91 UPB_INLINE void google_protobuf_Timestamp_set_nanos(google_protobuf_Timestamp *msg, int32_t value) {
92   const upb_MiniTableField field = {2, 8, 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
93   _upb_Message_SetNonExtensionField((upb_Message *)msg, &field, &value);
94 }
95 
96 #ifdef __cplusplus
97 }  /* extern "C" */
98 #endif
99 
100 #include "upb/port/undef.inc"
101 
102 #endif  /* GOOGLE_PROTOBUF_TIMESTAMP_PROTO_UPB_H_ */
103