fix asKind/isKind
authorMichael Andres <ma@suse.de>
Fri, 5 Sep 2008 17:20:01 +0000 (17:20 +0000)
committerMichael Andres <ma@suse.de>
Fri, 5 Sep 2008 17:20:01 +0000 (17:20 +0000)
examples/python/list_resolvables.py
swig/Package.i
swig/ResTraits.i

index 7654737..8138390 100755 (executable)
@@ -22,9 +22,12 @@ for item in Z.pool():
       t = "i"
     else:
       t = "*"
+
     print "%s %s:%s-%s.%s\t(%s)" % ( t,
                                      item.kind(),
                                      item.name(),
                                      item.edition(),
                                      item.arch(),
                                      item.repoInfo().alias() )
+    if zypp.isKindPackage( item ):
+      print " Group: %s" %(zypp.asKindPackage( item ).group( ) )
index ec6f118..734c59d 100644 (file)
@@ -1,3 +1,4 @@
 //%ignore zypp::Package::checksum();
+
 %include <zypp/Package.h>
 
index 0b24cac..664113d 100644 (file)
@@ -32,28 +32,33 @@ namespace zypp
 // - asKind* to convert a ResObject/PoolItem into a
 //   specific *_constPtr.
 %define %STUFF(X)
-typedef intrusive_ptr<const X> X##_constPtr;
-typedef intrusive_ptr<X> X##_Ptr;
-
-%template(X##_constPtr) zypp::intrusive_ptr<const X>;
-%template(X##_Ptr)      zypp::intrusive_ptr<X>;
+namespace zypp
+{
+  typedef intrusive_ptr<const X> X##_constPtr;
+  typedef intrusive_ptr<X>       X##_Ptr;
+  %template(X##_constPtr)        intrusive_ptr<const X>;
+  %template(X##_Ptr)             intrusive_ptr<X>;
 
-bool isKind##X( const Resolvable::constPtr & p );
-bool isKind##X( const PoolItem & p );
+  bool isKind##X( const zypp::Resolvable::constPtr & p );
+  bool isKind##X( const zypp::PoolItem & p );
 
-X##_constPtr asKind##X( const Resolvable::constPtr & p );
-X##_constPtr asKind##X( const PoolItem & p );
+  X##_constPtr asKind##X( const zypp::Resolvable::constPtr & p );
+  X##_constPtr asKind##X( const zypp::PoolItem & p );
+}
 
 %header
 {
-  inline bool isKind##X( const Resolvable::constPtr & p )
-  { return isKind<X>( p ); }
-  inline bool isKind##X( const PoolItem & p )
-  { return isKind<X>( p.resolvable() ); }
-  inline X::constPtr asKind##X( const Resolvable::constPtr & p )
-  { return asKind<X>( p ); }
-  inline X::constPtr asKind##X( const PoolItem & p )
-  { return asKind<X>( p.resolvable() ); }
+  namespace zypp
+  {
+    inline bool isKind##X( const zypp::Resolvable::constPtr & p )
+    { return isKind<X>( p ); }
+    inline bool isKind##X( const zypp::PoolItem & p )
+    { return isKind<X>( p.resolvable() ); }
+    inline X::constPtr asKind##X( const zypp::Resolvable::constPtr & p )
+    { return asKind<X>( p ); }
+    inline X::constPtr asKind##X( const zypp::PoolItem & p )
+    { return asKind<X>( p.resolvable() ); }
+  }
 }
 
 #if defined(SWIGPYTHON)