Make the Ruby generator use non-hardcoded namespaces.
- Make the Ruby generator use program->get_namespace("ruby")
instead of program->get_ruby_namespace()
- Eliminate the explicit "ruby_namespace" in t_program.
- Deprecate the ruby_namespace token.
- Update example .thrift files and syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665620 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc
index 833dfd3..395bb64 100644
--- a/compiler/cpp/src/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/generate/t_rb_generator.cc
@@ -151,7 +151,7 @@
std::vector<std::string> ruby_modules(t_program* p) {
- std::string ns = p->get_ruby_namespace();
+ std::string ns = p->get_namespace("rb");
boost::tokenizer<> tok(ns);
std::vector<std::string> modules;
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 6dcba86..b544c2f 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -184,14 +184,6 @@
return xsd_namespace_;
}
- void set_ruby_namespace(std::string ruby_namespace) {
- ruby_namespace_ = ruby_namespace;
- }
-
- const std::string& get_ruby_namespace() const {
- return ruby_namespace_;
- }
-
void set_perl_package(std::string perl_package) {
perl_package_ = perl_package;
}
@@ -244,9 +236,6 @@
// XSD namespace
std::string xsd_namespace_;
- // Ruby namespace
- std::string ruby_namespace_;
-
// Perl namespace
std::string perl_package_;
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index 53c6d81..d555f53 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -293,11 +293,13 @@
g_program->set_perl_package($2);
}
}
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
| tok_ruby_namespace tok_identifier
{
+ pwarning(1, "'ruby_namespace' is deprecated. Use 'namespace rb' instead");
pdebug("Header -> tok_ruby_namespace tok_identifier");
if (g_parse_mode == PROGRAM) {
- g_program->set_ruby_namespace($2);
+ g_program->set_namespace("rb", $2);
}
}
/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */