parent
088b995c9e
commit
57d6353a3c
4 changed files with 79 additions and 78 deletions
@ -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_ */ |
@ -1,39 +0,0 @@ |
||||
/*
|
||||
* 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 serializer 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 Joshua Haberman. See LICENSE for details. |
||||
*/ |
||||
|
||||
#ifndef UPB_SERIALIZE_H_ |
||||
#define UPB_SERIALIZE_H_ |
||||
|
||||
#include "upb.h" |
||||
#include "upb_sink.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
size_t upb_get_serialized_tag_size(uint32_t fieldnum); |
||||
size_t upb_get_serialized_value_size(union upb_value v, struct upb_fielddef *f); |
||||
|
||||
struct upb_serializer; |
||||
typedef struct upb_serializer upb_serializer; |
||||
|
||||
upb_serializer *upb_serializer_new(); |
||||
void upb_serializer_free(upb_serializer *s); |
||||
|
||||
void upb_serializer_reset(upb_serializer *s, uint32_t *sizes); |
||||
upb_sink *upb_serializer_sink(upb_serializer *s); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif /* UPB_SERIALIZE_H_ */ |
Loading…
Reference in new issue