From: Mark Slee Date: Fri, 19 Jan 2007 22:12:10 +0000 (+0000) Subject: Thrift XSD generator populates PHP globals with type names for typedeffed stuffs X-Git-Tag: 0.2.0~1539 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=eb08f9e6802949238f523836cf853a2a1dab6aba;p=common%2Fthrift.git Thrift XSD generator populates PHP globals with type names for typedeffed stuffs Reviewed By: dave git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664933 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/generate/t_xsd_generator.cc b/compiler/cpp/src/generate/t_xsd_generator.cc index 5d4cfa20..b7114404 100644 --- a/compiler/cpp/src/generate/t_xsd_generator.cc +++ b/compiler/cpp/src/generate/t_xsd_generator.cc @@ -7,9 +7,19 @@ using namespace std; void t_xsd_generator::init_generator() { // Make output directory mkdir(T_XSD_DIR, S_IREAD | S_IWRITE | S_IEXEC); + + // Make output file + string f_php_name = string(T_XSD_DIR)+"/"+program_->get_name()+"_xsd.php"; + f_php_.open(f_php_name.c_str()); + + f_php_ << + "" << endl; + f_php_.close(); } void t_xsd_generator::generate_typedef(t_typedef* ttypedef) { @@ -78,6 +88,7 @@ void t_xsd_generator::generate_element(ostream& out, } else { subname = type_name(subtype); } + f_php_ << "$GLOBALS['" << program_->get_name() << "_xsd_elt_" << name << "'] = '" << subname << "';" << endl; generate_element(out, subname, subtype); indent_down(); indent(out) << "" << endl; diff --git a/compiler/cpp/src/generate/t_xsd_generator.h b/compiler/cpp/src/generate/t_xsd_generator.h index 35bcf933..0f6a41b8 100644 --- a/compiler/cpp/src/generate/t_xsd_generator.h +++ b/compiler/cpp/src/generate/t_xsd_generator.h @@ -54,9 +54,10 @@ class t_xsd_generator : public t_generator { std::string base_type_name(t_base_type::t_base tbase); /** - * Output xsd file + * Output xsd/php file */ std::ofstream f_xsd_; + std::ofstream f_php_; /** * Output string stream