Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
375 B
18 lines
375 B
6 years ago
|
|
||
|
#include <time.h>
|
||
|
|
||
|
#include "foo.upb.h"
|
||
|
|
||
|
int main() {
|
||
|
upb_arena *arena = upb_arena_new();
|
||
|
Foo* foo = Foo_new(arena);
|
||
|
const char greeting[] = "Hello, World!\n";
|
||
|
|
||
|
Foo_set_time(foo, time(NULL));
|
||
|
/* Warning: the proto will not copy this, the string data must outlive
|
||
|
* the proto. */
|
||
|
Foo_set_greeting(foo, upb_strview_makez(greeting));
|
||
|
|
||
|
upb_arena_free(arena);
|
||
|
}
|