Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / ServiceInfo.cc
index 3ebabc7..1242990 100644 (file)
@@ -13,7 +13,6 @@
 #include <iostream>
 
 #include "zypp/base/String.h"
-#include "zypp/base/DefaultIntegral.h"
 #include "zypp/parser/xml/XmlEscape.h"
 
 #include "zypp/RepoInfo.h"
@@ -36,32 +35,33 @@ namespace zypp
     typedef ServiceInfo::ReposToDisable ReposToDisable;
 
   public:
-    RepoVariablesReplacedUrl _url;
-    repo::ServiceType _type;
-    ReposToEnable _reposToEnable;
-    ReposToDisable _reposToDisable;
-    RepoStates _repoStates;
-    DefaultIntegral<Date::Duration,0> _ttl;
-    Date _lrf;
+    RepoVariablesReplacedUrl url;
+    repo::ServiceType type;
+    ReposToEnable  reposToEnable;
+    ReposToDisable reposToDisable;
+    RepoStates     repoStates;
+
 
   public:
     Impl()
+      : type(repo::ServiceType::NONE_e)
     {}
 
-    Impl( const Url & url_r )
-    : _url( url_r )
+    Impl(const Url & url_)
+      : url(url_)
+      , type(repo::ServiceType::NONE_e)
     {}
 
     ~Impl()
     {}
 
-    void setProbedType( const repo::ServiceType & type_r ) const
+    void setProbedType( const repo::ServiceType & t ) const
     {
-      if ( _type == repo::ServiceType::NONE
-           && type_r != repo::ServiceType::NONE )
+      if ( type == repo::ServiceType::NONE
+           && t != repo::ServiceType::NONE )
       {
         // lazy init!
-        const_cast<Impl*>(this)->_type = type_r;
+        const_cast<Impl*>(this)->type = t;
       }
     }
 
@@ -97,70 +97,82 @@ namespace zypp
   {}
 
   Url ServiceInfo::url() const                 // Variables replaced
-  { return _pimpl->_url.transformed(); }
+  { return _pimpl->url.transformed(); }
 
   Url ServiceInfo::rawUrl() const              // Raw
-  { return _pimpl->_url.raw(); }
+  { return _pimpl->url.raw(); }
 
   void ServiceInfo::setUrl( const Url& url )   // Raw
-  { _pimpl->_url.raw() = url; }
+  { _pimpl->url.raw() = url; }
+
+  repo::ServiceType ServiceInfo::type() const
+  { return _pimpl->type; }
+  void ServiceInfo::setType( const repo::ServiceType & type )
+  { _pimpl->type = type; }
+
+  void ServiceInfo::setProbedType( const repo::ServiceType &t ) const
+  { _pimpl->setProbedType( t ); }
 
-  repo::ServiceType ServiceInfo::type() const                          { return _pimpl->_type; }
-  void ServiceInfo::setType( const repo::ServiceType & type )          { _pimpl->_type = type; }
-  void ServiceInfo::setProbedType( const repo::ServiceType &t ) const  { _pimpl->setProbedType( t ); }
+  bool ServiceInfo::reposToEnableEmpty() const
+  { return _pimpl->reposToEnable.empty(); }
 
-  Date::Duration ServiceInfo::ttl() const                      { return _pimpl->_ttl; }
-  void ServiceInfo::setTtl( Date::Duration ttl_r )             { _pimpl->_ttl = ttl_r; }
-  void ServiceInfo::setProbedTtl( Date::Duration ttl_r ) const { const_cast<ServiceInfo*>(this)->setTtl( ttl_r ); }
+  ServiceInfo::ReposToEnable::size_type ServiceInfo::reposToEnableSize() const
+  { return _pimpl->reposToEnable.size(); }
 
-  Date ServiceInfo::lrf() const                                        { return _pimpl->_lrf; }
-  void ServiceInfo::setLrf( Date lrf_r )                       { _pimpl->_lrf = lrf_r; }
+  ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableBegin() const
+  { return _pimpl->reposToEnable.begin(); }
 
-  bool ServiceInfo::reposToEnableEmpty() const                                         { return _pimpl->_reposToEnable.empty(); }
-  ServiceInfo::ReposToEnable::size_type ServiceInfo::reposToEnableSize() const         { return _pimpl->_reposToEnable.size(); }
-  ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableBegin() const   { return _pimpl->_reposToEnable.begin(); }
-  ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableEnd() const     { return _pimpl->_reposToEnable.end(); }
+  ServiceInfo::ReposToEnable::const_iterator ServiceInfo::reposToEnableEnd() const
+  { return _pimpl->reposToEnable.end(); }
 
   bool ServiceInfo::repoToEnableFind( const std::string & alias_r ) const
