Adding Cocoa generator to Thrift
Summary: Thanks to Andrew McGeachie for doing this
Reviewed By: dreiss
Test Plan: No merge/build issues. Will solicit McGeachie for additions to test/cocoa in the future
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665254 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cocoa/TProtocol.h b/lib/cocoa/TProtocol.h
new file mode 100644
index 0000000..96d3af6
--- /dev/null
+++ b/lib/cocoa/TProtocol.h
@@ -0,0 +1,126 @@
+#import <Cocoa/Cocoa.h>
+
+#import "TTransport.h"
+
+
+enum {
+ TMessageType_CALL = 1,
+ TMessageType_REPLY = 2,
+ TMessageType_EXCEPTION = 3
+};
+
+enum {
+ TType_STOP = 0,
+ TType_VOID = 1,
+ TType_BOOL = 2,
+ TType_BYTE = 3,
+ TType_DOUBLE = 4,
+ TType_I16 = 6,
+ TType_I32 = 8,
+ TType_I64 = 10,
+ TType_STRING = 11,
+ TType_STRUCT = 12,
+ TType_MAP = 13,
+ TType_SET = 14,
+ TType_LIST = 15
+};
+
+
+@protocol TProtocol <NSObject>
+
+- (id <TTransport>) transport;
+
+- (void) readMessageBeginWithName: (NSString **) name
+ type: (int *) type
+ sequenceID: (int *) sequenceID;
+- (void) readMessageEnd;
+
+- (void) readStructBeginWithName: (NSString **) name;
+- (void) readStructEnd;
+
+- (void) readFieldBeginWithName: (NSString **) name
+ type: (int *) fieldType
+ fieldID: (int *) fieldID;
+- (void) readFieldEnd;
+
+- (NSString *) readString;
+
+- (BOOL) readBool;
+
+- (unsigned char) readByte;
+
+- (short) readI16;
+
+- (int32_t) readI32;
+
+- (int64_t) readI64;
+
+- (double) readDouble;
+
+- (NSData *) readBinary;
+
+- (void) readMapBeginWithKeyType: (int *) keyType
+ valueType: (int *) valueType
+ size: (int *) size;
+- (void) readMapEnd;
+
+
+- (void) readSetBeginWithElementType: (int *) elementType
+ size: (int *) size;
+- (void) readSetEnd;
+
+
+- (void) readListBeginWithElementType: (int *) elementType
+ size: (int *) size;
+- (void) readListEnd;
+
+
+- (void) writeMessageBeginWithName: (NSString *) name
+ type: (int) messageType
+ sequenceID: (int) sequenceID;
+- (void) writeMessageEnd;
+
+- (void) writeStructBeginWithName: (NSString *) name;
+- (void) writeStructEnd;
+
+- (void) writeFieldBeginWithName: (NSString *) name
+ type: (int) fieldType
+ fieldID: (int) fieldID;
+
+- (void) writeI32: (int32_t) value;
+
+- (void) writeI64: (int64_t) value;
+
+- (void) writeI16: (short) value;
+
+- (void) writeByte: (uint8_t) value;
+
+- (void) writeString: (NSString *) value;
+
+- (void) writeDouble: (double) value;
+
+- (void) writeBinary: (NSData *) data;
+
+- (void) writeFieldStop;
+
+- (void) writeFieldEnd;
+
+- (void) writeMapBeginWithKeyType: (int) keyType
+ valueType: (int) valueType
+ size: (int) size;
+- (void) writeMapEnd;
+
+
+- (void) writeSetBeginWithElementType: (int) elementType
+ size: (int) size;
+- (void) writeSetEnd;
+
+
+- (void) writeListBeginWithElementType: (int) elementType
+ size: (int) size;
+
+- (void) writeListEnd;
+
+
+@end
+