diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-04-20 14:48:05 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-04-20 14:48:05 +0000 |
commit | 8837da9b22449067ea3610dffbcea7fa8e014b9e (patch) | |
tree | d7c9a4029700adb7abcb5903f87cee2b1cdececf /cpp/src/slice2cppe/Gen.cpp | |
parent | Added <= > and >= operators (diff) | |
download | ice-8837da9b22449067ea3610dffbcea7fa8e014b9e.tar.bz2 ice-8837da9b22449067ea3610dffbcea7fa8e014b9e.tar.xz ice-8837da9b22449067ea3610dffbcea7fa8e014b9e.zip |
bug 700 - missing operators
Diffstat (limited to 'cpp/src/slice2cppe/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 38c9dee2872..c260e5b9579 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -741,6 +741,18 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) H << nl << _dllExport << "bool operator==(const " << name << "&) const;"; H << nl << _dllExport << "bool operator!=(const " << name << "&) const;"; H << nl << _dllExport << "bool operator<(const " << name << "&) const;"; + H << nl << _dllExport << "bool operator<=(const " << name << "& __rhs) const"; + H << sb; + H << nl << "return operator<(__rhs) || operator==(__rhs);"; + H << eb; + H << nl << _dllExport << "bool operator>(const " << name << "& __rhs) const"; + H << sb; + H << nl << "return !operator<(__rhs) && !operator==(__rhs);"; + H << eb; + H << nl << _dllExport << "bool operator>=(const " << name << "& __rhs) const"; + H << sb; + H << nl << "return !operator<(__rhs);"; + H << eb; C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator==(const " << name << "& __rhs) const"; C << sb; @@ -1243,6 +1255,9 @@ Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p) H << nl << _dllExport << "bool operator==(const " << name << "&, const " << name << "&);"; H << nl << _dllExport << "bool operator!=(const " << name << "&, const " << name << "&);"; H << nl << _dllExport << "bool operator<(const " << name << "&, const " << name << "&);"; + H << nl << _dllExport << "bool operator<=(const " << name << "&, const " << name << "&);"; + H << nl << _dllExport << "bool operator>(const " << name << "&, const " << name << "&);"; + H << nl << _dllExport << "bool operator>=(const " << name << "&, const " << name << "&);"; } Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllExport) : @@ -1382,6 +1397,24 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "return static_cast<const ::IceProxy::Ice::Object&>(l) < " << "static_cast<const ::IceProxy::Ice::Object&>(r);"; C << eb; + C << sp; + C << nl << "bool" << nl << "IceProxy" << scope << "operator<=(const ::IceProxy" << scoped + << "& l, const ::IceProxy" << scoped << "& r)"; + C << sb; + C << nl << "return l < r || l == r;"; + C << eb; + C << sp; + C << nl << "bool" << nl << "IceProxy" << scope << "operator>(const ::IceProxy" << scoped + << "& l, const ::IceProxy" << scoped << "& r)"; + C << sb; + C << nl << "return !(l < r) && !(l == r);"; + C << eb; + C << sp; + C << nl << "bool" << nl << "IceProxy" << scope << "operator>=(const ::IceProxy" << scoped + << "& l, const ::IceProxy" << scoped << "& r)"; + C << sb; + C << nl << "return !(l < r);"; + C << eb; _useWstring = resetUseWstring(_useWstringHist); } @@ -1633,6 +1666,10 @@ Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p) H << nl << _dllExport << "bool operator==(const " << name << "&, const " << name << "&);"; H << nl << _dllExport << "bool operator!=(const " << name << "&, const " << name << "&);"; H << nl << _dllExport << "bool operator<(const " << name << "&, const " << name << "&);"; + H << nl << _dllExport << "bool operator<=(const " << name << "&, const " << name << "&);"; + H << nl << _dllExport << "bool operator>(const " << name << "&, const " << name << "&);"; + H << nl << _dllExport << "bool operator>=(const " << name << "&, const " << name << "&);"; + if(!p->isLocal()) { @@ -2091,7 +2128,26 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << sb; C << nl << "return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);"; C << eb; + } + + C << sp; + C << nl << "bool" << nl << scope.substr(2) << "operator<=(const " << scoped << "& l, const " << scoped << "& r)"; + C << sb; + C << nl << "return l < r || l == r;"; + C << eb; + C << sp; + C << nl << "bool" << nl << scope.substr(2) << "operator>(const " << scoped << "& l, const " << scoped << "& r)"; + C << sb; + C << nl << "return !(l < r) && !(l == r);"; + C << eb; + C << sp; + C << nl << "bool" << nl << scope.substr(2) << "operator>=(const " << scoped << "& l, const " << scoped << "& r)"; + C << sb; + C << nl << "return !(l < r);"; + C << eb; + if(!p->isLocal()) + { C << sp << nl << "#endif // ICEE_PURE_CLIENT"; } |