summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-02-08 09:41:55 -0500
committerBernard Normier <bernard@zeroc.com>2017-02-08 09:41:55 -0500
commitaf38cbf2ebf9c009fcea81cc316be64176da620e (patch)
tree28d6975bf5f1c4b7b89a5c24d2e1d9f1a2ba633c /cpp/src/Slice/RubyUtil.cpp
parentAdded wide char overloads of Ice::createProperties & Ice::initialize (diff)
downloadice-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/RubyUtil.cpp')
-rw-r--r--cpp/src/Slice/RubyUtil.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index 9c1a32d8e77..19cb48567c9 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -1028,7 +1028,7 @@ Slice::Ruby::CodeVisitor::visitEnum(const EnumPtr& p)
{
string scoped = p->scoped();
string name = fixIdent(p->name(), IdentToUpper);
- EnumeratorList enums = p->getEnumerators();
+ EnumeratorList enums = p->enumerators();
_out << sp << nl << "if not defined?(" << getAbsolute(p, IdentToUpper) << ')';
_out.inc();
@@ -1286,7 +1286,7 @@ Slice::Ruby::CodeVisitor::getInitializer(const DataMemberPtr& m)
EnumPtr en = EnumPtr::dynamicCast(p);
if(en)
{
- EnumeratorList enums = en->getEnumerators();
+ EnumeratorList enums = en->enumerators();
return getAbsolute(en, IdentToUpper) + "::" + fixIdent(enums.front()->name(), IdentToUpper);
}
@@ -1355,16 +1355,9 @@ Slice::Ruby::CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTr
}
else if(en)
{
- _out << getAbsolute(en, IdentToUpper) << "::";
- string::size_type colon = value.rfind(':');
- if(colon != string::npos)
- {
- _out << fixIdent(value.substr(colon + 1), IdentToUpper);
- }
- else
- {
- _out << fixIdent(value, IdentToUpper);
- }
+ EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType);
+ assert(lte);
+ _out << getAbsolute(lte, IdentToUpper);
}
else
{