summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs
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/slice2cs
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/slice2cs')
-rw-r--r--cpp/src/slice2cs/CsUtil.cpp2
-rw-r--r--cpp/src/slice2cs/Gen.cpp22
2 files changed, 7 insertions, 17 deletions
diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp
index f575eb3025e..9d62ae21ed9 100644
--- a/cpp/src/slice2cs/CsUtil.cpp
+++ b/cpp/src/slice2cs/CsUtil.cpp
@@ -1029,7 +1029,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- size_t sz = en->getEnumerators().size();
+ size_t sz = en->enumerators().size();
if(marshal)
{
out << nl << "if(" << param << ".HasValue)";
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 0008249211a..5584e48390f 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -1282,7 +1282,7 @@ Slice::CsVisitor::writeValue(const TypePtr& type)
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixId(en->scoped()) + "." + fixId((*en->getEnumerators().begin())->name());
+ return fixId(en->scoped()) + "." + fixId((*en->enumerators().begin())->name());
}
StructPtr st = StructPtr::dynamicCast(type);
@@ -1305,7 +1305,6 @@ Slice::CsVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePt
else
{
BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
- EnumPtr ep;
if(bp && bp->kind() == Builtin::KindString)
{
_out << "\"" << toStringLiteral(value, "\a\b\f\n\r\t\v\0", "", UCN, 0) << "\"";
@@ -1318,20 +1317,11 @@ Slice::CsVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePt
{
_out << value << "F";
}
- else if((ep = EnumPtr::dynamicCast(type)))
+ else if(EnumPtr::dynamicCast(type))
{
- string enumName = fixId(ep->scoped());
- string::size_type colon = value.rfind(':');
- string enumerator;
- if(colon != string::npos)
- {
- enumerator = fixId(value.substr(colon + 1));
- }
- else
- {
- enumerator = fixId(value);
- }
- _out << enumName << '.' << enumerator;
+ EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType);
+ assert(lte);
+ _out << fixId(lte->scoped());
}
else
{
@@ -3504,7 +3494,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
{
string name = fixId(p->name());
string scoped = fixId(p->scoped());
- EnumeratorList enumerators = p->getEnumerators();
+ EnumeratorList enumerators = p->enumerators();
const bool explicitValue = p->explicitValue();
_out << sp;