Unittests for encode

git-svn-id: https://svn.kapsi.fi/jpa/nanopb@952 e3a754e5-d11d-0410-8d38-ebb782a927b9
This commit is contained in:
Petteri Aimonen
2011-08-10 17:54:15 +00:00
parent a8d0172507
commit 0c5bc4caf9
6 changed files with 179 additions and 32 deletions

View File

@@ -21,7 +21,7 @@
*
* 2) You can use state to store your own data (e.g. buffer pointer).
*
* 3) pb_write will update bytes_written before your callback runs.
* 3) pb_write will update bytes_written after your callback runs.
*
* 4) Your callback will be always used with the same pb_ostream_t.
* There are no substreams when encoding.
@@ -50,8 +50,10 @@ bool pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_
bool pb_encode_varint(pb_ostream_t *stream, uint64_t value);
bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, int field_number);
/* Encode tag based on LTYPE and field number defined in the field structure. */
bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field);
bool pb_encode_string(pb_ostream_t *stream, uint8_t *buffer, size_t size);
/* Write length as varint and then the contents of buffer. */
bool pb_encode_string(pb_ostream_t *stream, const uint8_t *buffer, size_t size);
/* --- Field encoders ---
* Each encoder writes the content for the field.