diff options
author | Michi Henning <michi@zeroc.com> | 2009-06-11 12:51:13 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2009-06-11 12:51:13 +1000 |
commit | 91a9027ec4ea0a8607cebe00c12223f58c472b76 (patch) | |
tree | 2a9d58b2711375180a25c51e64cee8665a627cf9 /cpp/src | |
parent | Bug 3502. _fooOperations and _fooOperationsNC now get javadoc comments as well. (diff) | |
download | ice-91a9027ec4ea0a8607cebe00c12223f58c472b76.tar.bz2 ice-91a9027ec4ea0a8607cebe00c12223f58c472b76.tar.xz ice-91a9027ec4ea0a8607cebe00c12223f58c472b76.zip |
Bug 3502. Fixed @see name mangling.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 50 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.h | 13 |
2 files changed, 47 insertions, 16 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index c49b10f525e..d03ad0d8e7c 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -13,6 +13,7 @@ #include <Slice/Util.h> #include <IceUtil/Functional.h> #include <IceUtil/Iterator.h> +#include <IceUtil/StringUtil.h> #include <cstring> #include <limits> @@ -1200,6 +1201,39 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& } +// +// Turn scoped identifiers such as "::A::B" and "B::C::D" +// into "A.B" and "B.C.D", respectively. +// +string +Slice::JavaVisitor::convertScoped(const string& s) +{ + // + // Strip surrounding white space. + // + string result = IceUtilInternal::trim(s); + + // + // Delete leading "::", if any. + // + if(result.size() > 1 && result[0] == ':' && result[1] == ':') + { + result = result.substr(2); + } + + // + // Replace "::" with "." + // + string::size_type pos = result.find("::"); + while(pos != string::npos) + { + result = result.replace(pos, 2, "."); + pos = result.find("::", pos); + } + + return result; +} + StringList Slice::JavaVisitor::splitComment(const ContainedPtr& p) { @@ -1220,24 +1254,18 @@ Slice::JavaVisitor::splitComment(const ContainedPtr& p) } // - // Strip out @see sections. + // Rewrite @see sections to replace "::" with "." // const string seeTag = "@see"; StringList::iterator i = result.begin(); while(i != result.end()) { - if(i->find(seeTag) != string::npos) - { - i = result.erase(i); - while(i != result.end() && (*i)[0] != '@') - { - i = result.erase(i); - } - } - else + string::size_type pos = i->find(seeTag); + if(pos != string::npos) { - ++i; + *i = seeTag + " " + convertScoped(i->substr(pos + seeTag.size())); } + ++i; } // diff --git a/cpp/src/slice2java/Gen.h b/cpp/src/slice2java/Gen.h index 73bd5c65d7c..54369b0c0b7 100644 --- a/cpp/src/slice2java/Gen.h +++ b/cpp/src/slice2java/Gen.h @@ -66,13 +66,16 @@ protected: // // Write doc comments. // - StringList splitComment(const ContainedPtr&); - void writeDocComment(::IceUtilInternal::Output&, const ContainedPtr&, const std::string&, const std::string& = ""); - void writeDocCommentOp(::IceUtilInternal::Output&, const OperationPtr&); + static std::string convertScoped(const std::string&); + static StringList splitComment(const ContainedPtr&); + static void writeDocComment(::IceUtilInternal::Output&, const ContainedPtr&, + const std::string&, const std::string& = ""); + static void writeDocCommentOp(::IceUtilInternal::Output&, const OperationPtr&); enum ParamDir { InParam, OutParam }; - void writeDocCommentAsync(::IceUtilInternal::Output&, const OperationPtr&, ParamDir, const std::string& = ""); - void writeDocCommentParam(::IceUtilInternal::Output&, const OperationPtr&, ParamDir); + static void writeDocCommentAsync(::IceUtilInternal::Output&, const OperationPtr&, + ParamDir, const std::string& = ""); + static void writeDocCommentParam(::IceUtilInternal::Output&, const OperationPtr&, ParamDir); }; class Gen : private ::IceUtil::noncopyable |