You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Tobias Weihs <To...@posteo.de> on 2020/02/12 09:44:48 UTC

Use Qt types instead of std in cpp generated code

Hello,

I’m using Qt and thrift together and I’m a bit annoyed converting Qt types to std types to transfer them over thrift and the other way around. I was looking at THRIFT-1567, cpp.type annotation and cpp:templates compiler flag and was wondering if those together would allow me use Qt types instead of std types in the generated thrift code. Unfortunately the annotations like cpp.type in the IDL files do not seem to do anything for me, nothing shows up differently in the generated code.

 

I tried running: 

thrift --out V:/thrift -verbose --gen cpp:templates "V:\thrift \stuff.thrift"

 

IDL:

struct BinaryData

{

  1 : required binary data;

} ( cpp.type = "QByteArray" )

typedef list<BinaryData> BinaryDataVector ( cpp.template = "QVector" );

or

typedef list<BinaryData> ( cpp.template = "QVector" ) BinaryDataVector;

 

 

 

Has anybody tried this? How do the annotations work, their documentation seem to be a bit non-existing. This would save me a lot of copying memory around.

 

Thanks in advance,

Tobias