summaryrefslogtreecommitdiffstats
path: root/docs/reference.rst
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-23 18:50:09 +0000
committerPetteri Aimonen <jpa@npb.mail.kapsi.fi>2011-08-23 18:50:09 +0000
commita3534170212675e0c7d3d89e23838e25f3664316 (patch)
tree68ab25766687892ed319fed8d6afa5f0ace44556 /docs/reference.rst
parent64ac18c8848d3071a16065c84fca3b5e7210ce95 (diff)
More unittests
git-svn-id: https://svn.kapsi.fi/jpa/nanopb@966 e3a754e5-d11d-0410-8d38-ebb782a927b9
Diffstat (limited to 'docs/reference.rst')
-rw-r--r--docs/reference.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index 2fc3d481..55ade5e3 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -37,6 +37,7 @@ PB_HTYPE_REQUIRED 0x00 Verify that field exists in decoded message.
PB_HTYPE_OPTIONAL 0x10 Use separate *has_<field>* boolean to specify
whether the field is present.
PB_HTYPE_ARRAY 0x20 A repeated field with preallocated array.
+ Separate *<field>_count* for number of items.
PB_HTYPE_CALLBACK 0x30 A field with dynamic storage size, data is
actually a pointer to a structure containing a
callback function.
@@ -183,6 +184,17 @@ Same as `pb_encode_tag`_, except takes the parameters from a *pb_field_t* struct
This function only considers the LTYPE of the field. You can use it from your field callbacks, because the source generator writes correct LTYPE also for callback type fields.
+Wire type mapping is as follows:
+
+========================= ============
+LTYPEs Wire type
+========================= ============
+VARINT, SVARINT PB_WT_VARINT
+FIXED with data_size == 8 PB_WT_64BIT
+STRING, BYTES, SUBMESSAGE PB_WT_STRING
+FIXED with data_size == 4 PB_WT_32BIT
+========================= ============
+
pb_encode_string
----------------
Writes the length of a string as varint and then contents of the string. Used for writing fields with wire type PB_WT_STRING. ::