remove superfluous base classes in RepoInfo/ServiceInfo::Impl
authorMichael Andres <ma@suse.de>
Wed, 9 Jul 2014 09:11:32 +0000 (11:11 +0200)
committerMichael Andres <ma@suse.de>
Wed, 9 Jul 2014 09:11:32 +0000 (11:11 +0200)
zypp/CMakeLists.txt
zypp/RepoInfo.cc
zypp/ServiceInfo.cc
zypp/repo/RepoInfoBase.cc
zypp/repo/RepoInfoBaseImpl.h [deleted file]

index fd6dfcd..c8474fd 100644 (file)
@@ -756,7 +756,6 @@ SET( zypp_repo_HEADERS
   repo/Downloader.h
   repo/RepoVariables.h
   repo/RepoInfoBase.h
-  repo/RepoInfoBaseImpl.h
   repo/PluginServices.h
   repo/ServiceRepos.h
 )
index 470da71..5d820da 100644 (file)
@@ -17,7 +17,8 @@
 #include "zypp/parser/xml/XmlEscape.h"
 
 #include "zypp/RepoInfo.h"
-#include "zypp/repo/RepoInfoBaseImpl.h"
+#include "zypp/TriBool.h"
+#include "zypp/Pathname.h"
 #include "zypp/repo/RepoMirrorList.h"
 #include "zypp/ExternalProgram.h"
 #include "zypp/media/MediaAccess.h"
@@ -34,11 +35,10 @@ namespace zypp
   //   CLASS NAME : RepoInfo::Impl
   //
   /** RepoInfo implementation. */
