- Add ServiceInfo interface to define a set of catalogs (repository
authorMichael Andres <ma@suse.de>
Tue, 9 Sep 2008 11:05:48 +0000 (11:05 +0000)
committerMichael Andres <ma@suse.de>
Tue, 9 Sep 2008 11:05:48 +0000 (11:05 +0000)
  aliases) to be enabled on next refresh.

devel/devel.ma/NewPool.cc
package/libzypp.changes
zypp/ServiceInfo.cc
zypp/ServiceInfo.h

index eeb2f24..6de4e8c 100644 (file)
@@ -445,11 +445,6 @@ try {
   ResPool   pool( ResPool::instance() );
   sat::Pool satpool( sat::Pool::instance() );
 
-  Edition e("1.a");
-  DBG << e.copmpare( Edition("1a") ) << endl;
-  DBG << e.copmpare( Edition("1=a") ) << endl;
-  DBG << e.copmpare( Edition("1#$%^&*()_a") ) << endl;
-return 0;
   if ( 1 )
   {
     Measure x( "INIT TARGET" );
index e6bbcd0..77ad056 100644 (file)
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Tue Sep  9 13:04:11 CEST 2008 - ma@suse.de
+
+- Add ServiceInfo interface to define a set of catalogs (repository 
+  aliases) to be enabled on next refresh.
+- revision 10970
+
+-------------------------------------------------------------------
 Tue Sep  9 11:40:42 CEST 2008 - ma@suse.de
 
 - Fix reading of Traget::targetDistribution.
index c6ac1d2..17f7df5 100644 (file)
@@ -24,7 +24,7 @@ using namespace std;
 using zypp::xml::escape;
 
 ///////////////////////////////////////////////////////////////////////////////
-namespace zypp 
+namespace zypp
 {//////////////////////////////////////////////////////////////////////////////
 
 
@@ -44,8 +44,11 @@ namespace zypp
   //
   struct ServiceInfo::Impl : public repo::RepoInfoBase::Impl
   {
+    typedef ServiceInfo::CatalogsToEnable CatalogsToEnable;
+
   public:
     Url url;
+    CatalogsToEnable catalogsToEnable;
 
   public:
     Impl() : repo::RepoInfoBase::Impl() {}
@@ -69,7 +72,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
 
   const ServiceInfo ServiceInfo::noService;
-  
+
   ServiceInfo::ServiceInfo() : _pimpl( new Impl() ) {}
 
   ServiceInfo::ServiceInfo(const string & alias)
@@ -84,9 +87,32 @@ namespace zypp
   void ServiceInfo::setUrl( const Url& url ) { _pimpl->url = url; }
 
 
+  bool catalogsToEnableEmpty() const
+  { return _pimpl->catalogsToEnable.empty(); }
+
+  CatalogsToEnable::size_type catalogsToEnableSize() const
+  { return _pimpl->catalogsToEnable.size(); }
+
+  CatalogsToEnable::const_iterator catalogsToEnableBegin() const
+  { return _pimpl->catalogsToEnable.begin(); }
+
+  CatalogsToEnable::const_iterator catalogsToEnableEnd() const
+  { return _pimpl->catalogsToEnable.end(); }
+
+  bool catalogToEnableFind( const std::string & alias_r ) const
+  { return( _pimpl->catalogsToEnable.find( alias_r ) != _pimpl->catalogsToEnable.end() ); }
+
+  void addCatalogToEnable( const std::string & alias_r )
+  { return _pimpl->catalogsToEnable.insert( alias_r ); }
+
+  void delCatalogToEnable( const std::string & alias_r )
+  { return _pimpl->catalogsToEnable.erase( alias_r ); }
+
+
   std::ostream & ServiceInfo::dumpAsIniOn( std::ostream & str ) const
   {
-    return RepoInfoBase::dumpAsIniOn(str) << "url = " << url() << endl;
+    return RepoInfoBase::dumpAsIniOn(str)
+        << "url = " << url() << endl;
   }
 
   std::ostream & ServiceInfo::dumpAsXMLOn( std::ostream & str) const
@@ -100,7 +126,7 @@ namespace zypp
       << " url=\"" << escape(url().asString()) << "\""
       << "/>" << endl;
   }
-  
+
   std::ostream & operator<<( std::ostream& str, const ServiceInfo &obj )
   {
     return obj.dumpAsIniOn(str);
index b83605b..b65ca15 100644 (file)
@@ -62,8 +62,6 @@ namespace zypp
      */
     Url url() const;
 
-  public:
-
     /**
      * Sets url for this service
      *
@@ -71,6 +69,30 @@ namespace zypp
      */
     void setUrl( const Url& url );
 
+
+    /** \name Set of catalogs (repository aliases) to enable on next refresh.
+     *
+     * Per default new repositories are created in disabled state. But repositories
+     * mentioned here will be created in enabled state on the next refresh.
+     * Afterwards they get removed from the list.
+     */
+    //@{
+    /** Container of catalogs. */
+    typedef std:set<std::string>     CatalogsToEnable;
+    bool                             catalogsToEnableEmpty() const;
+    CatalogsToEnable::size_type      catalogsToEnableSize() const;
+    CatalogsToEnable::const_iterator catalogsToEnableBegin() const;
+    CatalogsToEnable::const_iterator catalogsToEnableEnd() const;
+
+    /** Wheter \c alias_r is mentioned in CatalogsToEnable. */
+    bool catalogToEnableFind( const std::string & alias_r ) const;
+
+    /** Add \c alias_r to the set of CatalogsToEnable. */
+    void addCatalogToEnable( const std::string & alias_r );
+    /** Remove \c alias_r to the set of CatalogsToEnable. */
+    void delCatalogToEnable( const std::string & alias_r );
+    //@}
+
   public:
     /**
      * Writes ServiceInfo to stream in ".service" format