diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-08 09:41:55 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-08 09:41:55 -0500 |
commit | af38cbf2ebf9c009fcea81cc316be64176da620e (patch) | |
tree | 28d6975bf5f1c4b7b89a5c24d2e1d9f1a2ba633c /cpp/src/Slice/PythonUtil.cpp | |
parent | Added wide char overloads of Ice::createProperties & Ice::initialize (diff) | |
download | ice-af38cbf2ebf9c009fcea81cc316be64176da620e.tar.bz2 ice-af38cbf2ebf9c009fcea81cc316be64176da620e.tar.xz ice-af38cbf2ebf9c009fcea81cc316be64176da620e.zip |
Make Slice enums scoped
Add new cpp:scoped and objc:scoped metadata directives
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index f4c59dd141b..bb21315c21a 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -1653,7 +1653,7 @@ Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p) string scoped = p->scoped(); string abs = getAbsolute(p); string name = fixIdent(p->name()); - EnumeratorList enums = p->getEnumerators(); + EnumeratorList enums = p->enumerators(); EnumeratorList::iterator q; _out << sp << nl << "if " << getDictLookup(p) << ':'; @@ -1876,7 +1876,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m) EnumPtr en = EnumPtr::dynamicCast(p); if(en) { - EnumeratorList enums = en->getEnumerators(); + EnumeratorList enums = en->enumerators(); _out << getSymbol(en) << "." << fixIdent(enums.front()->name()); return; } @@ -2042,18 +2042,9 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax } else if(en) { - string enumName = getSymbol(en); - string::size_type colon = value.rfind(':'); - string enumerator; - if(colon != string::npos) - { - enumerator = fixIdent(value.substr(colon + 1)); - } - else - { - enumerator = fixIdent(value); - } - _out << enumName << '.' << enumerator; + EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType); + assert(lte); + _out << getSymbol(lte); } else { |