Re: [protobuf] How to define Structured Binary file

2014-10-06 Thread Ilia Mirkin
Not sure what is being asked, but simply having a

bytes foo = 1;

will cause the presence of the field, the length of the field, and the
contents of the field to be encoded into the resulting binary
representation (as   ).

However enforcing maximum lengths/other data validation is up to the
application layer, not the serialization layer. At least with the way
protobufs are designed.

On Mon, Oct 6, 2014 at 8:09 PM, Marc Gravell  wrote:

> You cannot. What you describe is not what protobuf offers.
> On 7 Oct 2014 00:55, "RPMASA"  wrote:
>
>> Hi,
>>
>> I have structured binary file specifying size of each element in bytes.
>> How can I mentioned them in ptoto file?
>>
>>
>>
>>No. Description Data Value Variable Type  Number of bytes  1 A1 0=unuse,
>> 1=use byte 1  2 A2 0=unuse, 1=use byte 1  3 A3 false=unuse, true=use byte
>> 1 2-2. Object[200] - this object can contains up to 200 times
>>No. Description Data Value Variable Type  Number of bytes  1 B1 1
>> to 200 int 4  2 B2   string 40  3 B3   string 52  4 B4 0=unuse, 1=use
>> byte 1  5 B5 MMDD string 16  6 B6   string 30  7 B7 0=unuse, 1=use
>> byte 1
>>
>>
>> In above example how can I define that fields B2 is string and can have
>> up to 40 bytes of data?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at http://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] How to define Structured Binary file

2014-10-06 Thread Marc Gravell
You cannot. What you describe is not what protobuf offers.
On 7 Oct 2014 00:55, "RPMASA"  wrote:

> Hi,
>
> I have structured binary file specifying size of each element in bytes.
> How can I mentioned them in ptoto file?
>
>
>
>No. Description Data Value Variable Type  Number of bytes  1 A1 0=unuse,
> 1=use byte 1  2 A2 0=unuse, 1=use byte 1  3 A3 false=unuse, true=use byte
> 1 2-2. Object[200] - this object can contains up to 200 times
>No. Description Data Value Variable Type  Number of bytes  1 B1 1
> to 200 int 4  2 B2   string 40  3 B3   string 52  4 B4 0=unuse, 1=use byte
> 1  5 B5 MMDD string 16  6 B6   string 30  7 B7 0=unuse, 1=use byte 1
>
>
> In above example how can I define that fields B2 is string and can have up
> to 40 bytes of data?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] How to define Structured Binary file

2014-10-06 Thread RPMASA
Hi,

I have structured binary file specifying size of each element in bytes. How 
can I mentioned them in ptoto file?



   No. Description Data Value Variable Type  Number of bytes  1 A1 0=unuse, 
1=use byte 1  2 A2 0=unuse, 1=use byte 1  3 A3 false=unuse, true=use byte 1  
   2-2. Object[200] - this object can contains up to 200 times
No. Description Data Value Variable Type  Number of bytes  1 B1 1 to 200 int 
4  2 B2   string 40  3 B3   string 52  4 B4 0=unuse, 1=use byte 1  5 B5 
MMDD string 16  6 B6   string 30  7 B7 0=unuse, 1=use byte 1 
 

In above example how can I define that fields B2 is string and can have up 
to 40 bytes of data?

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.