diff options
author | Jose <jose@zeroc.com> | 2011-03-14 15:27:15 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2011-03-14 15:27:15 +0100 |
commit | 986249ba3b9cf5e9f75acf0a68ebdfce68201a0a (patch) | |
tree | fea8f1537438f037bd71609a4ddd0cb7188c7625 /cpp/src/slice2cs/Gen.cpp | |
parent | 4971 - BuiltinSequences.ice not compiled with --stream in .NET (diff) | |
download | ice-986249ba3b9cf5e9f75acf0a68ebdfce68201a0a.tar.bz2 ice-986249ba3b9cf5e9f75acf0a68ebdfce68201a0a.tar.xz ice-986249ba3b9cf5e9f75acf0a68ebdfce68201a0a.zip |
5030 - Patch for slice2cs with scoped constants
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cs/Gen.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index ea4a62b7752..dac53b55108 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -1228,6 +1228,7 @@ Slice::CsVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePt else { BuiltinPtr bp = BuiltinPtr::dynamicCast(type); + EnumPtr ep; if(bp && bp->kind() == Builtin::KindString) { // @@ -1271,17 +1272,24 @@ Slice::CsVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePt { _out << value << "F"; } - else + else if(ep = EnumPtr::dynamicCast(type)) { - EnumPtr ep = EnumPtr::dynamicCast(type); - if(ep) + string enumName = fixId(ep->scoped()); + string::size_type colon = value.rfind(':'); + string enumerator; + if(colon != string::npos) { - _out << typeToString(type) << "." << fixId(value); + enumerator = fixId(value.substr(colon + 1)); } else { - _out << value; + enumerator = fixId(value); } + _out << enumName << '.' << enumerator; + } + else + { + _out << value; } } } |