Classes | Macros | Functions
def_to_proto.c File Reference
#include "upb/util/def_to_proto.h"
#include <inttypes.h>
#include <setjmp.h>
#include <stdio.h>
#include "upb/reflection.h"
#include "upb/port_def.inc"
Include dependency graph for def_to_proto.c:

Go to the source code of this file.

Classes

struct  upb_ToProto_Context
 

Macros

#define CHK_OOM(val)   if (!(val)) UPB_LONGJMP(ctx->err, 1);
 
#define SET_OPTIONS(proto, desc_type, options_type, src)
 

Functions

static upb_StringView default_bytes (upb_ToProto_Context *ctx, upb_StringView val)
 
static upb_StringView default_string (upb_ToProto_Context *ctx, const upb_FieldDef *f)
 
static google_protobuf_EnumDescriptorProtoenumdef_toproto (upb_ToProto_Context *ctx, const upb_EnumDef *e)
 
static google_protobuf_EnumValueDescriptorProtoenumvaldef_toproto (upb_ToProto_Context *ctx, const upb_EnumValueDef *e)
 
static google_protobuf_DescriptorProto_ExtensionRangeextrange_toproto (upb_ToProto_Context *ctx, const upb_ExtensionRange *e)
 
static google_protobuf_FieldDescriptorProtofielddef_toproto (upb_ToProto_Context *ctx, const upb_FieldDef *f)
 
static google_protobuf_FileDescriptorProtofiledef_toproto (upb_ToProto_Context *ctx, const upb_FileDef *f)
 
static google_protobuf_MethodDescriptorProtomethoddef_toproto (upb_ToProto_Context *ctx, const upb_MethodDef *m)
 
static google_protobuf_DescriptorProtomsgdef_toproto (upb_ToProto_Context *ctx, const upb_MessageDef *m)
 
static google_protobuf_OneofDescriptorProtooneofdef_toproto (upb_ToProto_Context *ctx, const upb_OneofDef *o)
 
static upb_StringView printf_dup (upb_ToProto_Context *ctx, const char *fmt,...)
 
static upb_StringView qual_dup (upb_ToProto_Context *ctx, const char *s)
 
static google_protobuf_ServiceDescriptorProtoservicedef_toproto (upb_ToProto_Context *ctx, const upb_ServiceDef *s)
 
static upb_StringView strviewdup (upb_ToProto_Context *ctx, const char *s)
 
static upb_StringView strviewdup2 (upb_ToProto_Context *ctx, upb_StringView str)
 
google_protobuf_EnumDescriptorProtoupb_EnumDef_ToProto (const upb_EnumDef *e, upb_Arena *a)
 
google_protobuf_EnumValueDescriptorProtoupb_EnumValueDef_ToProto (const upb_EnumValueDef *e, upb_Arena *a)
 
google_protobuf_FieldDescriptorProtoupb_FieldDef_ToProto (const upb_FieldDef *f, upb_Arena *a)
 
google_protobuf_FileDescriptorProtoupb_FileDef_ToProto (const upb_FileDef *f, upb_Arena *a)
 
static bool upb_isprint (char ch)
 
google_protobuf_DescriptorProtoupb_MessageDef_ToProto (const upb_MessageDef *m, upb_Arena *a)
 
google_protobuf_MethodDescriptorProtoupb_MethodDef_ToProto (const upb_MethodDef *m, upb_Arena *a)
 
google_protobuf_OneofDescriptorProtoupb_OneofDef_ToProto (const upb_OneofDef *o, upb_Arena *a)
 
google_protobuf_ServiceDescriptorProtoupb_ServiceDef_ToProto (const upb_ServiceDef *s, upb_Arena *a)
 

Macro Definition Documentation

◆ CHK_OOM

#define CHK_OOM (   val)    if (!(val)) UPB_LONGJMP(ctx->err, 1);

Definition at line 44 of file def_to_proto.c.

◆ SET_OPTIONS

#define SET_OPTIONS (   proto,
  desc_type,
  options_type,
  src 
)
Value:
{ \
size_t size; \
/* MEM: could use a temporary arena here instead. */ \
char* pb = \
google_protobuf_##options_type##_serialize(src, ctx->arena, &size); \
CHK_OOM(pb); \
google_protobuf_##options_type* dst = \
google_protobuf_##options_type##_parse(pb, size, ctx->arena); \
CHK_OOM(dst); \
google_protobuf_##desc_type##_set_options(proto, dst); \
}

Definition at line 49 of file def_to_proto.c.

Function Documentation

◆ default_bytes()

static upb_StringView default_bytes ( upb_ToProto_Context ctx,
upb_StringView  val 
)
static

Definition at line 99 of file def_to_proto.c.

◆ default_string()

static upb_StringView default_string ( upb_ToProto_Context ctx,
const upb_FieldDef f 
)
static

Definition at line 124 of file def_to_proto.c.

◆ enumdef_toproto()

