define string conversion
authorKlaus Kaempf <kkaempf@suse.de>
Thu, 7 Aug 2008 16:27:56 +0000 (16:27 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Thu, 7 Aug 2008 16:27:56 +0000 (16:27 +0000)
swig/Arch.i
swig/PoolItem.i

index 1ea4991..320c7f8 100644 (file)
@@ -5,3 +5,20 @@ template<class A, class B> class std::unary_function {};
 %template(ArchCompatFun) std::unary_function<zypp::Arch, bool>;
 
 %include <zypp/Arch.h>
+
+%extend zypp::Arch
+{
+#ifdef SWIGPYTHON
+%rename ("__str__") string();
+#endif
+#ifdef SWIGRUBY
+%rename ("to_s") string();
+#endif
+
+  std::string string() const
+  {
+    std::ostringstream str;
+    str << *self;
+    return str.str();
+  }
+}
index cd6406a..34a2eeb 100644 (file)
@@ -7,7 +7,14 @@
 
 %extend zypp::PoolItem
 {
-  std::string asString() const
+#ifdef SWIGPYTHON
+%rename ("__str__") string();
+#endif
+#ifdef SWIGRUBY
+%rename ("to_s") string();
+#endif
+
+  std::string string() const
   {
     std::ostringstream str;
     str << *self;