Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.9
-
None
Description
From 826d3646f47cb856f22a10087350f551bfc8b834 Mon Sep 17 00:00:00 2001
From: David Reiss <dreiss@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.
Attachments
Attachments
1.
|
Document cpp.type | Open | Unassigned |