From 06ad21c2f678b3a34cc103b3083be9d96647e76d Mon Sep 17 00:00:00 2001 From: Dwayne Boone Date: Mon, 20 Mar 2006 14:02:01 +0000 Subject: Imrpoved support for using array mapping in async responses and Blobject. --- cpp/src/Slice/CPlusPlusUtil.cpp | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp') diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 66cead140c3..d3f368c6817 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -236,7 +236,7 @@ Slice::returnTypeToString(const TypePtr& type, const StringList& metaData) } string -Slice::inputTypeToString(const TypePtr& type, const StringList& metaData) +Slice::inputTypeToString(const TypePtr& type, const StringList& metaData, bool allowArray) { static const char* inputBuiltinTable[] = { @@ -283,28 +283,43 @@ Slice::inputTypeToString(const TypePtr& type, const StringList& metaData) string seqType = findMetaData(metaData, true); if(!seqType.empty()) { + if(seqType == "array" || seqType == "range:array") { - TypePtr elemType = seq->type(); - string s = typeToString(elemType); - return "const ::std::pair&"; + if(allowArray) + { + TypePtr elemType = seq->type(); + string s = typeToString(elemType); + return "const ::std::pair&"; + } + else + { + return "const " + fixKwd(seq->scoped()) + "&"; + } } else if(seqType.find("range") == 0) { - string s; - if(seqType.find("range:") == 0) + if(allowArray) { - s = seqType.substr(strlen("range:")); + string s; + if(seqType.find("range:") == 0) + { + s = seqType.substr(strlen("range:")); + } + else + { + s = fixKwd(seq->scoped()); + } + if(s[0] == ':') + { + s = " " + s; + } + return "const ::std::pair<" + s + "::const_iterator, " + s + "::const_iterator>&"; } else { - s = fixKwd(seq->scoped()); - } - if(s[0] == ':') - { - s = " " + s; + return "const " + fixKwd(seq->scoped()) + "&"; } - return "const ::std::pair<" + s + "::const_iterator, " + s + "::const_iterator>&"; } else { -- cgit v1.2.3