clean more class names
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 31 May 2007 16:00:01 +0000 (16:00 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 31 May 2007 16:00:01 +0000 (16:00 +0000)
move data not belonging to RepoInfo to
RepoStatus, like the checksum or timestamp.

14 files changed:
zypp2/CMakeLists.txt
zypp2/RepoInfo.cc
zypp2/RepoInfo.h
zypp2/RepoManager.cc
zypp2/RepoStatus.cc
zypp2/RepoStatus.h
zypp2/repo/memory/PackageImpl.cc [moved from zypp2/repo/memory/DPackageImpl.cc with 99% similarity]
zypp2/repo/memory/PackageImpl.h [moved from zypp2/repo/memory/DPackageImpl.h with 100% similarity]
zypp2/repo/memory/PatternImpl.cc [moved from zypp2/repo/memory/DPatternImpl.cc with 97% similarity]
zypp2/repo/memory/PatternImpl.h [moved from zypp2/repo/memory/DPatternImpl.h with 100% similarity]
zypp2/repo/memory/ProductImpl.cc [moved from zypp2/repo/memory/DProductImpl.cc with 98% similarity]
zypp2/repo/memory/ProductImpl.h [moved from zypp2/repo/memory/DProductImpl.h with 100% similarity]
zypp2/repo/memory/SrcPackageImpl.cc [moved from zypp2/repo/memory/DSrcPackageImpl.cc with 97% similarity]
zypp2/repo/memory/SrcPackageImpl.h [moved from zypp2/repo/memory/DSrcPackageImpl.h with 100% similarity]

index 9caa7e8..c343a85 100644 (file)
@@ -94,17 +94,17 @@ SET( zypp2_repository_cached_HEADERS
 )
 
 SET( zypp2_repository_data_SRCS
-  repo/memory/DPackageImpl.cc
-  repo/memory/DPatternImpl.cc
-  repo/memory/DProductImpl.cc
-  repo/memory/DSrcPackageImpl.cc
+  repo/memory/PackageImpl.cc
+  repo/memory/PatternImpl.cc
+  repo/memory/ProductImpl.cc
+  repo/memory/SrcPackageImpl.cc
 )
 
 SET( zypp2_repository_data_HEADERS
-  repo/memory/DPackageImpl.h
-  repo/memory/DPatternImpl.h
-  repo/memory/DProductImpl.h
-  repo/memory/DSrcPackageImpl.h
+  repo/memory/PackageImpl.h
+  repo/memory/PatternImpl.h
+  repo/memory/ProductImpl.h
+  repo/memory/SrcPackageImpl.h
 )
 
 SET( zypp2_parser_susetags_SRCS
index 1838d65..bc9f1c9 100644 (file)
@@ -37,13 +37,10 @@ namespace zypp
     boost::tribool enabled;
     boost::tribool autorefresh;
     std::string type;
-    Url baseurl;
+    Url mirrorlist_url;
     std::set<Url> urls;
-    Pathname path;
     std::string alias;
     std::string name;
-    CheckSum checksum;
-    Date timestamp;
 
   public:
     /** Offer default Impl. */
@@ -104,15 +101,15 @@ namespace zypp
     return *this;
   }
 
-  RepoInfo & RepoInfo::setBaseUrl( const Url &url )
+  RepoInfo & RepoInfo::setMirrorListUrl( const Url &url )
   {
-    _pimpl->baseurl = url;
+    _pimpl->mirrorlist_url = url;
     return *this;
   }
 
-  RepoInfo & RepoInfo::setPath( const Pathname &p )
+  RepoInfo & RepoInfo::addBaseUrl( const Url &url )
   {
-    _pimpl->path = p;
+    _pimpl->urls.insert(url);
     return *this;
   }
 
@@ -134,45 +131,23 @@ namespace zypp
     return *this;
   }
 
-  RepoInfo & RepoInfo::setChecksum( const CheckSum &checksum )
-  {
-    _pimpl->checksum = checksum;
-    return *this;
-  }
-
-  RepoInfo & RepoInfo::setTimestamp( const Date &timestamp )
-  {
-    _pimpl->timestamp = timestamp;
-    return *this;
-  }
-
   tribool RepoInfo::enabled() const
   { return _pimpl->enabled; }
 
   tribool RepoInfo::autorefresh() const
   { return _pimpl->autorefresh; }
 
-  
-  Pathname RepoInfo::path() const
-  { return _pimpl->path; }
-
   std::string RepoInfo::alias() const
   { return _pimpl->alias; }
 
   std::string RepoInfo::name() const
   { return _pimpl->name; }
 
-  CheckSum RepoInfo::checksum() const
-  { return _pimpl->checksum; }
-
-  Date RepoInfo::timestamp() const
-  { return _pimpl->timestamp; }
-
   std::string RepoInfo::type() const
   { return _pimpl->type; }
 
