[ https://issues.apache.org/jira/browse/THRIFT-1567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15848431#comment-15848431 ]
James E. King, III commented on THRIFT-1567: -------------------------------------------- I tried modifying AnnotationTest.thrift, adding a string to the foo structure; and even adding a "cpp.type" annotation to the string I added (the struct has a cpp.type annotation already, which I am not sure makes any sense). I tried compiling this with ``--gen cpp:templates`` as there is a discussion about needing templatized read/write here. None of the resulting files leverages the custom type(s) that I have tried. There is no mention of "DenseFoo" anywhere in generated code. Could someone explain how this feature is supposed to be used? > Thrift/cpp: Allow alternate classes to be used for > --------------------------------------------------- > > Key: THRIFT-1567 > URL: https://issues.apache.org/jira/browse/THRIFT-1567 > Project: Thrift > Issue Type: Improvement > Components: C++ - Library > Affects Versions: 0.9 > Reporter: Dave Watson > Assignee: David Reiss > Priority: Minor > Fix For: 0.9 > > Attachments: > 0009-Thrift-cpp-Allow-alternate-classes-to-be-used-for-Th.patch, > thrift-1567-on-trunk.txt, thrift-types-demo.patch > > > From 826d3646f47cb856f22a10087350f551bfc8b834 Mon Sep 17 00:00:00 2001 > From: David Reiss <dre...@fb.com> > Date: Fri, 10 Sep 2010 04:03:48 +0000 > Subject: [PATCH 09/12] Thrift/cpp: Allow alternate classes to be used for > Thrift strings > Summary: > The goal of this diff is to allow Thrift strings to be used without > depending on std::string, since it looks like we're starting to move > away from std::string instead of moving to a better implementation. > The challenge here is the protocol read code. Structs normally pass > std::string references to TProtocol::readString, which then populates > the string with the appropriate data. However, this can't be done with > an arbitrary class. TProtocol::readString cannot be a template function > because it is virtual. One option would be to make > TProtocol::readString take a shim object with virtual members for > populating the actual string. Another would be to require services that > use nonstandard string classes to only use template-style Thrift code. > This diff does the latter. > - Recognize templates=only as a generator option to skip the generic > process function implementations (actually just the pointers). > - Recognize "cpp.type" as a type annotation on strings to force the C++ > type used to represent them. > - Make TBinaryProtocol::readString a template method. > Test Plan: > - Ran the server under valgrind and called both methods. -- This message was sent by Atlassian JIRA (v6.3.15#6346)