fix linking templates
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 11 Jun 2007 09:14:58 +0000 (09:14 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 11 Jun 2007 09:14:58 +0000 (09:14 +0000)
zypp/cache/CacheStore.cpp
zypp/cache/ResolvableQuery.cc
zypp/cache/ResolvableQuery.h
zypp/repo/cached/RepoImpl.cc
zypp/repo/cached/RepoImpl.h

index 6a1d5ff..38eb396 100644 (file)
@@ -8,7 +8,7 @@
 #include "zypp/ZYppFactory.h"
 #include "zypp/ZYpp.h"
 #include "zypp/ZConfig.h"
-
+#include "zypp/Package.h"
 #include "zypp/cache/CacheInitializer.h"
 #include "zypp/cache/CacheStore.h"
 #include "zypp/cache/CacheException.h"
@@ -1031,6 +1031,24 @@ void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvabl
   appendStringAttribute( resolvable_id, klass, name, value );
 }
 
+template
+void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvable_id,
+                                                 const std::string &klass,
+                                                 const std::string &name,
+                                                 const std::set<std::string> &cont );
+template
+void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvable_id,
+                                                 const std::string &klass,
+                                                 const std::string &name,
+                                                 const std::list<std::string> &cont );
+template
+ void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvable_id,
+                                                  const std::string &klass,
+                                                  const std::string &name,
+                                                  const Package::Keywords &cont );
+
+    
+    
 }
 }
 
index 57fe7df..0483f40 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "zypp/cache/CacheTypes.h"
 #include "zypp/cache/ResolvableQuery.h"
+#include "zypp/Package.h"
 #include "zypp/cache/sqlite3x/sqlite3x.hpp"
 
 using namespace sqlite3x;
@@ -26,7 +27,6 @@ struct ResolvableQuery::Impl
   {
   }
 
-
   data::ResObject_Ptr fromRow( sqlite3_reader &reader )
   {
     data::ResObject_Ptr ptr (new data::ResObject);
@@ -121,7 +121,8 @@ struct ResolvableQuery::Impl
     string all = queryStringAttributeInternal( con, record_id, klass, name);
     _Container words;
     
-    str::split( all, std::back_inserter(words) );
+    //
+    //str::split( all, std::inserter(words) );
     return words;
   }
   
@@ -208,6 +209,16 @@ private:
   }
 };
 
+template 
+list<string> ResolvableQuery::Impl::queryStringContainerAttribute( const data::RecordId &record_id,
+                                                                   const std::string &klass,
+                                                                   const std::string &name );
+
+template 
+set<string> ResolvableQuery::Impl::queryStringContainerAttribute( const data::RecordId &record_id,
+                                                                  const std::string &klass,
+                                                                  const std::string &name );
+
 //////////////////////////////////////////////////////////////////////////////
 // FORWARD TO IMPLEMENTATION
 //////////////////////////////////////////////////////////////////////////////
@@ -274,6 +285,29 @@ TranslatedText ResolvableQuery::queryTranslatedStringAttribute( const data::Reco
   return _pimpl->queryTranslatedStringAttribute(record_id, klass, name);
 }
 
+template<class _Container>
+_Container ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+                                                           const std::string &klass,
+                                                           const std::string &name )
+{
+  return _pimpl->queryStringContainerAttribute<_Container>(record_id, klass, name);
+}
+
+template
+std::set<std::string> ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+                                                                      const std::string &klass,
+                                                                      const std::string &name );
+
+template
+std::list<std::string> ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+                                                                       const std::string &klass,
+                                                                       const std::string &name );
+
+template
+Package::Keywords ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+                                                                  const std::string &klass,
+                                                                  const std::string &name );
+
 //////////////////////////////////////////////////////////////////////////////
 
 } } // namespace zypp::cache
index 82a3171..0dfa2c7 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef ZYPP_CACHE_RESOLVABLE_QUERY_H
 #define ZYPP_CACHE_RESOLVABLE_QUERY_H
 
+#include <set>
+#include <list>
 #include "zypp/base/Function.h"
 #include "zypp/Pathname.h"
 #include "zypp/data/ResolvableData.h"
@@ -152,7 +154,6 @@ namespace zypp
       /** Pointer to implementation. */
       RW_pointer<Impl> _pimpl;
     };
-
   } //NS cache
 } //NS zypp
 
index 5d109b4..a43eaf9 100644 (file)
@@ -72,31 +72,33 @@ void RepoImpl::createResolvables()
 
     sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables where repository_id=:repository_id;");
     cmd.bind(":repository_id", _repository_id);
-    map<data::RecordId, NVRAD> nvras;
+    map<data::RecordId, pair<Resolvable::Kind, NVRAD> > nvras;
     
     sqlite3_reader reader = cmd.executereader();
     while(reader.read())
     {
       long long id = reader.getint64(0);
       Dependencies deps;
-      
+      Resolvable::Kind kind = _type_cache.kindFor(reader.getint(6));
       // Collect basic Resolvable data
-      nvras[id] = NVRAD( reader.getstring(1),
-                       Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
-                       _type_cache.archFor(reader.getint(5)),
-                       deps
-                     );
+      nvras[id] = make_pair( kind, NVRAD( reader.getstring(1),
+                                          Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
+                                          _type_cache.archFor(reader.getint(5)),
+                                           deps ) );
     }
     
     MIL << "Done reading resolvables nvra" << endl;
     
     read_capabilities( con, nvras);
     
-    for ( map<data::RecordId, NVRAD>::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
+    for ( map<data::RecordId, pair<Resolvable::Kind, NVRAD> >::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
     {
-      ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
-      Package::Ptr package = detail::makeResolvableFromImpl( it->second, impl );
-      _store.insert (package);
+      if ( it->second.first == ResTraits<Package>::kind )
+      {
+        ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
+        Package::Ptr package = detail::makeResolvableFromImpl( it->second.second, impl );
+        _store.insert (package);
+      }
     }
     con.executenonquery("COMMIT;");
   }
@@ -113,7 +115,7 @@ ResolvableQuery RepoImpl::resolvableQuery()
   return _rquery;
 }
 
-void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras )
+void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, pair<Resolvable::Kind, NVRAD> > &nvras )
 {
   CapFactory capfactory;
   
@@ -150,13 +152,13 @@ void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, N
       {
         capability::NamedCap *ncap = new capability::NamedCap( refer, reader.getstring(1) );
         zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));  
-        nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) ); 
+        nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) ); 
       }
       else
       {
         capability::VersionedCap *vcap = new capability::VersionedCap( refer, reader.getstring(1), /* rel */ rel, Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ) );
         zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
-        nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) ); 
+        nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) ); 
       }
     }
   }
@@ -170,7 +172,7 @@ void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, N
       capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
       zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(3));
       data::RecordId rid = reader.getint64(4);
-      nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) ); 
+      nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) ); 
     }
   }
   
index 74d9027..6b619ac 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <iosfwd>
 #include <map>
+#include <utility>
 #include "zypp/Arch.h"
 #include "zypp/Rel.h"
 #include "zypp/Pathname.h"
@@ -56,7 +57,7 @@ namespace zypp
         void createResolvables();
         
       protected:
-        void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, NVRAD> &nvras );
+        void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, std::pair<Resolvable::Kind, NVRAD> > &nvras );
         Pathname _dbdir;
         cache::CacheTypes _type_cache;
         data::RecordId _repository_id;