[CC: Jon for the C# side and TVL for the ObjC side]
Hi Rob!
when you say:
> I am currently taking a object array in C# and packing that into the
ByteString.
How are you accomplishing that? I see from your example that the elements
of your array aren't proto messages, so maybe .Net has its own
serialization format that non-.Net languages aren't aware of? In that case,
the only real solution I can think of would be to formalize that
serialization by using protos. For example:
message RangeData {
int32 num_rows = 1;
int32 num_columns = 2;
repeated Row row = 3;
}
message Row {
repeated Value value = 1;
}
message Value {
oneof value {
string text = 1;
double number = 2;
}
}
or, alternatively, if you're not going to mix the strings and the numbers:
message RangeData {
repeated string row_name = 1;
repeated string column_name = 2;
repeated Row row = 3;
}
message Row {
repeated double value = 1;
}
Hope that helps,
Jorge
On Wednesday, November 11, 2015 at 9:53:11 AM UTC-8, Rob Cecil wrote:
>
> I'm using the objective-c version Protobufs.
>
> I have a .proto defined as
>
> message RangeData {
> int32 rows = 1;
> int32 columns = 2;
> bytes data = 3;
> }
>
> The server-side has been developed in C#/.Net. I'm able to successfully
> send/receive and unpack the data from the 'data' field 3 above. In the c#
> port, 'bytes' are represented by a Google protobufs "ByteString" object.
>
> In objective-c, they're represented as NSData instance.
>
> I am currently taking a object array in C# and packing that into the
> ByteString. I have a separate .Net WPF client that successfully retrieves
> the data from the ByteString instance.
>
> The object array is essentially a two-dimensional (object[,]) array
> instance whose elements can be numeric, or strings of varying length.
>
> ary[0, 0] = ""
>
> ary[0, 1] = "Jan 2010"
>
> ary[0, 2] = "Feb 2010"
>
> ...
>
> ary[0, 13] = "- Year 2010"
>
> ary[1, 0] = 89544.994
>
> ary[1, 1] = 93202.257
>
> ...
>
> ary[1, 13] = 492331.908
>
> ary[2, 0] = "Report A"
>
> ...
>
> ary[16, 13] = ...
>
>
> The number of rows and columns for this two dimensional array are passed
> in an outer (Message) context.
>
>
> What is the technique for dealing with the NSData and extracting & parsing
> back into an objective-c (or Swift) arrays?
>
>
> Are there helper classes I should be aware of to help in these scenarios?
>
>
> Thanks
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.