diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 31 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 12 |
2 files changed, 14 insertions, 29 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 044ede63821..b7880b4ac46 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -159,22 +159,17 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData) if(seq) { string seqType = findMetaData(metaData); - if(seqType.empty()) - { - StringList l = seq->getMetaData(); - seqType = findMetaData(l); - } if(!seqType.empty()) { - TypePtr elemType = seq->type(); - string s = typeToString(elemType); if(seqType == "array") { + TypePtr elemType = seq->type(); + string s = typeToString(elemType); return "::std::pair<const " + s + "*, const " + s + "*>"; } else { - return seqType + "<" + (s[0] == ':' ? " " : "") + s + ">"; + return seqType; } } else @@ -255,22 +250,17 @@ Slice::inputTypeToString(const TypePtr& type, const StringList& metaData) if(seq) { string seqType = findMetaData(metaData); - if(seqType.empty()) - { - StringList l = seq->getMetaData(); - seqType = findMetaData(l); - } if(!seqType.empty()) { - TypePtr elemType = seq->type(); - string s = typeToString(elemType); if(seqType == "array") { + TypePtr elemType = seq->type(); + string s = typeToString(elemType); return "const ::std::pair<const " + s + "*, const " + s + "*>&"; } else { - return "const " + seqType + "<" + (s[0] == ':' ? " " : "") + s + ">&"; + return "const " + seqType + "&"; } } else @@ -328,16 +318,9 @@ Slice::outputTypeToString(const TypePtr& type, const StringList& metaData) if(seq) { string seqType = findMetaData(metaData); - if(seqType.empty()) - { - StringList l = seq->getMetaData(); - seqType = findMetaData(l); - } if(!seqType.empty() && seqType != "array") { - TypePtr elemType = seq->type(); - string s = typeToString(elemType); - return seqType + "<" + (s[0] == ':' ? " " : "") + s + ">&"; + return seqType + "&"; } else { diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 627d1d12560..761f3dce990 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -769,15 +769,17 @@ void Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) { string name = fixKwd(p->name()); - TypePtr type = p->type(); - string s = typeToString(type); + StringList metaData = p->getMetaData(); string seqType = findMetaData(metaData); - if(!seqType.empty()) + if(!seqType.empty() && seqType != "array") { - return; + H << sp << nl << "typedef " << seqType << ' ' << name << ';'; + return; } - + + TypePtr type = p->type(); + string s = typeToString(type); H << sp << nl << "typedef ::std::vector<" << (s[0] == ':' ? " " : "") << s << "> " << name << ';'; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); |