From 92e10d829778b21cfa9d1b38242704ca1392b7ab Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 17 Feb 2009 20:28:19 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745237 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_xsd_generator.cc | 2 +- compiler/cpp/src/parse/t_program.h | 11 ----------- compiler/cpp/src/thrifty.yy | 4 +++- contrib/thrift.vim | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/compiler/cpp/src/generate/t_xsd_generator.cc b/compiler/cpp/src/generate/t_xsd_generator.cc index 10c1556a..bccec2f9 100644 --- a/compiler/cpp/src/generate/t_xsd_generator.cc +++ b/compiler/cpp/src/generate/t_xsd_generator.cc @@ -243,7 +243,7 @@ void t_xsd_generator::generate_service(t_service* tservice) { 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\""; diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h index 4e99294d..83ffbeaa 100644 --- a/compiler/cpp/src/parse/t_program.h +++ b/compiler/cpp/src/parse/t_program.h @@ -176,14 +176,6 @@ class t_program : public t_doc { 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 @@ class t_program : public t_doc { // PHP namespace std::string php_namespace_; - // XSD namespace - std::string xsd_namespace_; - }; #endif diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy index f27e9ab9..24f4edac 100644 --- a/compiler/cpp/src/thrifty.yy +++ b/compiler/cpp/src/thrifty.yy @@ -350,11 +350,13 @@ Header: 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. */ diff --git a/contrib/thrift.vim b/contrib/thrift.vim index e350a4ee..04d6a10f 100644 --- a/contrib/thrift.vim +++ b/contrib/thrift.vim @@ -32,7 +32,7 @@ syn match thriftNumber "-\=\<\d\+\>" contained " 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 -- 2.17.1