From bbff4a8e7e2a4280462d649f1ac794e2283f074a Mon Sep 17 00:00:00 2001 From: Bryan Duxbury Date: Fri, 3 Sep 2010 20:36:02 +0000 Subject: [PATCH] Fix to the catch-all namespace commit git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@992458 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/parse/t_program.h | 38 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h index daad6b99..320d1f09 100644 --- a/compiler/cpp/src/parse/t_program.h +++ b/compiler/cpp/src/parse/t_program.h @@ -160,28 +160,30 @@ class t_program : public t_doc { // Language neutral namespace / packaging void set_namespace(std::string language, std::string name_space) { - size_t sub_index = language.find('.'); - std::string base_language = language.substr(0, sub_index); - std::string sub_namespace; - - if(base_language == "smalltalk") { - pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead"); - base_language = "st"; - } + if (language != "*") { + size_t sub_index = language.find('.'); + std::string base_language = language.substr(0, sub_index); + std::string sub_namespace; + + if(base_language == "smalltalk") { + pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead"); + base_language = "st"; + } - t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map(); + t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map(); - t_generator_registry::gen_map_t::iterator it; - it=my_copy.find(base_language); + t_generator_registry::gen_map_t::iterator it; + it=my_copy.find(base_language); - if (it == my_copy.end()) { - throw "No generator named '" + base_language + "' could be found!"; - } + if (it == my_copy.end()) { + throw "No generator named '" + base_language + "' could be found!"; + } - if (sub_index != std::string::npos) { - std::string sub_namespace = language.substr(sub_index+1); - if(! it->second->is_valid_namespace(sub_namespace)) { - throw base_language +" generator does not accept '" + sub_namespace + "' as sub-namespace!"; + if (sub_index != std::string::npos) { + std::string sub_namespace = language.substr(sub_index+1); + if(! it->second->is_valid_namespace(sub_namespace)) { + throw base_language +" generator does not accept '" + sub_namespace + "' as sub-namespace!"; + } } } -- 2.17.1