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
            Reporter: Dave Watson
            Priority: Minor
         Attachments: 
0009-Thrift-cpp-Allow-alternate-classes-to-be-used-for-Th.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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to