Author: dreiss
Date: Tue Jan  6 11:49:33 2009
New Revision: 732081

URL: http://svn.apache.org/viewvc?rev=732081&view=rev
Log:
THRIFT-129. csharp: Make all Thrift structures extend TBase

Added:
    incubator/thrift/trunk/lib/csharp/src/Protocol/TBase.cs
Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc
    incubator/thrift/trunk/lib/csharp/src/Thrift.csproj

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc?rev=732081&r1=732080&r2=732081&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc 
(original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc Tue 
Jan  6 11:49:33 2009
@@ -387,18 +387,18 @@
 
 void t_csharp_generator::generate_csharp_struct_definition(ofstream &out, 
t_struct* tstruct, bool is_exception, bool in_class, bool is_result) {
 
-  if (!in_class)
-  {
+  if (!in_class) {
     start_csharp_namespace(out);
   }
 
   out << endl;
   indent(out) << "[Serializable]" << endl;
-  indent(out) << "public class " << tstruct->get_name() << " ";
+  indent(out) << "public class " << tstruct->get_name() << " : ";
 
   if (is_exception) {
-    out << ": Exception ";
+    out << "Exception, ";
   }
+  out << "TBase";
 
   out << endl;
 

Added: incubator/thrift/trunk/lib/csharp/src/Protocol/TBase.cs
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/csharp/src/Protocol/TBase.cs?rev=732081&view=auto
==============================================================================
--- incubator/thrift/trunk/lib/csharp/src/Protocol/TBase.cs (added)
+++ incubator/thrift/trunk/lib/csharp/src/Protocol/TBase.cs Tue Jan  6 11:49:33 
2009
@@ -0,0 +1,23 @@
+//
+//  TBase.cs
+//
+//  Distributed under the Thrift Software License
+//
+//  See accompanying file LICENSE or visit the Thrift site at:
+//  http://developers.facebook.com/thrift/using
+
+namespace Thrift.Protocol
+{
+       public interface TBase
+       {
+               ///
+               /// Reads the TObject from the given input protocol.
+               ///
+               void Read(TProtocol tProtocol);
+
+               ///
+               /// Writes the objects out to the protocol
+               ///
+               void Write(TProtocol tProtocol);
+       }
+}

Modified: incubator/thrift/trunk/lib/csharp/src/Thrift.csproj
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/csharp/src/Thrift.csproj?rev=732081&r1=732080&r2=732081&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/csharp/src/Thrift.csproj (original)
+++ incubator/thrift/trunk/lib/csharp/src/Thrift.csproj Tue Jan  6 11:49:33 2009
@@ -46,6 +46,7 @@
     <Reference Include="System.Xml.Linq" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Protocol\TBase.cs" />
     <Compile Include="Protocol\TBinaryProtocol.cs" />
     <Compile Include="Protocol\TField.cs" />
     <Compile Include="Protocol\TList.cs" />


Reply via email to