From 3dd0d648aedc5eee3518c13f801cdb72feded33c Mon Sep 17 00:00:00 2001 From: Jose Date: Mon, 7 Dec 2015 23:23:48 +0100 Subject: C++11 mapping enum fixes --- cpp/src/slice2cpp/Gen.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') 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; -- cgit v1.2.3