From b58c6b95fa494fe7b41135efc42472dd185e6667 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Sun, 22 Apr 2007 19:44:49 +0000 Subject: attempt to create generated bindings for libzypp. Not restricted to one language. --- swig/CapMatch.i | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 swig/CapMatch.i (limited to 'swig/CapMatch.i') diff --git a/swig/CapMatch.i b/swig/CapMatch.i new file mode 100644 index 0000000..068a4a8 --- /dev/null +++ b/swig/CapMatch.i @@ -0,0 +1,57 @@ + +class CapMatch + { + enum Result { NOMATCH, MATCH, IRRELEVANT }; + + public: + + CapMatch( bool val_r ) + : _result( val_r ? MATCH : NOMATCH ) + {} + + static const CapMatch yes; + static const CapMatch no; + static const CapMatch irrelevant; + + friend bool operator==( const CapMatch & lhs, const CapMatch & rhs ) + { return lhs._result == rhs._result; } + + friend bool operator!=( const CapMatch & lhs, const CapMatch & rhs ) + { return lhs._result != rhs._result; } + + friend CapMatch operator!( const CapMatch & lhs ) + { + if ( lhs._result == CapMatch::IRRELEVANT ) + return lhs; + return !(lhs._result == CapMatch::MATCH); + } + + friend CapMatch operator&&( const CapMatch & lhs, const CapMatch & rhs ) + { + if ( lhs._result == CapMatch::IRRELEVANT ) + return rhs; + if ( rhs._result == CapMatch::IRRELEVANT ) + return lhs; + return (lhs._result == CapMatch::MATCH) + && (rhs._result == CapMatch::MATCH); + } + + friend CapMatch operator||( const CapMatch & lhs, const CapMatch & rhs ) + { + if ( lhs._result == CapMatch::IRRELEVANT ) + return rhs; + if ( rhs._result == CapMatch::IRRELEVANT ) + return lhs; + return (lhs._result == CapMatch::MATCH) + || (rhs._result == CapMatch::MATCH); + } + + friend std::ostream & operator<<( std::ostream & str, const CapMatch & obj ); + + private: + CapMatch() + : _result( IRRELEVANT ) + {} + + Result _result; + }; \ No newline at end of file -- cgit v1.2.3