Author: dreiss
Date: Tue Feb 17 20:28:19 2009
New Revision: 745237

URL: http://svn.apache.org/viewvc?rev=745237&view=rev
Log:
Make the XSD generator use non-hardcoded namespaces.

- Make the XSD generator use program->get_namespace("xsd")
  instead of program->get_xsd_namespace()
- Eliminate the explicit "xsd_namespace" in t_program.
- Deprecate the xsd_namespace token.
- Update example .thrift files and syntax files.

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.cc
    incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h
    incubator/thrift/trunk/compiler/cpp/src/thrifty.yy
    incubator/thrift/trunk/contrib/thrift.vim

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.cc
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.cc?rev=745237&r1=745236&r2=745237&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.cc 
(original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.cc Tue Feb 
17 20:28:19 2009
@@ -243,7 +243,7 @@
   string f_xsd_name = get_out_dir()+tservice->get_name()+".xsd";
   f_xsd_.open(f_xsd_name.c_str());
 
-  string ns = program_->get_xsd_namespace();
+  string ns = program_->get_namespace("xsd");
   if (ns.size() > 0) {
     ns = " targetNamespace=\"" + ns + "\" xmlns=\"" + ns + "\" " +
       "elementFormDefault=\"qualified\"";

Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h?rev=745237&r1=745236&r2=745237&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h Tue Feb 17 
20:28:19 2009
@@ -176,14 +176,6 @@
     return php_namespace_;
   }
 
-  void set_xsd_namespace(std::string xsd_namespace) {
-    xsd_namespace_ = xsd_namespace;
-  }
-
-  const std::string& get_xsd_namespace() const {
-    return xsd_namespace_;
-  }
-
  private:
 
   // File path
@@ -225,9 +217,6 @@
   // PHP namespace
   std::string php_namespace_;
 
-  // XSD namespace
-  std::string xsd_namespace_;
-
 };
 
 #endif

Modified: incubator/thrift/trunk/compiler/cpp/src/thrifty.yy
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/thrifty.yy?rev=745237&r1=745236&r2=745237&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/thrifty.yy (original)
+++ incubator/thrift/trunk/compiler/cpp/src/thrifty.yy Tue Feb 17 20:28:19 2009
@@ -350,11 +350,13 @@
         g_program->set_namespace("cocoa", $2);
       }
     }
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
 | tok_xsd_namespace tok_literal
     {
+      pwarning(1, "'xsd_namespace' is deprecated. Use 'namespace xsd' 
instead");
       pdebug("Header -> tok_xsd_namespace tok_literal");
       if (g_parse_mode == PROGRAM) {
-        g_program->set_xsd_namespace($2);
+        g_program->set_namespace("cocoa", $2);
       }
     }
 /* TODO(dreiss): Get rid of this once everyone is using the new hotness. */

Modified: incubator/thrift/trunk/contrib/thrift.vim
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/contrib/thrift.vim?rev=745237&r1=745236&r2=745237&view=diff
==============================================================================
--- incubator/thrift/trunk/contrib/thrift.vim (original)
+++ incubator/thrift/trunk/contrib/thrift.vim Tue Feb 17 20:28:19 2009
@@ -32,7 +32,7 @@
 " Keywords
 syn keyword thriftKeyword namespace
 syn keyword thriftKeyword php_namespace
-syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_namespace 
xsd_attrs
+syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
 syn keyword thriftKeyword include cpp_include cpp_type const optional required
 syn keyword thriftBasicTypes void bool byte i16 i32 i64 double string binary
 syn keyword thriftStructure map list set struct typedef exception enum throws


Reply via email to