Support dynamic allocation for string, bytes and message fields.

This is turned on by passing -p to nanopb_generator.py or setting the
(nanopb).pointer option for a .proto field.

git-svn-id: https://svn.kapsi.fi/jpa/nanopb-dev@1081 e3a754e5-d11d-0410-8d38-ebb782a927b9
This commit is contained in:
Michael Poole
2011-12-20 03:30:52 +00:00
committed by Petteri Aimonen
parent 8e5337e9ef
commit c66c6b43c4
14 changed files with 403 additions and 48 deletions

View File

@@ -26,3 +26,24 @@ message CallbackContainer {
message CallbackContainerContainer {
required CallbackContainer submsg = 1;
}
message PointerContainer {
required string text = 1 [(nanopb).pointer = true];
required bytes blob = 2 [(nanopb).pointer = true];
optional PointerContainer submsg = 3 [(nanopb).pointer = true];
// This should be rejected:
// required int32 data = 4 [(nanopb).pointer = true];
repeated string rtext = 5 [(nanopb).pointer = true, (nanopb).max_count = 10];
repeated bytes rblob = 6 [(nanopb).pointer = true, (nanopb).max_count = 10];
repeated IntegerArray rsubmsg = 7 [(nanopb).pointer = true, (nanopb).max_count = 10];
optional string otext = 8 [(nanopb).pointer = true];
optional bytes oblob = 9 [(nanopb).pointer = true];
}
message RecursiveRef_A {
optional RecursiveRef_B submsg = 1 [(nanopb).pointer = true];
}
message RecursiveRef_B {
required RecursiveRef_A submsg = 1;
}