diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-02-25 18:31:22 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-02-25 18:31:22 -0800 |
commit | a75a305c77acd6800b81204f387f7a437a62fe6b (patch) | |
tree | dbd83530befface0868b7fdca37769590b61d5ed /src/upb_glue.h | |
parent | abfc897b50532e5ed64f7f5497f80ef56abd3b26 (diff) |
Implemented upb_stringsink, upb_msgtotext, and exposed the latter to Lua.
Diffstat (limited to 'src/upb_glue.h')
-rw-r--r-- | src/upb_glue.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/upb_glue.h b/src/upb_glue.h index ca32436..afb7b59 100644 --- a/src/upb_glue.h +++ b/src/upb_glue.h @@ -4,8 +4,8 @@ * upb's core components like upb_decoder and upb_msg are carefully designed to * avoid depending on each other for maximum orthogonality. In other words, * you can use a upb_decoder to decode into *any* kind of structure; upb_msg is - * just one such structure. You can use upb_decoder without having to link in - * upb_msg. + * just one such structure. A upb_msg can be serialized/deserialized into any + * format, protobuf binary format is just one such format. * * However, for convenience we provide functions here for doing common * operations like deserializing protobuf binary format into a upb_msg. The @@ -13,12 +13,20 @@ * which could be undesirable if you're trying to use a trimmed-down build of * upb. * + * While these routines are convenient, they do not reuse any encoding/decoding + * state. For example, if a decoder is JIT-based, it will be re-JITted every + * time these functions are called. For this reason, if you are parsing lots + * of data and efficiency is an issue, these may not be the best functions to + * use (though they are useful for prototyping, before optimizing). + * * Copyright (c) 2011 Joshua Haberman. See LICENSE for details. */ #ifndef UPB_GLUE_H #define UPB_GLUE_H +#include <stdbool.h> + #ifdef __cplusplus extern "C" { #endif @@ -36,6 +44,9 @@ struct _upb_symtab; void upb_strtomsg(struct _upb_string *str, struct _upb_msg *msg, struct _upb_msgdef *md, struct _upb_status *s); +void upb_msgtotext(struct _upb_string *str, struct _upb_msg *msg, + struct _upb_msgdef *md, bool single_line); + void upb_parsedesc(struct _upb_symtab *symtab, struct _upb_string *str, struct _upb_status *status); |