static google_protobuf_EnumDescriptorProto* enumdef_toproto ( upb_ToProto_Context ctx,
const upb_EnumDef e 
)
static

Definition at line 249 of file def_to_proto.c.

◆ enumvaldef_toproto()

static google_protobuf_EnumValueDescriptorProto* enumvaldef_toproto ( upb_ToProto_Context ctx,
const upb_EnumValueDef e 
)
static

Definition at line 230 of file def_to_proto.c.

◆ extrange_toproto()

Definition at line 278 of file def_to_proto.c.

◆ fielddef_toproto()

static google_protobuf_FieldDescriptorProto* fielddef_toproto ( upb_ToProto_Context ctx,
const upb_FieldDef f 
)
static

Definition at line 157 of file def_to_proto.c.

◆ filedef_toproto()

static google_protobuf_FileDescriptorProto* filedef_toproto ( upb_ToProto_Context ctx,
const upb_FileDef f 
)
static

Definition at line 420 of file def_to_proto.c.

◆ methoddef_toproto()

static google_protobuf_MethodDescriptorProto* methoddef_toproto ( upb_ToProto_Context ctx,
const upb_MethodDef m 
)
static

Definition at line 363 of file def_to_proto.c.

◆ msgdef_toproto()

static google_protobuf_DescriptorProto* msgdef_toproto ( upb_ToProto_Context ctx,
const upb_MessageDef m 
)
static

Definition at line 297 of file def_to_proto.c.

◆ oneofdef_toproto()

static google_protobuf_OneofDescriptorProto* oneofdef_toproto ( upb_ToProto_Context ctx,
const upb_OneofDef o 
)
static

Definition at line 213 of file def_to_proto.c.

◆ printf_dup()

static upb_StringView printf_dup ( upb_ToProto_Context ctx,
const char *  fmt,
  ... 
)
static

Definition at line 84 of file def_to_proto.c.

◆ qual_dup()

static upb_StringView qual_dup ( upb_ToProto_Context ctx,
const char *  s 
)
static

Definition at line 74 of file def_to_proto.c.

◆ servicedef_toproto()

static google_protobuf_ServiceDescriptorProto* servicedef_toproto ( upb_ToProto_Context ctx,
const upb_ServiceDef s 
)
static

Definition at line 395 of file def_to_proto.c.

◆ strviewdup()

static upb_StringView strviewdup ( upb_ToProto_Context ctx,
const char *  s 
)
static

Definition at line 70 of file def_to_proto.c.

◆ strviewdup2()

static upb_StringView strviewdup2 ( upb_ToProto_Context ctx,
upb_StringView  str 
)
static

Definition at line 62 of file def_to_proto.c.

◆ upb_EnumDef_ToProto()

google_protobuf_EnumDescriptorProto* upb_EnumDef_ToProto ( const upb_EnumDef e,
upb_Arena a 
)

Definition at line 511 of file def_to_proto.c.

◆ upb_EnumValueDef_ToProto()

google_protobuf_EnumValueDescriptorProto* upb_EnumValueDef_ToProto ( const upb_EnumValueDef e,
upb_Arena a 
)

Definition at line 518 of file def_to_proto.c.

◆ upb_FieldDef_ToProto()

google_protobuf_FieldDescriptorProto* upb_FieldDef_ToProto ( const upb_FieldDef f,
upb_Arena a 
)

Definition at line 525 of file def_to_proto.c.

◆ upb_FileDef_ToProto()

google_protobuf_FileDescriptorProto* upb_FileDef_ToProto ( const upb_FileDef f,
upb_Arena a 
)

Definition at line 539 of file def_to_proto.c.

◆ upb_isprint()

static bool upb_isprint ( char  ch)
static

Definition at line 97 of file def_to_proto.c.

◆ upb_MessageDef_ToProto()

google_protobuf_DescriptorProto* upb_MessageDef_ToProto ( const upb_MessageDef m,
upb_Arena a 
)

Definition at line 504 of file def_to_proto.c.

◆ upb_MethodDef_ToProto()

google_protobuf_MethodDescriptorProto* upb_MethodDef_ToProto ( const upb_MethodDef m,
upb_Arena a 
)

Definition at line 546 of file def_to_proto.c.

◆ upb_OneofDef_ToProto()

google_protobuf_OneofDescriptorProto* upb_OneofDef_ToProto ( const upb_OneofDef o,
upb_Arena a 
)

Definition at line 532 of file def_to_proto.c.

◆ upb_ServiceDef_ToProto()

google_protobuf_ServiceDescriptorProto* upb_ServiceDef_ToProto ( const upb_ServiceDef s,
upb_Arena a 
)

Definition at line 553 of file def_to_proto.c.

ctx::arena
upb_Arena * arena
Definition: conformance_upb.c:84
dst
static const char dst[]
Definition: test-fs-copyfile.c:37
ctx
Definition: benchmark-async.c:30
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:10