diff options
author | Joshua Haberman <joshua@reverberate.org> | 2010-01-15 15:24:26 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2010-01-15 15:24:26 -0800 |
commit | 57d6353a3c225cbfa523d7f15cef2691e8806741 (patch) | |
tree | 5b35296157fd34c0d5a9045449b81b7f694cba8a /src/upb_encoder.h | |
parent | 088b995c9e873178ec5761418534ed108e20c4b5 (diff) |
Rename serializer -> encoder.
Diffstat (limited to 'src/upb_encoder.h')
-rw-r--r-- | src/upb_encoder.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/upb_encoder.h b/src/upb_encoder.h new file mode 100644 index 0000000..3abd706 --- /dev/null +++ b/src/upb_encoder.h @@ -0,0 +1,39 @@ +/* + * upb - a minimalist implementation of protocol buffers. + * + * Implements a upb_sink that writes protobuf data to the binary wire format. + * + * For messages that have any submessages, the encoder needs a buffer + * containing the submessage sizes, so they can be properly written at the + * front of each message. Note that groups do *not* have this requirement. + * + * Copyright (c) 2009-2010 Joshua Haberman. See LICENSE for details. + */ + +#ifndef UPB_ENCODER_H_ +#define UPB_ENCODER_H_ + +#include "upb.h" +#include "upb_sink.h" + +#ifdef __cplusplus +extern "C" { +#endif + +size_t upb_get_encoded_tag_size(uint32_t fieldnum); +size_t upb_get_encoded_value_size(union upb_value v, struct upb_fielddef *f); + +struct upb_encoder; +typedef struct upb_encoder upb_encoder; + +upb_encoder *upb_encoder_new(); +void upb_encoder_free(upb_encoder *s); + +void upb_encoder_reset(upb_encoder *s, uint32_t *sizes); +upb_sink *upb_encoder_sink(upb_encoder *s); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* UPB_ENCODER_H_ */ |