summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-12-07 23:23:48 +0100
committerJose <jose@zeroc.com>2015-12-07 23:23:48 +0100
commit3dd0d648aedc5eee3518c13f801cdb72feded33c (patch)
tree98ac1ee2097b3e888952a2804b81b64399491513 /cpp/src
parentC++11mapping: slicing/objects test fixes (diff)
downloadice-3dd0d648aedc5eee3518c13f801cdb72feded33c.tar.bz2
ice-3dd0d648aedc5eee3518c13f801cdb72feded33c.tar.xz
ice-3dd0d648aedc5eee3518c13f801cdb72feded33c.zip
C++11 mapping enum fixes
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp31
1 files changed, 4 insertions, 27 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 4ee563d740a..61da931b521 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -196,7 +196,7 @@ writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const Synt
v = value.substr(pos + 2);
scope = value.substr(0, value.size() - v.size());
}
-
+
out << fixKwd(scope + ep->name() + "::" + v);
}
}
@@ -7305,29 +7305,6 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << eb;
}
-
-namespace
-{
-
-string
-enumSizeType(IceUtil::Int64 size)
-{
- if(size <= 0xFF)
- {
- return "unsigned char";
- }
- else if(size <= 0xFFFF)
- {
- return "unsigned short";
- }
- else
- {
- return "unsigned int";
- }
-}
-
-};
-
void
Slice::Gen::Cpp11TypesVisitor::visitEnum(const EnumPtr& p)
{
@@ -7338,9 +7315,9 @@ Slice::Gen::Cpp11TypesVisitor::visitEnum(const EnumPtr& p)
H << "class ";
}
H << fixKwd(p->name());
- if(!unscoped)
+ if(!unscoped && p->maxValue() <= 0xFF)
{
- H << " : " << enumSizeType(p->maxValue());
+ H << " : unsigned char";
}
H << sb;
@@ -8568,7 +8545,7 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "static const ::std::string typeId = \"" << p->scoped() << "\";";
C << nl << "return typeId;";
C << eb;
-
+
C << sp;
C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_id() const";
C << sb;