Fix namespacing of included enum types in C++ generated code

Summary: If you reference enum types from an include you need to fully qualify their namespace in the generated C++ code.

Reviewed By: pfung

Test Plan: fbtypes code that pfung is using


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665345 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index b68d2fc..c465426 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -251,7 +251,7 @@
     indent(out) << name << " = " << v2 << ";" << endl <<
       endl;
   } else if (type->is_enum()) {
-    indent(out) << name << " = (" << type->get_name() << ")" << value->get_integer() << ";" << endl <<
+    indent(out) << name << " = (" << type_name(type) << ")" << value->get_integer() << ";" << endl <<
       endl;
   } else if (type->is_struct() || type->is_xception()) {
     const vector<t_field*>& fields = ((t_struct*)type)->get_members();
@@ -409,7 +409,7 @@
       if (t->is_base_type()) {
         string dval;
         if (t->is_enum()) {
-          dval += "(" + t->get_name() + ")";
+          dval += "(" + type_name(t) + ")";
         }
         dval += t->is_string() ? "\"\"" : "0";
         t_const_value* cv = (*m_iter)->get_value();
@@ -1860,7 +1860,7 @@
 
   if (!tfunction->is_async()) {
     indent_up();
-    f_service_ << 
+    f_service_ <<
       indent() << "facebook::thrift::TApplicationException x(e.what());" << endl <<
       indent() << "oprot->writeMessageBegin(\"" << tfunction->get_name() << "\", facebook::thrift::protocol::T_EXCEPTION, seqid);" << endl <<
       indent() << "x.write(oprot);" << endl <<
@@ -2203,7 +2203,7 @@
     out <<
       indent() << "int32_t " << t << ";" << endl <<
       indent() << "xfer += iprot->readI32(" << t << ");" << endl <<
-      indent() << name << " = (" << type->get_name() << ")" << t << ";" << endl;
+      indent() << name << " = (" << type_name(type) << ")" << t << ";" << endl;
   } else {
     printf("DO NOT KNOW HOW TO DESERIALIZE FIELD '%s' TYPE '%s'\n",
            tfield->get_name().c_str(), type_name(type).c_str());