-  { return( _pimpl->_reposToEnable.find( alias_r ) != _pimpl->_reposToEnable.end() ); }
+  { return( _pimpl->reposToEnable.find( alias_r ) != _pimpl->reposToEnable.end() ); }
 
   void ServiceInfo::addRepoToEnable( const std::string & alias_r )
   {
-    _pimpl->_reposToEnable.insert( alias_r );
-    _pimpl->_reposToDisable.erase( alias_r );
+    _pimpl->reposToEnable.insert( alias_r );
+    _pimpl->reposToDisable.erase( alias_r );
   }
 
   void ServiceInfo::delRepoToEnable( const std::string & alias_r )
-  { _pimpl->_reposToEnable.erase( alias_r ); }
+  { _pimpl->reposToEnable.erase( alias_r ); }
 
   void ServiceInfo::clearReposToEnable()
-  { _pimpl->_reposToEnable.clear(); }
+  { _pimpl->reposToEnable.clear(); }
+
+
+  bool ServiceInfo::reposToDisableEmpty() const
+  { return _pimpl->reposToDisable.empty(); }
 
+  ServiceInfo::ReposToDisable::size_type ServiceInfo::reposToDisableSize() const
+  { return _pimpl->reposToDisable.size(); }
 
-  bool ServiceInfo::reposToDisableEmpty() const                                                { return _pimpl->_reposToDisable.empty(); }
-  ServiceInfo::ReposToDisable::size_type ServiceInfo::reposToDisableSize() const       { return _pimpl->_reposToDisable.size(); }
-  ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableBegin() const { return _pimpl->_reposToDisable.begin(); }
-  ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableEnd() const   { return _pimpl->_reposToDisable.end(); }
+  ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableBegin() const
+  { return _pimpl->reposToDisable.begin(); }
+
+  ServiceInfo::ReposToDisable::const_iterator ServiceInfo::reposToDisableEnd() const
+  { return _pimpl->reposToDisable.end(); }
 
   bool ServiceInfo::repoToDisableFind( const std::string & alias_r ) const
-  { return( _pimpl->_reposToDisable.find( alias_r ) != _pimpl->_reposToDisable.end() ); }
+  { return( _pimpl->reposToDisable.find( alias_r ) != _pimpl->reposToDisable.end() ); }
 
   void ServiceInfo::addRepoToDisable( const std::string & alias_r )
   {
-    _pimpl->_reposToDisable.insert( alias_r );
-    _pimpl->_reposToEnable.erase( alias_r );
+    _pimpl->reposToDisable.insert( alias_r );
+    _pimpl->reposToEnable.erase( alias_r );
   }
 
   void ServiceInfo::delRepoToDisable( const std::string & alias_r )
-  { _pimpl->_reposToDisable.erase( alias_r ); }
+  { _pimpl->reposToDisable.erase( alias_r ); }
 
   void ServiceInfo::clearReposToDisable()
-  { _pimpl->_reposToDisable.clear(); }
-
+  { _pimpl->reposToDisable.clear(); }
 
-  const ServiceInfo::RepoStates & ServiceInfo::repoStates() const      { return _pimpl->_repoStates; }
-  void ServiceInfo::setRepoStates( RepoStates newStates_r )            { swap( _pimpl->_repoStates, newStates_r ); }
+  const ServiceInfo::RepoStates & ServiceInfo::repoStates() const
+  { return _pimpl->repoStates; }
 
+  void ServiceInfo::setRepoStates( RepoStates newStates_r )
+  { swap( _pimpl->repoStates, newStates_r ); }
 
   std::ostream & operator<<( std::ostream & str, const ServiceInfo::RepoState & obj )
   {
@@ -176,12 +188,6 @@ namespace zypp
       << "url = " << rawUrl() << endl
       << "type = " << type() << endl;
 
-    if ( ttl() )
-      str << "ttl_sec = " << ttl() << endl;
-
-    if ( lrf() )
-      str << "lrf_dat = " << lrf().asSeconds() << endl;
-
     if ( ! repoStates().empty() )
     {
       unsigned cnt = 0U;
@@ -216,8 +222,7 @@ namespace zypp
       << " enabled=\"" << enabled() << "\""
       << " autorefresh=\"" << autorefresh() << "\""
       << " url=\"" << escape(url().asString()) << "\""
-      << " type=\"" << type().asString() << "\""
-      << " ttl_sec=\"" << ttl() << "\"";
+      << " type=\"" << type().asString() << "\"";
 
     if (content.empty())
       str << "/>" << endl;