diff options
author | yang-g <yangg@google.com> | 2016-04-20 16:36:12 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2016-04-20 16:36:12 -0700 |
commit | 25df28ef75ba99e5d16743be7310c2920ddd8a32 (patch) | |
tree | d9f9659a5e26ef37de18ef83f5659793289dcf98 /src/compiler/cpp_plugin.cc | |
parent | 2e08941a37450b42dd21e8755e07091ea444f545 (diff) |
resolve comments
Diffstat (limited to 'src/compiler/cpp_plugin.cc')
-rw-r--r-- | src/compiler/cpp_plugin.cc | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index 6128b816a4..f1a1d80939 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -43,38 +43,7 @@ #include "src/compiler/cpp_generator_helpers.h" #include "src/compiler/generator_helpers.h" -grpc::string GenerateComments(const std::vector<grpc::string> &in) { - std::ostringstream oss; - for (const grpc::string &elem : in) { - if (elem.empty()) { - oss << "//\n"; - } else if (elem[0] == ' ') { - oss << "//" << elem << "\n"; - } else { - oss << "// " << elem << "\n"; - } - } - return oss.str(); -} - -// Get leading or trailing comments in a string. Comment lines start with "// ". -// Leading detached comments are put in in front of leading comments. -template <typename DescriptorType> -grpc::string GetComments(const DescriptorType *desc, bool leading) { - std::vector<grpc::string> out; - if (leading) { - grpc_generator::GetComment( - desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED, &out); - std::vector<grpc::string> leading; - grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING, - &leading); - out.insert(out.end(), leading.begin(), leading.end()); - } else { - grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING, - &out); - } - return GenerateComments(out); -} +using grpc_generator::GetComments; class ProtoBufMethod : public grpc_cpp_generator::Method { public: |