You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2013/03/22 22:19:33 UTC

git commit: THRIFT-1896 cocoa: Add TBase protocol for Cocoa Patch: Kevin Li

Updated Branches:
  refs/heads/master ff951bd56 -> e491d298f


THRIFT-1896 cocoa: Add TBase protocol for Cocoa
Patch: Kevin Li


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/e491d298
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/e491d298
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/e491d298

Branch: refs/heads/master
Commit: e491d298f09b0a3541a86fec0b9b5499bc3b7baf
Parents: ff951bd
Author: Roger Meier <ro...@apache.org>
Authored: Fri Mar 22 22:17:53 2013 +0100
Committer: Roger Meier <ro...@apache.org>
Committed: Fri Mar 22 22:18:45 2013 +0100

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_cocoa_generator.cc |    3 +-
 lib/cocoa/src/protocol/TBase.h                 |   41 +++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/e491d298/compiler/cpp/src/generate/t_cocoa_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_cocoa_generator.cc b/compiler/cpp/src/generate/t_cocoa_generator.cc
index 15311cc..b917a14 100644
--- a/compiler/cpp/src/generate/t_cocoa_generator.cc
+++ b/compiler/cpp/src/generate/t_cocoa_generator.cc
@@ -288,6 +288,7 @@ string t_cocoa_generator::cocoa_thrift_imports() {
     "#import \"TProtocolUtil.h\"\n" +
     "#import \"TProcessor.h\"\n" +
     "#import \"TObjective-C.h\"\n" +
+    "#import \"TBase.h\"\n" +
     "\n";
 
   // Include other Thrift includes
@@ -469,7 +470,7 @@ void t_cocoa_generator::generate_cocoa_struct_interface(ofstream &out,
   } else {
     out << "NSObject ";
   }
-  out << "<NSCoding> ";
+  out << "<TBase, NSCoding> ";
 
   scope_up(out);
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/e491d298/lib/cocoa/src/protocol/TBase.h
----------------------------------------------------------------------
diff --git a/lib/cocoa/src/protocol/TBase.h b/lib/cocoa/src/protocol/TBase.h
new file mode 100644
index 0000000..33037ef
--- /dev/null
+++ b/lib/cocoa/src/protocol/TBase.h
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "TProtocol.h"
+
+@protocol TBase <NSObject>
+
+/**
+ * De-serialize object from the given input protocol
+ *
+ * @param input protocol used for reading 
+ */
+- (void) read: (id <TProtocol>) inProtocol;
+
+/**
+ * Serialize object to the given protocol
+ *
+ * @param buf output protocol used for writing
+ */
+- (void) write: (id <TProtocol>) outProtocol;
+
+@end
+