-  Url RepoInfo::baseUrl() const
-  { return _pimpl->baseurl; }
+  Url RepoInfo::mirrorListUrl() const
+  { return _pimpl->mirrorlist_url; }
 
   std::set<Url> RepoInfo::urls() const
   { return _pimpl->urls; }
@@ -187,11 +162,11 @@ namespace zypp
   {
     str << "--------------------------------------" << std::endl;
     str << "- alias       : " << alias() << std::endl;
-    str << "- url         : " << baseUrl() << std::endl;
+    //str << "- url         : " << baseUrl() << std::endl;
     str << "- type        : " << type() << std::endl;
     str << "- enabled     : " << enabled() << std::endl;
     str << "- autorefresh : " << autorefresh() << std::endl;
-    str << "- path        : " << path() << std::endl;
+    //str << "- path        : " << path() << std::endl;
     return str;
   }
 
index a05eb31..0238c7c 100644 (file)
@@ -20,8 +20,6 @@
 #include <boost/logic/tribool.hpp>
 #include "zypp/Pathname.h"
 #include "zypp/Url.h"
-#include "zypp/CheckSum.h"
-#include "zypp/Date.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -87,15 +85,16 @@ namespace zypp
      * the base url is http://updates.novell.com/10.2
      *
      * This can't be empty in order the repository to be valid
+     * unless the download of the mirror list succeeds and it
+     * contains a valid url.
      */
-    Url baseUrl() const;
+    std::set<Url> urls() const;
 
     /**
-     * Urls is a list of Urls where this repository
-     * is located.
+     * Url of a file which contains a list of Urls
      * If empty, the base url will be used.
      */
-    std::set<Url> urls() const;
+     Url mirrorListUrl() const;
     
     typedef std::set<Url>::const_iterator urls_const_iterator;
     
@@ -110,12 +109,6 @@ namespace zypp
     urls_const_iterator urlsEnd() const;
     
     /**
-     * Path on the url where the repository root
-     * is located.
-     */
-    Pathname path() const;
-    
-    /**
      * If enabled is false, then this repository must be ignored as if does
      * not exists, except when checking for duplicate alias.
      */
@@ -141,27 +134,18 @@ namespace zypp
      * ie: "SUSE Linux 10.2 updates"
      */
     std::string name() const;
-    
-    /**
-     * Checksum of the repository.
-     * Usually the checksum of the index, but any
-     * checksum that changes when the repository changes
-     * in any way is sufficient.
-     */
-    CheckSum checksum() const;
-    
+
     /**
-     * timestamp of the repository. If the repository
-     * changes, it has to be updated as well with the
-     * new timestamp.
+     * Add a base url. \see baseUrl
+     * \param url The base url for the repository.
      */
-    Date timestamp() const;
+    RepoInfo & addBaseUrl( const Url &url );
     
     /**
-     * Set the base url. \see baseUrl
-     * \param url The base url for the repository.
+     * Set mirror list url. \see mirrorListUrl
+     * \param url The base url for the list
      */
-    RepoInfo & setBaseUrl( const Url &url );
+    RepoInfo & setMirrorListUrl( const Url &url );
     
     /**
      * enable or disable the repository \see enabled
@@ -176,12 +160,6 @@ namespace zypp
     RepoInfo & setAutorefresh( boost::tribool autorefresh );
     
     /**
-     * set the repository path \see path
-     * \param p
-     */
-    RepoInfo & setPath( const Pathname &p );
-    
-    /**
      * set the repository alias \see alias
      * \param alias
      */
@@ -198,19 +176,7 @@ namespace zypp
      * \param name
      */
     RepoInfo & setName( const std::string &name );
-    
-    /**
-     * set the repository checksum \see checksum
-     * \param checksum
-     */
-    RepoInfo & setChecksum( const CheckSum &checksum );
-    
-    /**
-     * set the repository timestamp \see timestamp
-     * \param timestamp
-     */
-    RepoInfo & setTimestamp( const Date &timestamp );
-    
+
     std::ostream & dumpOn( std::ostream & str ) const;
     
     class Impl;
index 40d2645..ea8e657 100644 (file)
@@ -37,14 +37,23 @@ static std::list<RepoInfo> repositories_in_file( const Pathname &file )
     MIL << (*its) << endl;
     
     RepoInfo info;
-    
+    info.setAlias(*its);
+                  
     for ( IniDict::entry_const_iterator it = dict.entriesBegin(*its);
           it != dict.entriesEnd(*its);
           ++it )
     {
       
       MIL << (*it).first << endl;
+      if (it->first == "name" )
+        info.setName(it-> second);
+      else if ( it->first == "enabled" )
+        info.setEnabled( it->second == "1" );
+      else if ( it->first == "baseurl" )
+        info.addBaseUrl( Url(it->second) );
     }
