Add explicit binary type to Thrift

Summary: Identical to string in all languages except Java. Java String is NOT binary-safe, so we need to use raw byte[] in that case. PHP/RUBY/Python strings are all binary safe, and C++ std::string works fine and manages memory for you so it's the safest route. Java just needs this tweak.

Reviewed By: aditya

Test Plan: Use "binary" as a type instead of String.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665099 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 019fb9d..c6f38a2 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -82,6 +82,7 @@
 %token tok_bool
 %token tok_byte
 %token tok_string
+%token tok_binary
 %token tok_slist
 %token tok_senum
 %token tok_i16
@@ -792,6 +793,11 @@
       pdebug("BaseType -> tok_string");
       $$ = g_type_string;
     }
+| tok_binary
+    {
+      pdebug("BaseType -> tok_binary");
+      $$ = g_type_binary;
+    }
 | tok_slist
     {
       pdebug("BaseType -> tok_slist");