-  struct RepoInfo::Impl : public repo::RepoInfoBase::Impl
+  struct RepoInfo::Impl
   {
     Impl()
-      : repo::RepoInfoBase::Impl()
-      , gpgcheck(indeterminate)
+      : gpgcheck(indeterminate)
       ,        keeppackages(indeterminate)
       , type(repo::RepoType::NONE_e)
       , emptybaseurls(false)
index 11220d3..470396c 100644 (file)
@@ -16,8 +16,6 @@
 #include "zypp/parser/xml/XmlEscape.h"
 
 #include "zypp/RepoInfo.h"
-#include "zypp/repo/RepoInfoBaseImpl.h"
-
 #include "zypp/ServiceInfo.h"
 
 using namespace std;
@@ -31,7 +29,7 @@ namespace zypp
   //
   //  CLASS NAME : ServiceInfo::Impl
   //
-  struct ServiceInfo::Impl : public repo::RepoInfoBase::Impl
+  struct ServiceInfo::Impl
   {
     typedef ServiceInfo::ReposToEnable  ReposToEnable;
     typedef ServiceInfo::ReposToDisable ReposToDisable;
@@ -46,13 +44,11 @@ namespace zypp
 
   public:
     Impl()
-      : repo::RepoInfoBase::Impl()
-      , type(repo::ServiceType::NONE_e)
+      : type(repo::ServiceType::NONE_e)
     {}
 
     Impl(const Url & url_)
-      : repo::RepoInfoBase::Impl()
-      , url(url_)
+      : url(url_)
       , type(repo::ServiceType::NONE_e)
     {}
 
index d0ac421..367a836 100644 (file)
 #include "zypp/repo/RepoVariables.h"
 
 #include "zypp/repo/RepoInfoBase.h"
-#include "zypp/repo/RepoInfoBaseImpl.h"
+#include "zypp/TriBool.h"
+#include "zypp/Pathname.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
-{ /////////////////////////////////////////////////////////////////
+{
   ///////////////////////////////////////////////////////////////////
   namespace repo
-  { /////////////////////////////////////////////////////////////////
+  {
 
   ///////////////////////////////////////////////////////////////////
-  //
-  //    CLASS NAME : RepoInfoBase::Impl
-  //
+  /// \class RepoInfoBase::Impl
+  /// \brief RepoInfoBase data
   ///////////////////////////////////////////////////////////////////
-
-  /** \relates RepoInfo::Impl Stream output */
-  inline std::ostream & operator<<( std::ostream & str, const RepoInfoBase::Impl & obj )
+  struct RepoInfoBase::Impl
   {
-    return str << "RepoInfo::Impl";
-  }
-
-  void RepoInfoBase::Impl::setAlias(const string & alias_)
-  {
-    this->alias = alias_;
-    // replace slashes with underscores
-    std::string fnd="/";
-    std::string rep="_";
-    std::string escaped_alias = alias_;
-    size_t pos = escaped_alias.find(fnd);
-    while (pos != string::npos)
+    Impl()
+      : _enabled( indeterminate )
+      , _autorefresh( indeterminate )
+    {}
+
+    Impl( const std::string & alias_r )
+      : _enabled( indeterminate )
+      , _autorefresh( indeterminate )
+    { setAlias( alias_r ); }
+
+  public:
+    TriBool    _enabled;
+    TriBool    _autorefresh;
+    std::string        _alias;
+    std::string        _escaped_alias;
+    std::string        _name;
+    Pathname   _filepath;
+
+  public:
+
+    void setAlias( const std::string & alias_r )
     {
-      escaped_alias.replace(pos, fnd.length(), rep);
-      pos = escaped_alias.find(fnd, pos+rep.length());
+      _alias = _escaped_alias = alias_r;
+      // replace slashes with underscores
+      str::replaceAll( _escaped_alias, "/", "_" );
     }
-    this->escaped_alias = escaped_alias;
-  }
+
+  private:
+    friend Impl * rwcowClone<Impl>( const Impl * rhs );
+    /** clone for RWCOW_pointer */
+    Impl * clone() const
+    { return new Impl( *this ); }
+  };
+  ///////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
   //
@@ -60,80 +74,51 @@ namespace zypp
   //
   ///////////////////////////////////////////////////////////////////
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //    METHOD NAME : RepoInfoBase::RepoInfoBase
-  //    METHOD TYPE : Ctor
-  //
   RepoInfoBase::RepoInfoBase()
     : _pimpl( new Impl() )
   {}
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //    METHOD NAME : RepoInfoBase::RepoInfoBase
-  //    METHOD TYPE : Ctor
-  //
   RepoInfoBase::RepoInfoBase(const string & alias)
     : _pimpl( new Impl(alias) )
   {}
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //    METHOD NAME : RepoInfoBase::~RepoInfoBase
-  //    METHOD TYPE : Dtor
-  //
   RepoInfoBase::~RepoInfoBase()
   {}
 
   void RepoInfoBase::setEnabled( bool enabled )
-  {
-    _pimpl->enabled = enabled;
-  }
+  { _pimpl->_enabled = enabled; }
 
   void RepoInfoBase::setAutorefresh( bool autorefresh )
-  {
-    _pimpl->autorefresh = autorefresh;
-  }
+  { _pimpl->_autorefresh = autorefresh; }
 
   void RepoInfoBase::setAlias( const std::string &alias )
-  {
-    _pimpl->setAlias(alias);
-  }
+  { _pimpl->setAlias(alias); }
 
   void RepoInfoBase::setName( const std::string &name )
-  {
-    _pimpl->name = name;
-  }
+  { _pimpl->_name = name; }
 
   void RepoInfoBase::setFilepath( const Pathname &filepath )
-  {
-    _pimpl->filepath = filepath;
-  }
+  { _pimpl->_filepath = filepath; }
 
   // true by default (if not set by setEnabled())
   bool RepoInfoBase::enabled() const
-  { return indeterminate(_pimpl->enabled) ? true : (bool) _pimpl->enabled; }
+  { return indeterminate(_pimpl->_enabled) ? true : (bool) _pimpl->_enabled; }
 
   // false by default (if not set by setAutorefresh())
   bool RepoInfoBase::autorefresh() const
-  { return indeterminate(_pimpl->autorefresh) ? false : (bool) _pimpl->autorefresh; }
+  { return indeterminate(_pimpl->_autorefresh) ? false : (bool) _pimpl->_autorefresh; }
 
   std::string RepoInfoBase::alias() const
-  { return _pimpl->alias; }
+  { return _pimpl->_alias; }
 
   std::string RepoInfoBase::escaped_alias() const
-  { return _pimpl->escaped_alias; }
+  { return _pimpl->_escaped_alias; }
 
   std::string RepoInfoBase::name() const
   {
-    if ( _pimpl->name.empty() )
-    {
+    if ( _pimpl->_name.empty() )
       return alias();
-    }
-
-    repo::RepoVariablesStringReplacer replacer;
-    return replacer(_pimpl->name);
+    return repo::RepoVariablesStringReplacer()( _pimpl->_name );
   }
 
   std::string RepoInfoBase::label() const
@@ -144,7 +129,7 @@ namespace zypp
   }
 
   Pathname RepoInfoBase::filepath() const
-  { return _pimpl->filepath; }
+  { return _pimpl->_filepath; }
 
 
   std::ostream & RepoInfoBase::dumpOn( std::ostream & str ) const
@@ -178,11 +163,8 @@ namespace zypp
   {
     return obj.dumpOn(str);
   }
-  ///////////////////////////////////////////////////////////////////
 
-    /////////////////////////////////////////////////////////////////
   } // namespace repo
   ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
diff --git a/zypp/repo/RepoInfoBaseImpl.h b/zypp/repo/RepoInfoBaseImpl.h
deleted file mode 100644 (file)
index 7d0592e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file       zypp/repo/RepoInfoBaseImpl.h
- *
- */
-#ifndef REPOINFOBASEIMPL_H_
-#define REPOINFOBASEIMPL_H_
-
-#include <string>
-
-#include "zypp/TriBool.h"
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace repo
-  { /////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //    CLASS NAME : RepoInfoBase::Impl
-  //
-  struct RepoInfoBase::Impl
-  {
-    Impl()
-      : enabled (indeterminate)
-      , autorefresh (indeterminate)
-    {}
-
-    Impl(const std::string & alias_)
-      : enabled(indeterminate)
-      , autorefresh(indeterminate)
-    { setAlias(alias_); }
-
-    ~Impl()
-    {}
-
-  public:
-    TriBool enabled;
-    TriBool autorefresh;
-    std::string alias;
-    std::string escaped_alias;
-    std::string name;
-    Pathname filepath;
-  public:
-
-    void setAlias(const std::string & alias_);
-
-  private:
-    friend Impl * rwcowClone<Impl>( const Impl * rhs );
-    /** clone for RWCOW_pointer */
-    Impl * clone() const
-    { return new Impl( *this ); }
-  };
-  ///////////////////////////////////////////////////////////////////
-
-    /////////////////////////////////////////////////////////////////
-  } // namespace repo
-  ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-
-#endif /*REPOINFOBASEIMPL_H_*/