test operator aliases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8278 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c4337c7356
commit
7e4e3c84cf
1 changed files with 7 additions and 5 deletions
|
|
@ -10,7 +10,9 @@ see bottom for a set of possible tests
|
||||||
%warnfilter(SWIGWARN_IGNORE_OPERATOR_EQ,
|
%warnfilter(SWIGWARN_IGNORE_OPERATOR_EQ,
|
||||||
SWIGWARN_IGNORE_OPERATOR_INDEX,
|
SWIGWARN_IGNORE_OPERATOR_INDEX,
|
||||||
SWIGWARN_IGNORE_OPERATOR_PLUSPLUS,
|
SWIGWARN_IGNORE_OPERATOR_PLUSPLUS,
|
||||||
SWIGWARN_IGNORE_OPERATOR_MINUSMINUS);
|
SWIGWARN_IGNORE_OPERATOR_MINUSMINUS,
|
||||||
|
SWIGWARN_IGNORE_OPERATOR_LAND,
|
||||||
|
SWIGWARN_IGNORE_OPERATOR_LOR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(SWIGLUA) || !defined(SWIGPERL)
|
#if !defined(SWIGLUA) || !defined(SWIGPERL)
|
||||||
|
|
@ -35,8 +37,8 @@ see bottom for a set of possible tests
|
||||||
%rename(LessThanEqual) operator <=;
|
%rename(LessThanEqual) operator <=;
|
||||||
%rename(GreaterThan) operator >;
|
%rename(GreaterThan) operator >;
|
||||||
%rename(GreaterThanEqual) operator >=;
|
%rename(GreaterThanEqual) operator >=;
|
||||||
%rename(And) operator and;
|
%rename(And) operator &&;
|
||||||
%rename(Or) operator or;
|
%rename(Or) operator ||;
|
||||||
%rename(PlusPlusPrefix) operator++();
|
%rename(PlusPlusPrefix) operator++();
|
||||||
%rename(PlusPlusPostfix) operator++(int);
|
%rename(PlusPlusPostfix) operator++(int);
|
||||||
%rename(MinusMinusPrefix) operator--();
|
%rename(MinusMinusPrefix) operator--();
|
||||||
|
|
@ -76,7 +78,7 @@ public:
|
||||||
Op(const Op& o):i(o.i)
|
Op(const Op& o):i(o.i)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
friend Op operator and(const Op& a,const Op& b){return Op(a.i&&b.i);}
|
friend Op operator &&(const Op& a,const Op& b){return Op(a.i&&b.i);}
|
||||||
friend Op operator or(const Op& a,const Op& b){return Op(a.i||b.i);}
|
friend Op operator or(const Op& a,const Op& b){return Op(a.i||b.i);}
|
||||||
|
|
||||||
Op &operator=(const Op& o) {
|
Op &operator=(const Op& o) {
|
||||||
|
|
@ -142,7 +144,7 @@ inline bool operator>=(const Op& a,const Op& b){return a.i>=b.i;}
|
||||||
// we need to extend the class
|
// we need to extend the class
|
||||||
// to make the friends & non members part of the class
|
// to make the friends & non members part of the class
|
||||||
%extend Op{
|
%extend Op{
|
||||||
Op operator and(const Op& b){return Op(self->i&&b.i);}
|
Op operator &&(const Op& b){return Op(self->i&&b.i);}
|
||||||
Op operator or(const Op& b){return Op(self->i||b.i);}
|
Op operator or(const Op& b){return Op(self->i||b.i);}
|
||||||
|
|
||||||
Op operator+(const Op& b){return Op(self->i+b.i);}
|
Op operator+(const Op& b){return Op(self->i+b.i);}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue