diff options
Diffstat (limited to 'cpp/src/slice2cs/CsUtil.cpp')
-rw-r--r-- | cpp/src/slice2cs/CsUtil.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index 9f442018932..b2cd8c4efe8 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -261,7 +261,7 @@ Slice::CsGenerator::getStaticId(const TypePtr& type) } string -Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local) +Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local, const StringList& metaData) { if(!type) { @@ -305,6 +305,19 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local) "Ice.Value" }; + if(local) + { + for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i) + { + const string clrType = "cs:type:"; + const string meta = *i; + if(meta.find(clrType) == 0) + { + return meta.substr(clrType.size()); + } + } + } + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(builtin) { @@ -2539,6 +2552,20 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) } } } + else if(DataMemberPtr::dynamicCast(cont)) + { + DataMemberPtr dataMember = DataMemberPtr::dynamicCast(cont); + StructPtr st = StructPtr::dynamicCast(dataMember->container()); + ExceptionPtr ex = ExceptionPtr::dynamicCast(dataMember->container()); + ClassDefPtr cl = ClassDefPtr::dynamicCast(dataMember->container()); + bool isLocal = (st && st->isLocal()) || (ex && ex->isLocal()) || (cl && cl->isLocal()); + static const string csTypePrefix = csPrefix + "type:"; + if(isLocal && s.find(csTypePrefix) == 0) + { + newLocalMetaData.push_back(s); + continue; + } + } static const string csAttributePrefix = csPrefix + "attribute:"; static const string csTie = csPrefix + "tie"; |