Author: kkaempf Date: Thu Feb 14 15:15:03 2008 New Revision: 8688 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8688&view=rev Log: expose Repokey types as real Ruby types in Ruby. Nice ! Modified: trunk/sat-solver/bindings/satsolver.i Modified: trunk/sat-solver/bindings/satsolver.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/satsolver.i?rev=8688&r1=8687&r2=8688&view=diff ============================================================================== --- trunk/sat-solver/bindings/satsolver.i (original) +++ trunk/sat-solver/bindings/satsolver.i Thu Feb 14 15:15:03 2008 @@ -568,11 +568,47 @@ return my_id2str( $self->repodata->repo->pool, key->name ); } /* type of key */ +#if defined(SWIGRUBY) + VALUE type() + { + Repokey *key = xrepokey_repokey( $self ); + VALUE type = Qnil; + switch( key->type ) + { + case TYPE_VOID: type = rb_cNilClass; break; + case TYPE_ID: type = rb_cString; break; + case TYPE_IDARRAY: type = rb_cArray; break; + case TYPE_STR: type = rb_cString; break; + case TYPE_U32: type = rb_cInteger; break; + case TYPE_REL_IDARRAY: type = rb_cArray; break; + + case TYPE_ATTR_INT: type = rb_cInteger; break; + case TYPE_ATTR_CHUNK: type = rb_cString; break; + case TYPE_ATTR_STRING: type = rb_cString; break; + case TYPE_ATTR_INTLIST: type = rb_cArray; break; + case TYPE_ATTR_LOCALIDS: type = rb_cString; break; + + case TYPE_COUNT_NAMED: type = rb_cInteger; break; + case TYPE_COUNTED: type = rb_cInteger; break; + + case TYPE_IDVALUEARRAY: type = rb_cArray; break; + + case TYPE_DIR: type = rb_cDir; break; + case TYPE_DIRNUMNUMARRAY: type = rb_cArray; break; + case TYPE_DIRSTRARRAY: type = rb_cArray; break; + + case TYPE_CONSTANT: type = rb_cInteger; break; + case TYPE_NUM: type = rb_cNumeric; break; + } + return type; + } +#else int type() { Repokey *key = xrepokey_repokey( $self ); return key->type; } +#endif /* size of key */ int size() { -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org