Cocoa Thrift binding patches from Andrew McGeachie

Summary: Latest updates to the Cocoa bindings


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665354 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cocoa/src/TApplicationException.m b/lib/cocoa/src/TApplicationException.m
index 1f658de..bace360 100644
--- a/lib/cocoa/src/TApplicationException.m
+++ b/lib/cocoa/src/TApplicationException.m
@@ -6,6 +6,8 @@
 - (id) initWithType: (int) type
              reason: (NSString *) reason
 {
+  mType = type;
+
   NSString * name;
   switch (type) {
   case TApplicationException_UNKNOWN_METHOD:
@@ -40,6 +42,8 @@
   int fieldType;
   int fieldID;
 
+  [protocol readStructBeginReturningName: NULL];
+
   while (true) {
     [protocol readFieldBeginReturningName: NULL
               type: &fieldType
@@ -74,6 +78,29 @@
 }
 
 
+- (void) write: (id <TProtocol>) protocol
+{
+  [protocol writeStructBeginWithName: @"TApplicationException"];
+
+  if ([self reason] != nil) {
+    [protocol writeFieldBeginWithName: @"message"
+                 type: TType_STRING
+                 fieldID: 1];
+    [protocol writeString: [self reason]];
+    [protocol writeFieldEnd];
+  }
+
+  [protocol writeFieldBeginWithName: @"type"
+               type: TType_I32
+               fieldID: 2];
+  [protocol writeI32: mType];
+  [protocol writeFieldEnd];
+
+  [protocol writeFieldStop];
+  [protocol writeStructEnd];
+}
+
+
 + (TApplicationException *) exceptionWithType: (int) type
                                       reason: (NSString *) reason
 {