summaryrefslogtreecommitdiff
path: root/swig/CapMatch.i
diff options
context:
space:
mode:
authorDuncan Mac-Vicar P <dmacvicar@suse.de>2007-04-22 19:44:49 +0000
committerDuncan Mac-Vicar P <dmacvicar@suse.de>2007-04-22 19:44:49 +0000
commitb58c6b95fa494fe7b41135efc42472dd185e6667 (patch)
tree62a03993cde278e0e089cc2d67530a8624703d62 /swig/CapMatch.i
downloadlibzypp-bindings-b58c6b95fa494fe7b41135efc42472dd185e6667.tar.gz
libzypp-bindings-b58c6b95fa494fe7b41135efc42472dd185e6667.tar.bz2
libzypp-bindings-b58c6b95fa494fe7b41135efc42472dd185e6667.zip
attempt to create generated bindings for
libzypp. Not restricted to one language.
Diffstat (limited to 'swig/CapMatch.i')
-rw-r--r--swig/CapMatch.i57
1 files changed, 57 insertions, 0 deletions
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