diff options
author | Michi Henning <michi@zeroc.com> | 2007-09-19 16:42:54 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2007-09-19 16:42:54 +1000 |
commit | 1d27c5907020dc856241fe70d4cba630fd61e7b7 (patch) | |
tree | ceaeb7b86089c100c3fc908192396eada8d6c14b /cpp/src/Slice/CsUtil.cpp | |
parent | Added support for custom sequences. Unfortunately, it doesn't work. (diff) | |
download | ice-1d27c5907020dc856241fe70d4cba630fd61e7b7.tar.bz2 ice-1d27c5907020dc856241fe70d4cba630fd61e7b7.tar.xz ice-1d27c5907020dc856241fe70d4cba630fd61e7b7.zip |
Added support for sorted dictionaries.
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-x | cpp/src/Slice/CsUtil.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index 9b3d4f7575e..6db9f79c216 100755 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -193,11 +193,24 @@ Slice::CsGenerator::typeToString(const TypePtr& type) DictionaryPtr d = DictionaryPtr::dynamicCast(type); if(d) { - if(!d->hasMetaData("clr:collection")) + if(d->hasMetaData("clr:collection")) { - return "_System.Collections.Generic.Dictionary<" - + typeToString(d->keyType()) + ", " + typeToString(d->valueType()) + ">"; + return fixId(d->scoped()); } + + string prefix = "clr:generic:"; + string meta; + string typeName; + if(d->findMetaData(prefix, meta)) + { + typeName = meta.substr(prefix.size()); + } + else + { + typeName = "Dictionary"; + } + return "_System.Collections.Generic." + typeName + + "<" + typeToString(d->keyType()) + ", " + typeToString(d->valueType()) + ">"; } ContainedPtr contained = ContainedPtr::dynamicCast(type); @@ -563,14 +576,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out, DictionaryPtr d = DictionaryPtr::dynamicCast(type); if(d) { - if(!d->hasMetaData("clr:collection")) - { - typeS = fixId(d->scoped()); - } - else - { - typeS = typeToString(type); - } + typeS = fixId(d->scope()) + d->name(); } else { @@ -1568,6 +1574,14 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) { continue; } + if(s.substr(prefix.size(), 8) == "generic:") + { + string type = s.substr(prefix.size() + 8); + if(type == "SortedDictionary" || type == "SortedList") + { + continue; + } + } } cout << file << ":" << cont->line() << ": warning: " << msg << " `" << s << "'" << endl; } |