- Make the C++ generator use program->get_namespace("cpp")
instead of program->get_cpp_namespace()
- Eliminate the explicit "cpp_namespace" in t_program.
- Deprecate the cpp_namespace token.
- Update example .thrift files and syntax files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665513
13f79535-47bb-0310-9956-
ffa450edef68
}
// Open namespace
- ns_open_ = namespace_open(program_->get_cpp_namespace());
- ns_close_ = namespace_close(program_->get_cpp_namespace());
+ ns_open_ = namespace_open(program_->get_namespace("cpp"));
+ ns_close_ = namespace_close(program_->get_namespace("cpp"));
f_types_ <<
ns_open_ << endl <<
// Service implementation file includes
string f_skeleton_name = get_out_dir()+svcname+"_server.skeleton.cpp";
- string ns = namespace_prefix(tservice->get_program()->get_cpp_namespace());
+ string ns = namespace_prefix(tservice->get_program()->get_namespace("cpp"));
ofstream f_skeleton;
f_skeleton.open(f_skeleton_name.c_str());
if (program != NULL && program != program_) {
pname =
class_prefix +
- namespace_prefix(program->get_cpp_namespace()) +
+ namespace_prefix(program->get_namespace("cpp")) +
ttype->get_name();
} else {
pname = class_prefix + ttype->get_name();
if (external &&
ttype->get_program() != NULL &&
ttype->get_program() != program_) {
- nspace = namespace_prefix(ttype->get_program()->get_cpp_namespace());
+ nspace = namespace_prefix(ttype->get_program()->get_namespace("cpp"));
}
return nspace + "trlo_" + prefix + "_" + prog + "_" + name;
// Language specific namespace / packaging
- void set_cpp_namespace(std::string cpp_namespace) {
- cpp_namespace_ = cpp_namespace;
- }
-
- const std::string& get_cpp_namespace() const {
- return cpp_namespace_;
- }
-
void add_cpp_include(std::string path) {
cpp_includes_.push_back(path);
}
// Dynamic namespaces
std::map<std::string, std::string> namespaces_;
- // C++ namespace
- std::string cpp_namespace_;
-
// C++ extra includes
std::vector<std::string> cpp_includes_;
g_program->set_namespace($2, $3);
}
}
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
| tok_cpp_namespace tok_identifier
{
+ pwarning(1, "'cpp_namespace' is deprecated. Use 'namespace cpp' instead");
pdebug("Header -> tok_cpp_namespace tok_identifier");
if (g_parse_mode == PROGRAM) {
- g_program->set_cpp_namespace($2);
+ g_program->set_namespace("cpp", $2);
}
}
| tok_cpp_include tok_literal
-cpp_namespace yozone
+namespace cpp yozone
struct thing {
1: i32 hello,
-cpp_namespace thrift.test
+namespace cpp thrift.test
struct Doubles {
1: double nan,
then compiling this should give errors because of doubly defined symbols.
*/
-cpp_namespace thrift.test
+namespace cpp thrift.test
struct OneOfEachZZ {
1: bool im_true,
*/
java_package thrift.test
-cpp_namespace thrift.test
+namespace cpp thrift.test
// C++ comment
/* c style comment */
-cpp_namespace thrift.test
+namespace cpp thrift.test
struct OldSchool {
1: i16 im_int;
-cpp_namespace test.stress
+namespace cpp test.stress
service Service {
java_package thrift.test
-cpp_namespace thrift.test
+namespace cpp thrift.test
ruby_namespace Thrift.Test
perl_package ThriftTest
csharp_namespace Thrift.Test
10: map<i32, i32> newmap,
11: string newstring,
12: i32 end_in_both
-}
\ No newline at end of file
+}
(defconst thrift-font-lock-keywords
(list
'("#.*$" . font-lock-comment-face) ;; perl style comments
- '("\\<\\(include\\|struct\\|exception\\|typedef\\|cpp_namespace\\|java_package\\|cocoa_prefix\\|csharp_namespace\\|php_namespace\\|ruby_namespace\\|py_module\\|perl_package\\|smalltalk_category\\|smalltalk_prefix\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
+ '("\\<\\(include\\|struct\\|exception\\|typedef\\|java_package\\|cocoa_prefix\\|csharp_namespace\\|php_namespace\\|ruby_namespace\\|py_module\\|perl_package\\|smalltalk_category\\|smalltalk_prefix\\|const\\|enum\\|service\\|extends\\|void\\|async\\|throws\\|optional\\|required\\)\\>" . font-lock-keyword-face) ;; keywords
'("\\<\\(bool\\|byte\\|i16\\|i32\\|i64\\|double\\|string\\|binary\\|map\\|list\\|set\\)\\>" . font-lock-type-face) ;; built-in types
'("\\<\\([0-9]+\\)\\>" . font-lock-variable-name-face) ;; ordinals
'("\\<\\(\\w+\\)\\s-*(" (1 font-lock-function-name-face)) ;; functions
syn match thriftNumber "-\=\<\d\+\>" contained
" Keywords
-syn keyword thriftKeyword namespace cpp_namespace java_package cocoa_prefix
+syn keyword thriftKeyword namespace java_package cocoa_prefix
syn keyword thriftKeyword csharp_namespace smalltalk_category smalltalk_prefix
syn keyword thriftKeyword php_namespace ruby_namespace py_module perl_package
syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_namespace xsd_attrs
* these definitions.
*/
-cpp_namespace shared
+namespace cpp shared
java_package shared
perl_package shared
* Thrift files can namespace, package, or prefix their output in various
* target languages.
*/
-cpp_namespace tutorial
+namespace cpp tutorial
java_package tutorial
php_namespace tutorial
perl_package tutorial