summaryrefslogtreecommitdiff
path: root/cpp/src/slice2php/Main.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/slice2php/Main.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/slice2php/Main.cpp')
-rw-r--r--cpp/src/slice2php/Main.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp
index b0167d6a150..a948a8ad746 100644
--- a/cpp/src/slice2php/Main.cpp
+++ b/cpp/src/slice2php/Main.cpp
@@ -1021,7 +1021,7 @@ CodeVisitor::visitEnum(const EnumPtr& p)
string name = getName(p);
string type = getTypeVar(p);
string abs = getAbsolute(p, _ns);
- EnumeratorList enums = p->getEnumerators();
+ EnumeratorList enums = p->enumerators();
startNamespace(p);
@@ -1271,7 +1271,7 @@ CodeVisitor::writeDefaultValue(const DataMemberPtr& m)
EnumPtr en = EnumPtr::dynamicCast(p);
if(en)
{
- EnumeratorList enums = en->getEnumerators();
+ EnumeratorList enums = en->enumerators();
_out << getAbsolute(en, _ns) << "::" << fixIdent(enums.front()->name());
return;
}
@@ -1369,21 +1369,9 @@ CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePtr& va
}
else if(en)
{
- string val = value;
- string::size_type colon = val.rfind(':');
- if(colon != string::npos)
- {
- val = val.substr(colon + 1);
- }
- Slice::EnumeratorList l = en->getEnumerators();
- for(Slice::EnumeratorList::iterator q = l.begin(); q != l.end(); ++q)
- {
- if((*q)->name() == val)
- {
- _out << getAbsolute(en, _ns) << "::" << fixIdent(val);
- break;
- }
- }
+ EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType);
+ assert(lte);
+ _out << getAbsolute(en, _ns) << "::" << fixIdent(lte->name());
}
else
{