+    
+    // add it to the list.
   }
   
 //   dictionary *d = iniparser_new(file.c_str());
index e0d16aa..a0ddc50 100644 (file)
@@ -13,6 +13,7 @@
 //#include "zypp/base/Logger.h"
 #include "zypp2/RepoStatus.h"
 
+
 using std::endl;
 
 ///////////////////////////////////////////////////////////////////
@@ -28,6 +29,10 @@ namespace zypp
   {
 
   public:
+    
+    CheckSum checksum;
+    Date timestamp;
+    
     /** Offer default Impl. */
     static shared_ptr<Impl> nullimpl()
     {
@@ -72,6 +77,24 @@ namespace zypp
   RepoStatus::~RepoStatus()
   {}
 
+  RepoStatus & RepoStatus::setChecksum( const CheckSum &checksum )
+  {
+    _pimpl->checksum = checksum;
+    return *this;
+  }
+
+  RepoStatus & RepoStatus::setTimestamp( const Date &timestamp )
+  {
+    _pimpl->timestamp = timestamp;
+    return *this;
+  }
+  
+  CheckSum RepoStatus::checksum() const
+  { return _pimpl->checksum; }
+
+  Date RepoStatus::timestamp() const
+  { return _pimpl->timestamp; }
+  
   /******************************************************************
   **
   **   FUNCTION NAME : operator<<
index d3b8598..a6221c3 100644 (file)
@@ -14,6 +14,8 @@
 
 #include <iosfwd>
 #include "zypp/base/PtrTypes.h"
+#include "zypp/CheckSum.h"
+#include "zypp/Date.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -23,12 +25,48 @@ namespace zypp
   //
   //   CLASS NAME : RepoStatus
   //
-  /** */
+  /**
+   * \short Local facts about a repository
+   * This class represents the status of a
+   * repository on the system.
+   *
+   * Anything that is not provided on the metadata
+   * files, like the timestamp of the downloaded
+   * metadata, and its checksum.
+   */
   class RepoStatus
   {
     friend std::ostream & operator<<( std::ostream & str, const RepoStatus & obj );
 
   public:
+    
+    /**
+     * Checksum of the repository.
+     * Usually the checksum of the index, but any
+     * checksum that changes when the repository changes
+     * in any way is sufficient.
+     */
+    CheckSum checksum() const;
+    
+    /**
+     * timestamp of the repository. If the repository
+     * changes, it has to be updated as well with the
+     * new timestamp.
+     */
+    Date timestamp() const;
+    
+    /**
+     * set the repository checksum \see checksum
+     * \param checksum
+     */
+    RepoStatus & setChecksum( const CheckSum &checksum );
+    
+    /**
+     * set the repository timestamp \see timestamp
+     * \param timestamp
+     */
+    RepoStatus & setTimestamp( const Date &timestamp );
+
     /** Implementation  */
     class Impl;
 
similarity index 99%
rename from zypp2/repo/memory/DPackageImpl.cc
rename to zypp2/repo/memory/PackageImpl.cc
index 98cb87d..4375f73 100644 (file)
@@ -10,7 +10,7 @@
  *
 */
 
-#include "zypp2/repo/memory/DPackageImpl.h"
+#include "zypp2/repo/memory/PackageImpl.h"
 
 using namespace std;
 
similarity index 97%
rename from zypp2/repo/memory/DPatternImpl.cc
rename to zypp2/repo/memory/PatternImpl.cc
index c686ec4..ce4cd54 100644 (file)
@@ -9,7 +9,7 @@
 /** \file      zypp2/repository/memory/PatternImpl.cc
  *
 */
-#include "zypp2/repo/memory/DPatternImpl.h"
+#include "zypp2/repo/memory/PatternImpl.h"
 
 using namespace std;
 
similarity index 98%
rename from zypp2/repo/memory/DProductImpl.cc
rename to zypp2/repo/memory/ProductImpl.cc
index 395ef06..d59849f 100644 (file)
@@ -9,7 +9,7 @@
 /** \file      zypp2/repo/memory/ProductImpl.cc
  *
 */
-#include "zypp2/repo/memory/DProductImpl.h"
+#include "zypp2/repo/memory/ProductImpl.h"
 
 using namespace std;
 
similarity index 97%
rename from zypp2/repo/memory/DSrcPackageImpl.cc
rename to zypp2/repo/memory/SrcPackageImpl.cc
index afbbb04..8d90d8b 100644 (file)
@@ -9,7 +9,7 @@
 /** \file      zypp2/repo/memory/SrcPackageImpl.cc
  *
 */
-#include "zypp2/repo/memory/DSrcPackageImpl.h"
+#include "zypp2/repo/memory/SrcPackageImpl.h"
 
 using namespace std;