Author: aschnell Date: Mon Jul 30 14:36:34 2007 New Revision: 6287 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6287&view=rev Log: - improved Pathname typemaps Modified: trunk/libzypp-bindings/swig/Pathname.i Modified: trunk/libzypp-bindings/swig/Pathname.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/Pathname.i?rev=6287&r1=6286&r2=6287&view=diff ============================================================================== --- trunk/libzypp-bindings/swig/Pathname.i (original) +++ trunk/libzypp-bindings/swig/Pathname.i Mon Jul 30 14:36:34 2007 @@ -1,21 +1,34 @@ +class Pathname +{ +public: + + Pathname(); + + Pathname(const std::string&); + + Pathname(const char*); + +}; + + #ifdef SWIGRUBY -%typemap(in) const Pathname & { - VALUE pathstring = rb_funcall( $input, rb_intern("to_s"), 0, 0); - Pathname *p = new Pathname( (RSTRING(pathstring)->ptr) ); - $1 = p; +%typemap(in) const Pathname&, Pathname* { + VALUE pathstring = rb_funcall( $input, rb_intern("to_s"), 0, 0); + Pathname *p = new Pathname( (RSTRING(pathstring)->ptr) ); + $1 = p; } -%typemap(freearg) const Pathname & { - delete $1; +%typemap(freearg) const Pathname&, Pathname* { + delete $1; } %typemap(out) Pathname { - rb_require("pathname"); - VALUE klass = rb_const_get( rb_cObject, rb_intern("Pathname")); - VALUE rbpathstr = rb_str_new2($1.asString().c_str()); - $result = rb_funcall( klass, rb_intern("new"), 1, rbpathstr); + rb_require("pathname"); + VALUE klass = rb_const_get( rb_cObject, rb_intern("Pathname")); + VALUE rbpathstr = rb_str_new2($1.asString().c_str()); + $result = rb_funcall( klass, rb_intern("new"), 1, rbpathstr); } #endif -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org