You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2009/02/17 21:28:07 UTC
svn commit: r745234 - in /incubator/thrift/trunk/compiler/cpp/src:
generate/t_xsd_generator.cc generate/t_xsd_generator.h main.cc
Author: dreiss
Date: Tue Feb 17 20:28:06 2009
New Revision: 745234
URL: http://svn.apache.org/viewvc?rev=745234&view=rev
Log:
Make the XSD generator dynamic.
- Modify the XSD generator constructor to fit the new generic interface.
- Register the XSD genrator with the central registry.
- Deprecate the old way of invoking the XSD generator.
- main.cc no longer includes t_xsd_generator.h.
Modified:
incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.cc
incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.h
incubator/thrift/trunk/compiler/cpp/src/main.cc
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=745234&r1=745233&r2=745234&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:06 2009
@@ -269,3 +269,5 @@
throw "compiler error: no C++ base type name for base type " + t_base_type::t_base_name(tbase);
}
}
+
+THRIFT_REGISTER_GENERATOR(xsd, "XSD", "");
Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.h?rev=745234&r1=745233&r2=745234&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_xsd_generator.h Tue Feb 17 20:28:06 2009
@@ -19,8 +19,12 @@
*/
class t_xsd_generator : public t_generator {
public:
- t_xsd_generator(t_program* program) :
- t_generator(program) {
+ t_xsd_generator(
+ t_program* program,
+ const std::map<std::string, std::string>& parsed_options,
+ const std::string& option_string)
+ : t_generator(program)
+ {
out_dir_base_ = "gen-xsd";
}
Modified: incubator/thrift/trunk/compiler/cpp/src/main.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/main.cc?rev=745234&r1=745233&r2=745234&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/main.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/main.cc Tue Feb 17 20:28:06 2009
@@ -38,7 +38,6 @@
#include "parse/t_scope.h"
#include "generate/t_generator.h"
#include "generate/t_php_generator.h"
-#include "generate/t_xsd_generator.h"
#include "version.h"
@@ -610,7 +609,6 @@
fprintf(stderr, " -phpl Generate PHP-lite (with -php)\n");
fprintf(stderr, " -phpa Generate PHP with autoload (with -php)\n");
fprintf(stderr, " -phpo Generate PHP with object oriented subclasses (with -php)\n");
- fprintf(stderr, " -xsd Generate XSD output files\n");
fprintf(stderr, " -o dir Set the output directory for gen-* packages\n");
fprintf(stderr, " (default: current directory)\n");
fprintf(stderr, " -I dir Add a directory to the list of directories\n");
@@ -873,13 +871,6 @@
delete phpi;
}
- if (gen_xsd) {
- pverbose("Generating XSD\n");
- t_xsd_generator* xsd = new t_xsd_generator(program);
- xsd->generate_program();
- delete xsd;
- }
-
if (dump_docs) {
dump_docstrings(program);
}
@@ -1118,9 +1109,13 @@
pwarning(1, "-hs is deprecated. Use --gen hs");
generator_strings.push_back("hs");
}
+ if (gen_xsd) {
+ pwarning(1, "-xsd is deprecated. Use --gen xsd");
+ generator_strings.push_back("xsd");
+ }
// You gotta generate something!
- if (!gen_php && !gen_phpi && !gen_xsd && generator_strings.empty()) {
+ if (!gen_php && !gen_phpi && generator_strings.empty()) {
fprintf(stderr, "!!! No output language(s) specified\n\n");
usage();
}