diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-10-17 12:38:03 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-10-17 12:38:03 -0700 |
commit | f087326373250c76fa3b7b8e68cede0cb9af01ff (patch) | |
tree | e801ec18aba93a74b373388fc947617643da0008 /cpp/src/slice2cs/Gen.cpp | |
parent | Fix related to ICE-4847 (diff) | |
download | ice-f087326373250c76fa3b7b8e68cede0cb9af01ff.tar.bz2 ice-f087326373250c76fa3b7b8e68cede0cb9af01ff.tar.xz ice-f087326373250c76fa3b7b8e68cede0cb9af01ff.zip |
ICE-4619 - custom enumerator values
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cs/Gen.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index c93d29ecbc0..b32125284b9 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -3996,6 +3996,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) string name = fixId(p->name()); string scoped = fixId(p->scoped()); EnumeratorList enumerators = p->getEnumerators(); + const bool explicitValue = p->explicitValue(); _out << sp; emitDeprecate(p, 0, _out, "type"); @@ -4003,18 +4004,21 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) emitGeneratedCodeAttribute(); _out << nl << "public enum " << name; _out << sb; - EnumeratorList::const_iterator en = enumerators.begin(); - while(en != enumerators.end()) + for(EnumeratorList::const_iterator en = enumerators.begin(); en != enumerators.end(); ++en) { - _out << nl << fixId((*en)->name()); - if(++en != enumerators.end()) + if(en != enumerators.begin()) { _out << ','; } + _out << nl << fixId((*en)->name()); + if(explicitValue) + { + _out << " = " << (*en)->value(); + } } _out << eb; - if(_stream) + if(!p->isLocal() && _stream) { _out << sp; emitGeneratedCodeAttribute(); |