THRIFT-920. cpp: C++ Test and Tutorial does not compile anymore due to the change within Enum handling

Patch: Roger Meier and Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1001826 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/cpp/Thrift-test.mk b/test/cpp/Thrift-test.mk
index fb3e38b..97f0dec 100644
--- a/test/cpp/Thrift-test.mk
+++ b/test/cpp/Thrift-test.mk
@@ -59,16 +59,16 @@
 	$(THRIFT) --gen cpp ../ThriftTest.thrift
 
 server-debug: stubs
-	g++ -o TestServer $(DCFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp ../ThriftTest_extras.cpp
+	g++ -o TestServer $(DCFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp $(thrift_home)/lib/cpp/test/ThriftTest_extras.cpp
 
 client-debug: stubs
-	g++ -o TestClient $(DCFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp ../ThriftTest_extras.cpp
+	g++ -o TestClient $(DCFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp $(thrift_home)/lib/cpp/test/ThriftTest_extras.cpp
 
 server: stubs
-	g++ -o TestServer $(CFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp ../ThriftTest_extras.cpp
+	g++ -o TestServer $(CFL) src/TestServer.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp $(thrift_home)/lib/cpp/test/ThriftTest_extras.cpp
 
 client: stubs
-	g++ -o TestClient $(CFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp ../ThriftTest_extras.cpp
+	g++ -o TestClient $(CFL) src/TestClient.cpp ./gen-cpp/ThriftTest.cpp ./gen-cpp/ThriftTest_types.cpp $(thrift_home)/lib/cpp/test/ThriftTest_extras.cpp
 
 small:
 	$(THRIFT) --gen cpp ../SmallTest.thrift
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 5ddfa06..4764a4c 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -297,23 +297,23 @@
      * ENUM TEST
      */
     printf("testEnum(ONE)");
-    Numberz ret = testClient.testEnum(ONE);
+    Numberz::type ret = testClient.testEnum(Numberz::ONE);
     printf(" = %d\n", ret);
 
     printf("testEnum(TWO)");
-    ret = testClient.testEnum(TWO);
+    ret = testClient.testEnum(Numberz::TWO);
     printf(" = %d\n", ret);
 
     printf("testEnum(THREE)");
-    ret = testClient.testEnum(THREE);
+    ret = testClient.testEnum(Numberz::THREE);
     printf(" = %d\n", ret);
 
     printf("testEnum(FIVE)");
-    ret = testClient.testEnum(FIVE);
+    ret = testClient.testEnum(Numberz::FIVE);
     printf(" = %d\n", ret);
 
     printf("testEnum(EIGHT)");
-    ret = testClient.testEnum(EIGHT);
+    ret = testClient.testEnum(Numberz::EIGHT);
     printf(" = %d\n", ret);
 
     /**
@@ -345,7 +345,7 @@
      * INSANITY TEST
      */
     Insanity insane;
-    insane.userMap.insert(make_pair(FIVE, 5000));
+    insane.userMap.insert(make_pair(Numberz::FIVE, 5000));
     Xtruct truck;
     truck.string_thing = "Truck";
     truck.byte_thing = 8;
@@ -353,19 +353,19 @@
     truck.i64_thing = 8;
     insane.xtructs.push_back(truck);
     printf("testInsanity()");
-    map<UserId, map<Numberz,Insanity> > whoa;
+    map<UserId, map<Numberz::type,Insanity> > whoa;
     testClient.testInsanity(whoa, insane);
     printf(" = {");
-    map<UserId, map<Numberz,Insanity> >::const_iterator i_iter;
+    map<UserId, map<Numberz::type,Insanity> >::const_iterator i_iter;
     for (i_iter = whoa.begin(); i_iter != whoa.end(); ++i_iter) {
       printf("%"PRId64" => {", i_iter->first);
-      map<Numberz,Insanity>::const_iterator i2_iter;
+      map<Numberz::type,Insanity>::const_iterator i2_iter;
       for (i2_iter = i_iter->second.begin();
            i2_iter != i_iter->second.end();
            ++i2_iter) {
         printf("%d => {", i2_iter->first);
-        map<Numberz, UserId> userMap = i2_iter->second.userMap;
-        map<Numberz, UserId>::const_iterator um;
+        map<Numberz::type, UserId> userMap = i2_iter->second.userMap;
+        map<Numberz::type, UserId>::const_iterator um;
         printf("{");
         for (um = userMap.begin(); um != userMap.end(); ++um) {
           printf("%d => %"PRId64", ", um->first, um->second);
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 83454dc..d6063ac 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -138,7 +138,7 @@
     out = thing;
   }
 
-  Numberz testEnum(const Numberz thing) {
+  Numberz::type testEnum(const Numberz::type thing) {
     printf("testEnum(%d)\n", thing);
     return thing;
   }
@@ -163,7 +163,7 @@
 
   }
 
-  void testInsanity(map<UserId, map<Numberz,Insanity> > &insane, const Insanity &argument) {
+  void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) {
     printf("testInsanity()\n");
 
     Xtruct hello;
@@ -179,36 +179,36 @@
     goodbye.i64_thing = 4;
 
     Insanity crazy;
-    crazy.userMap.insert(make_pair(EIGHT, 8));
+    crazy.userMap.insert(make_pair(Numberz::EIGHT, 8));
     crazy.xtructs.push_back(goodbye);
 
     Insanity looney;
-    crazy.userMap.insert(make_pair(FIVE, 5));
+    crazy.userMap.insert(make_pair(Numberz::FIVE, 5));
     crazy.xtructs.push_back(hello);
 
-    map<Numberz, Insanity> first_map;
-    map<Numberz, Insanity> second_map;
+    map<Numberz::type, Insanity> first_map;
+    map<Numberz::type, Insanity> second_map;
 
-    first_map.insert(make_pair(TWO, crazy));
-    first_map.insert(make_pair(THREE, crazy));
+    first_map.insert(make_pair(Numberz::TWO, crazy));
+    first_map.insert(make_pair(Numberz::THREE, crazy));
 
-    second_map.insert(make_pair(SIX, looney));
+    second_map.insert(make_pair(Numberz::SIX, looney));
 
     insane.insert(make_pair(1, first_map));
     insane.insert(make_pair(2, second_map));
 
     printf("return");
     printf(" = {");
-    map<UserId, map<Numberz,Insanity> >::const_iterator i_iter;
+    map<UserId, map<Numberz::type,Insanity> >::const_iterator i_iter;
     for (i_iter = insane.begin(); i_iter != insane.end(); ++i_iter) {
       printf("%"PRId64" => {", i_iter->first);
-      map<Numberz,Insanity>::const_iterator i2_iter;
+      map<Numberz::type,Insanity>::const_iterator i2_iter;
       for (i2_iter = i_iter->second.begin();
            i2_iter != i_iter->second.end();
            ++i2_iter) {
         printf("%d => {", i2_iter->first);
-        map<Numberz, UserId> userMap = i2_iter->second.userMap;
-        map<Numberz, UserId>::const_iterator um;
+        map<Numberz::type, UserId> userMap = i2_iter->second.userMap;
+        map<Numberz::type, UserId>::const_iterator um;
         printf("{");
         for (um = userMap.begin(); um != userMap.end(); ++um) {
           printf("%d => %"PRId64", ", um->first, um->second);
@@ -232,7 +232,7 @@
 
   }
 
-  void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string>  &arg3, const Numberz arg4, const UserId arg5) {
+  void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string>  &arg3, const Numberz::type arg4, const UserId arg5) {
     printf("testMulti()\n");
 
     hello.string_thing = "Hello2";
@@ -353,7 +353,7 @@
     if (!args["workers"].empty()) {
       workerCount = atoi(args["workers"].c_str());
     }
-  } catch (exception& e) {
+  } catch (std::exception& e) {
     cerr << e.what() << endl;
     cerr << usage;
   }