Home | History | Annotate | Download | only in octave
      1 /* ------------------------------------------------------------
      2  * Overloaded operator support
      3  * ------------------------------------------------------------ */
      4 
      5 #ifdef __cplusplus
      6 
      7 // operators supported in Octave, and the methods they are routed to
      8 
      9 // __brace__      a{args}
     10 // __brace_asgn__ a{args} = rhs
     11 // __paren__      a(args)
     12 // __paren_asgn__ a(args) = rhs
     13 // __str__        generates string rep
     14 
     15 // __not__        !a
     16 // __uplus__      +a
     17 // __uminus__     -a
     18 // __transpose__  a.'
     19 // __hermitian__  a'
     20 // __incr__       a++
     21 // __decr__       a--
     22 // __add__        a + b
     23 // __sub__        a - b
     24 // __mul__        a * b
     25 // __div__        a / b
     26 // __pow__        a ^ b
     27 // __ldiv__       a \ b
     28 // __lshift__     a << b
     29 // __rshift__     a >> b
     30 // __lt__         a < b
     31 // __le__         a <= b
     32 // __eq__         a == b
     33 // __ge__         a >= b
     34 // __gt__         a > b
     35 // __ne__         a != b
     36 // __el_mul__     a .* b
     37 // __el_div__     a ./ b
     38 // __el_pow__     a .^ b
     39 // __el_ldiv__    a .\ b
     40 // __el_and__     a & b
     41 // __el_or__      a | b
     42 
     43 // operators supported in C++, and the methods that route to them
     44 
     45 %rename(__add__)       *::operator+;
     46 %rename(__add__)       *::operator+();
     47 %rename(__add__)       *::operator+() const;
     48 %rename(__sub__)       *::operator-;
     49 %rename(__uminus__)    *::operator-();
     50 %rename(__uminus__)    *::operator-() const;
     51 %rename(__mul__)       *::operator*;
     52 %rename(__div__)       *::operator/;
     53 %rename(__mod__)       *::operator%;
     54 %rename(__lshift__)    *::operator<<;
     55 %rename(__rshift__)    *::operator>>;
     56 %rename(__el_and__)    *::operator&&;
     57 %rename(__el_or__)     *::operator||;
     58 %rename(__xor__)       *::operator^;
     59 %rename(__invert__)    *::operator~;
     60 %rename(__lt__)        *::operator<;
     61 %rename(__le__)        *::operator<=;
     62 %rename(__gt__)        *::operator>;
     63 %rename(__ge__)        *::operator>=;
     64 %rename(__eq__)        *::operator==;
     65 %rename(__ne__)        *::operator!=;
     66 %rename(__not__)       *::operator!;
     67 %rename(__incr__)      *::operator++;
     68 %rename(__decr__)      *::operator--;
     69 %rename(__paren__)     *::operator();
     70 %rename(__brace__)     *::operator[];
     71 
     72 // Ignored inplace operators
     73 %ignoreoperator(PLUSEQ)     operator+=;
     74 %ignoreoperator(MINUSEQ)    operator-=;
     75 %ignoreoperator(MULEQ)      operator*=;
     76 %ignoreoperator(DIVEQ)      operator/=;
     77 %ignoreoperator(MODEQ)      operator%=;
     78 %ignoreoperator(LSHIFTEQ)   operator<<=;
     79 %ignoreoperator(RSHIFTEQ)   operator>>=;
     80 %ignoreoperator(ANDEQ)      operator&=;
     81 %ignoreoperator(OREQ)       operator|=;
     82 %ignoreoperator(XOREQ)      operator^=;
     83 
     84 // Ignored operators
     85 %ignoreoperator(EQ)         operator=;
     86 %ignoreoperator(ARROWSTAR)  operator->*;
     87 
     88 #endif /* __cplusplus */
     89