|
|
|
@ -27,10 +27,72 @@ |
|
|
|
|
|
|
|
|
|
// This disables inlining and forces all public functions to be exported to the
|
|
|
|
|
// linker. It is used to generate bindings for FFIs from other languages.
|
|
|
|
|
#ifndef UPB_BUILD_API |
|
|
|
|
#define UPB_BUILD_API |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#include "upb/mem/arena.h" |
|
|
|
|
#include "upb/collections/array.h" |
|
|
|
|
#include "upb/message/accessors.h" |
|
|
|
|
#include "upb/message/message.h" |
|
|
|
|
#include "upb/mini_table/decode.h" |
|
|
|
|
#include "upbc/upbdev.h" |
|
|
|
|
|
|
|
|
|
// Must be last.
|
|
|
|
|
#include "upb/port/def.inc" |
|
|
|
|
|
|
|
|
|
UPB_API bool upb_Array_AppendBool(upb_Array* array, bool val, |
|
|
|
|
upb_Arena* arena) { |
|
|
|
|
const upb_MessageValue mv = {.bool_val = val}; |
|
|
|
|
return upb_Array_Append(array, mv, arena); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API bool upb_Array_AppendDouble(upb_Array* array, double val, |
|
|
|
|
upb_Arena* arena) { |
|
|
|
|
const upb_MessageValue mv = {.double_val = val}; |
|
|
|
|
return upb_Array_Append(array, mv, arena); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API bool upb_Array_AppendFloat(upb_Array* array, float val, |
|
|
|
|
upb_Arena* arena) { |
|
|
|
|
const upb_MessageValue mv = {.float_val = val}; |
|
|
|
|
return upb_Array_Append(array, mv, arena); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API bool upb_Array_AppendInt32(upb_Array* array, int32_t val, |
|
|
|
|
upb_Arena* arena) { |
|
|
|
|
const upb_MessageValue mv = {.int32_val = val}; |
|
|
|
|
return upb_Array_Append(array, mv, arena); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API bool upb_Array_AppendUInt32(upb_Array* array, uint32_t val, |
|
|
|
|
upb_Arena* arena) { |
|
|
|
|
const upb_MessageValue mv = {.uint32_val = val}; |
|
|
|
|
return upb_Array_Append(array, mv, arena); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
UPB_API void upb_Array_SetBool(upb_Array* array, size_t i, bool val) { |
|
|
|
|
const upb_MessageValue mv = {.bool_val = val}; |
|
|
|
|
upb_Array_Set(array, i, mv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API void upb_Array_SetDouble(upb_Array* array, size_t i, double val) { |
|
|
|
|
const upb_MessageValue mv = {.double_val = val}; |
|
|
|
|
upb_Array_Set(array, i, mv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API void upb_Array_SetFloat(upb_Array* array, size_t i, float val) { |
|
|
|
|
const upb_MessageValue mv = {.float_val = val}; |
|
|
|
|
upb_Array_Set(array, i, mv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API void upb_Array_SetInt32(upb_Array* array, size_t i, int32_t val) { |
|
|
|
|
const upb_MessageValue mv = {.int32_val = val}; |
|
|
|
|
upb_Array_Set(array, i, mv); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UPB_API void upb_Array_SetUInt32(upb_Array* array, size_t i, uint32_t val) { |
|
|
|
|
const upb_MessageValue mv = {.uint32_val = val}; |
|
|
|
|
upb_Array_Set(array, i, mv); |
|
|
|
|
} |
|
|
|
|