diff options
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 7aefe066ea3..8227dc8f445 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1087,7 +1087,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) string name = fixKwd(p->name()); - bool classMetaData = findMetaData(p->getMetaData()) == "class"; + bool classMetaData = findMetaData(p->getMetaData()) == "%class"; if(classMetaData) { H << sp << nl << "class " << _dllExport << name << " : public IceUtil::Shared"; @@ -1130,7 +1130,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) // Generate a one-shot constructor if the struct uses the class mapping, or if at least // one of its members has a default value. // - if(!dataMembers.empty() && (findMetaData(p->getMetaData()) == "class" || p->hasDefaultValues())) + if(!dataMembers.empty() && (findMetaData(p->getMetaData()) == "%class" || p->hasDefaultValues())) { DataMemberList::const_iterator q; vector<string> paramDecls; @@ -1194,7 +1194,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) } string dllExport; - if(findMetaData(p->getMetaData()) != "class") + if(findMetaData(p->getMetaData()) != "%class") { dllExport = _dllExport; } @@ -1303,7 +1303,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) H << eb << ';'; - if(findMetaData(p->getMetaData()) == "class") + if(findMetaData(p->getMetaData()) == "%class") { H << sp << nl << "typedef ::IceUtil::Handle< " << scoped << "> " << p->name() + "Ptr;"; } @@ -3397,11 +3397,18 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "public:" << sp; H.inc(); - if(!p->isLocal()) + // + // In C++, a nested type cannot have the same name as the enclosing type + // + if(!p->isLocal() && p->name() != "ProxyType") { H << nl << "typedef " << p->name() << "Prx ProxyType;"; } - H << nl << "typedef " << p->name() << "Ptr PointerType;"; + + if(p->name() != "PointerType") + { + H << nl << "typedef " << p->name() << "Ptr PointerType;"; + } vector<string> params; vector<string> allTypes; @@ -6098,7 +6105,7 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) { if(!p->isLocal()) { - bool classMetaData = findMetaData(p->getMetaData(), false) == "class"; + bool classMetaData = findMetaData(p->getMetaData(), false) == "%class"; string scoped = p->scoped(); H << nl << "template<>"; if(classMetaData) |