So what is the right way of getting either a standard string or flatbuffers string out of Offset<flatbuffers::String>?
To be more specific, I am getting a chuck on data off the wire:
//Schema
union MyFBData{
UnionTypeA, UnionTypeB, UnionTypeC...
}
table UnionTypeA{ vector_of_strings: [string]; }
table UnionTypeB{ name: string; id:uint; }
table UnionTypeC{ vector_of_Bs: [UnionTypeB]; }
//Code
struct my_data{ char data[500]; }
callback(my_data &data){
auto my_obj = GetMyFBData(my_data.data);
switch(my_obj->unioned_type()){
case UnionTypeA:
process( reinterpret_case<const UnionTypeA*> my_obj->unioned() );
break;
case ...
}
}
process(UnionTypeA a){
for(auto &elem : a->vector_of_strings() ){
//I expect elem will be of type flatbuffers::Offset<flatbuffers::String>
print_string(elem);//<<== I CAN'T PRINT AN OFFSET
}
process_whole_vector_of_strings(???);//<<==NOT EFFECIENT, BUT HOW DO I GET VEC<STR>?
}
...
Perhaps you could start a wiki on github and a page for such snippets? Adding code to the repo is obviously not trivial and non-code description in forums isn't always as helpful to those new to this. With a wiki, others could contribute as well.