replace ResTraits<>::kind by ResKind
authorMichael Andres <ma@suse.de>
Fri, 8 Aug 2008 11:38:54 +0000 (11:38 +0000)
committerMichael Andres <ma@suse.de>
Fri, 8 Aug 2008 11:38:54 +0000 (11:38 +0000)
13 files changed:
devel/Example.createCapabilities.cc
devel/devel.dmacvicar/CacheStore_tp.cc
devel/devel.ma/FakePool.h
devel/devel.shaas/PdbToZypp/pdbtozypp.cc
devel/devel.shaas/old/dbmain.cc
tools/registration/zypp-query-pool.cc
zypp/ResFilters.h
zypp/ResKind.cc
zypp/ResTraits.h
zypp/pool/GetResolvablesToInsDel.cc
zypp/solver/detail/Helper.cc
zypp/solver/detail/SATResolver.cc
zypp/target/rpm/RpmDb.cc

index e167277..b0d504d 100644 (file)
@@ -137,7 +137,7 @@ struct EnhacedCollector : public Collector
     try
       {
         // bulid Package deps.
-        _caps.insert( _factory.parse( ResTraits<Package>::kind, line_r ) );
+        _caps.insert( _factory.parse( ResKind::package, line_r ) );
       }
     catch( Exception & excpt_r )
       {
index 20b8fb6..1b780d4 100644 (file)
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
     {
       ZYpp::Ptr z = getZYpp();
 
-//       CapabilityImpl::Ptr freak = capability::parse( ResTraits<Package>::kind, "libc.so.6");
+//       CapabilityImpl::Ptr freak = capability::parse( ResKind::package, "libc.so.6");
 //       MIL << freak << endl;
 //       MIL << "isVer: " << isKind<VersionedCap>(freak) << endl;
 //       MIL << "isNam: " << isKind<NamedCap>(freak) << endl;
@@ -52,7 +52,7 @@ int main(int argc, char **argv)
       while (file && !file.eof())
       {
         getline(file, buffer);
-        CapabilityImpl::Ptr cap = capability::parse( ResTraits<Package>::kind, buffer );
+        CapabilityImpl::Ptr cap = capability::parse( ResKind::package, buffer );
         if ( cap == 0L )
         {
           //ZYPP_THROW(Exception("Invalid capability: [" + buffer + "]"));
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
       for ( list<CapabilityImpl::Ptr>::const_iterator it = caps.begin(); it != caps.end(); ++it )
       {
         CapabilityImpl::Ptr cap = *it;
-        if ( ( ! cap ) || ( cap->refers() != ResTraits<Package>::kind ) )
+        if ( ( ! cap ) || ( cap->refers() != ResKind::package ) )
         {
           ERR << "Invalid capability : [" << buffer << "]" << endl;
           continue;
index 73238e7..d95c8cf 100644 (file)
@@ -60,7 +60,7 @@ namespace zypp
     public:
       DataCollect( bool verbose_r = true )
       : _definst( false )
-      , _defkind( ResTraits<Package>::kind )
+      , _defkind( ResKind::package )
       , _defdep( Dep::PROVIDES )
       , _defdepref( _defkind )
       , _verbose( verbose_r )
@@ -160,17 +160,17 @@ namespace zypp
         if ( _d )
           {
             ResObject::Ptr p;
-            if ( _d->_kind == ResTraits<Package>::kind )
+            if ( _d->_kind == ResKind::package )
               p = make<Package>();
-            else if ( _d->_kind == ResTraits<SrcPackage>::kind )
+            else if ( _d->_kind == ResKind::srcpackage )
               p = make<SrcPackage>();
             else if ( _d->_kind == ResTraits<Selection>::kind )
               p = make<Selection>();
-            else if ( _d->_kind == ResTraits<Pattern>::kind )
+            else if ( _d->_kind == ResKind::pattern )
               p = make<Pattern>();
-            else if ( _d->_kind == ResTraits<Product>::kind )
+            else if ( _d->_kind == ResKind::product )
               p = make<Product>();
-            else if ( _d->_kind == ResTraits<Patch>::kind )
+            else if ( _d->_kind == ResKind::patch )
               p = make<Patch>();
             else if ( _d->_kind == ResTraits<Script>::kind )
               p = make<Script>();
index ce5e59c..a678584 100644 (file)
@@ -33,7 +33,7 @@ int PdbToZypp::readOut(){
 
        std::vector< std::vector<string> > packIDs = dbPackages->getResult();
 
-       Resolvable::Kind kind = ResTraits<Package>::kind;
+       Resolvable::Kind kind = ResKind::package;
        CapFactory factory;
 
        for(unsigned int i = 0; i < packIDs.size(); i++){
index fba4e45..ffd6ea2 100644 (file)
@@ -68,7 +68,7 @@ unsigned int getResolvables(ResStore *store){
        std::vector< std::vector<string> > packIDs = dbPackages->getResult();
        std::cout << "get packages from db...\n";
 
-       Resolvable::Kind kind = ResTraits<Package>::kind;
+       Resolvable::Kind kind = ResKind::package;
        CapFactory factory;
 
        for(unsigned int i = 2000; i < packIDs.size(); i++){
index 3c3b437..fd40b6a 100644 (file)
@@ -100,10 +100,10 @@ query_pool( ZYpp::Ptr Z,
 #define FILTER_ALL "all"
   if ( filter.empty() ) filter = FILTER_ALL;
 
-  if (filter == "packages") kind = ResTraits<zypp::Package>::kind;
-  else if (filter == "patches") kind = ResTraits<zypp::Patch>::kind;
-  else if (filter == "patterns") kind = ResTraits<zypp::Pattern>::kind;
-  else if (filter == "products") kind = ResTraits<zypp::Product>::kind;
+  if (filter == "packages") kind = ResKind::package;
+  else if (filter == "patches") kind = ResKind::patch;
+  else if (filter == "patterns") kind = ResKind::pattern;
+  else if (filter == "products") kind = ResKind::product;
   else if (filter != FILTER_ALL)
   {
     std::cerr << "usage: zypp-query-pool [--registrable|-r] [packages|patches|patterns|products] [<alias>]" << endl;
index 654ab14..194a419 100644 (file)
@@ -75,19 +75,19 @@ namespace zypp
      *
      * // print and count all Packages named "kernel"
      * counter = 0;
-     * store.forEach( chain( ByKind(ResTraits<Package>::kind),
+     * store.forEach( chain( ByKind(ResKind::package),
      *                       ByName("kernel") ),
      *                PrintAndCount(counter) );
      *
      * // print and count all Packages not named "kernel"
      * counter = 0;
-     * store.forEach( chain( ByKind(ResTraits<Package>::kind),
+     * store.forEach( chain( ByKind(ResKind::package),
      *                       not_c(ByName("kernel")) ),
      *                PrintAndCount(counter) );
      *
      * // same as above ;)
      * counter = 0;
-     * store.forEach( chain( ByKind(ResTraits<Package>::kind),
+     * store.forEach( chain( ByKind(ResKind::package),
      *                       chain( not_c(ByName("kernel")),
      *                              PrintAndCount(counter) ) ),
      *                true_c() );
index 437a385..e5f3ea3 100644 (file)
@@ -38,7 +38,7 @@ namespace zypp
   template<>
     const ResKind ResTraits<Product>   ::kind( ResKind::product );
   template<>
-    const ResKind ResTraits<SrcPackage>::kind( ResKind::srcpackage );
+    const ResKind ResKind::srcpackage( ResKind::srcpackage );
 
   std::string ResKind::satIdent( const ResKind & refers_r, const std::string & name_r )
   {
index cb72128..41d23e2 100644 (file)
@@ -94,7 +94,7 @@ namespace zypp
 
   /** Convenient access to well known ResKinds.
    * \code
-   * ResKind packagekind = ResTraits<Package>::kind;
+   * ResKind packagekind = ResKind::package;
    * ResKind packagekind = resKind<Package>();
    * \endcode
   */
@@ -104,7 +104,7 @@ namespace zypp
   /** Convenient test for ResKinds.
    * \code
    * ResKind value;
-   * if ( ResTraits<Package>::kind == value )
+   * if ( ResKind::package == value )
    * if ( resKind<Package>() == value )
    * if ( isKind<Package>( value ) )
    * \endcode
index 04392cf..53c2477 100644 (file)
@@ -111,7 +111,7 @@ namespace zypp
         {
           if (it->status().isToBeInstalled())
             {
-              if ((*it)->kind() == ResTraits<SrcPackage>::kind) {
+              if ((*it)->kind() == ResKind::srcpackage) {
                srclist_r.push_back( *it );
               }
               else
index b2ac557..45130c4 100644 (file)
@@ -265,7 +265,7 @@ Helper::itemToString (PoolItem item, bool shortVersion)
     ostringstream os;
     if (!item) return "";
 
-    if (item->kind() != ResTraits<zypp::Package>::kind)
+    if (item->kind() != ResKind::package)
        os << item->kind() << ':';
     os  << item->name();
     if (!shortVersion) {
index 63eb5c2..42888e5 100644 (file)
@@ -80,7 +80,7 @@ itemToString (PoolItem item, bool shortVersion)
     ostringstream os;
     if (!item) return "";
 
-    if (item->kind() != ResTraits<zypp::Package>::kind)
+    if (item->kind() != ResKind::package)
        os << item->kind() << ':';
     os  << item->name();
     if (!shortVersion) {
index 78ab154..64f8c13 100644 (file)
@@ -1333,7 +1333,7 @@ Package::Ptr RpmDb::makePackageFromHeader( const RpmHeader::constPtr header,
     {
       try
       {
-        dataCollect[Dep::PROVIDES].insert(capfactory.fromImpl(capability::buildFile(ResTraits<Package>::kind, *filename) ));
+        dataCollect[Dep::PROVIDES].insert(capfactory.fromImpl(capability::buildFile(ResKind::package, *filename) ));
       }
       catch (Exception & excpt_r)
       {
@@ -1426,7 +1426,7 @@ const list<Package::Ptr> & RpmDb::doGetPackages(callback::SendReport<ScanDBRepor
           WAR << "rpmdb.findByFile returned unknown package " << *iter << endl;
           continue;
         }
-        pptr->injectProvides(_f.parse(ResTraits<Package>::kind, *it));
+        pptr->injectProvides(_f.parse(ResKind::package, *it));
       }
     }
 #endif