Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / ResObject.cc
index 0f374b2..3d7662a 100644 (file)
@@ -9,82 +9,54 @@
 /** \file      zypp/ResObject.cc
  *
 */
+
 #include "zypp/ResObject.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/ResObjectImplIf.h"
 
+using namespace zypp;
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
-{ /////////////////////////////////////////////////////////////////
+{
+
+  IMPL_PTR_TYPE(ResObject);
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : ResObject::ResObject
-  //   METHOD TYPE : Ctor
-  //
-  ResObject::ResObject( const Kind & kind_r,
-                        const NVRAD & nvrad_r )
-  : Resolvable( kind_r, nvrad_r )
+  ResObject::ResObject( const sat::Solvable & solvable_r )
+  : Resolvable( solvable_r )
   {}
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : ResObject::~ResObject
-  //   METHOD TYPE : Dtor
-  //
   ResObject::~ResObject()
   {}
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   ResObject interface forwarded to implementation
-  //
-  ///////////////////////////////////////////////////////////////////
-
-  Text ResObject::summary() const
-  { return pimpl().summary().text(); }
-
-  Text ResObject::description() const
-  { return pimpl().description().text(); }
-
-  Text ResObject::insnotify() const
-  { return pimpl().insnotify().text(); }
-
-  Text ResObject::delnotify() const
-  { return pimpl().delnotify().text(); }
-
-  License ResObject::licenseToConfirm() const
-  { return pimpl().licenseToConfirm().text(); }
-
-  Vendor ResObject::vendor() const
-  { return pimpl().vendor(); }
-
-  ByteCount ResObject::size() const
-  { return pimpl().size(); }
+  std::ostream & ResObject::dumpOn( std::ostream & str ) const
+  {
+    return Resolvable::dumpOn( str );
+  }
 
-  ByteCount ResObject::archivesize() const
-  { return pimpl().archivesize(); }
-
-  Source_Ref ResObject::source() const
-  { return pimpl().source(); }
-
-  unsigned ResObject::sourceMediaNr() const
-  { return pimpl().sourceMediaNr(); }
-
-  bool ResObject::installOnly() const
-  { return pimpl().installOnly(); }
-
-  Date ResObject::buildtime() const
-  { return pimpl().buildtime(); }
-
-  Date ResObject::installtime() const
-  { return pimpl().installtime(); }
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
 
-  ZmdId ResObject::zmdid () const
-  { return pimpl().zmdid(); }
+#include "zypp/ResObjects.h"
 
-  /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{
+  ResObject::Ptr makeResObject( const sat::Solvable & solvable_r )
+  {
+    if ( ! solvable_r )
+      return 0;
+
+    ResKind kind( solvable_r.kind() );
+#define OUTS(X)  if ( kind == ResTraits<X>::kind ) return make<X>( solvable_r );
+    OUTS( Package );
+    OUTS( Patch );
+    OUTS( Pattern );
+    OUTS( Product );
+    OUTS( SrcPackage );
+    OUTS( Application );
+#undef OUTS
+    // unknow => return a plain ResObject
+    return new ResObject( solvable_r );
+  }
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////