#include <iostream>
-#include <fstream>
-#include <iterator>
-#include <algorithm>
-#include <set>
-#include <map>
-#include <list>
-#include <vector>
-#include <ext/hash_set>
-#include <ext/hash_map>
-#include <ext/rope>
-
+#include <string>
#include <zypp/base/Logger.h>
-#include <zypp/base/String.h>
-
-///////////////////////////////////////////////////////////////////
-
-#include <zypp/Resolvable.h>
-
-namespace zypp
-{
- namespace detail
- {
- class PackageImpl;
- typedef base::shared_ptr<PackageImpl> PackageImplPtr;
- }
-
- class Package : public Resolvable
- {
- public:
- Package();
- Package( detail::PackageImplPtr impl_r );
- ~Package();
- const std::string & label() const;
- private:
- /** Pointer to implementation */
- detail::PackageImplPtr _pimpl;
- };
-}
-
-///////////////////////////////////////////////////////////////////
-
-#include <zypp/detail/ResolvableImpl.h>
-
-namespace zypp
-{
- namespace detail
- {
- class PackageImpl
- {
- public:
- PackageImpl()
- {}
-
- ResolvableImplPtr _resolvable;
- std::string _label;
- };
- }
-
- Package::Package()
- : _pimpl( new detail::PackageImpl )
- {}
- Package::Package( detail::PackageImplPtr impl_r )
- : Resolvable( impl_r->_resolvable )
- , _pimpl( impl_r )
- {}
- Package::~Package()
- {}
- const std::string & Package::label() const
- { return _pimpl->_label; }
-
-}
-
-///////////////////////////////////////////////////////////////////
+#include <zypp/detail/PackageImpl.h>
+#include <zypp/Package.h>
using namespace std;
using namespace zypp;
+using namespace base;
/******************************************************************
**
{
INT << "===[START]==========================================" << endl;
- detail::PackageImplPtr pi( new detail::PackageImpl );
- pi->_resolvable.reset( new detail::ResolvableImpl( ResKind("PKG"),
- ResName("foo"),
- ResEdition("1.0","42"),
- ResArch("noarch") ) );
- pi->_label = "label for foo";
+ ResName _name( "foo" );
+ ResEdition _edition( "1.0", "42" );
+ ResArch _arch( "i386" );
+
+
+ detail::PackageImplPtr pi( new detail::PackageImpl(_name,_edition,_arch) );
+ DBG << pi << endl;
+ DBG << *pi << endl;
+ constPackagePtr foo( new Package( pi ) );
+ DBG << foo << endl;
+ DBG << *foo << endl;
+
- Package p( pi );
+ detail::constPackageImplPtr c( pi );
+ detail::PackageImplPtr cc( const_pointer_cast<detail::PackageImpl>(c) );
- DBG << p << endl;
- DBG << " \"" << p.label() << "\"" << endl;
INT << "===[END]============================================" << endl;
return 0;
ResName.h \
ResArch.h \
ResEdition.h \
- Resolvable.h
+ Resolvable.h \
+ Package.h \
+ Selection.h
## ##################################################
ResName.cc \
ResArch.cc \
ResEdition.cc \
- Resolvable.cc
+ Resolvable.cc \
+ Package.cc \
+ Selection.cc
lib@PACKAGE@_la_LDFLAGS = @LIB_VERSION_INFO@
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/Package.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/Package.h"
+#include "zypp/detail/PackageImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Package::Package
+ // METHOD TYPE : Ctor
+ //
+ Package::Package( detail::PackageImplPtr impl_r )
+ : Resolvable( impl_r )
+ , _pimpl( impl_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Package::~Package
+ // METHOD TYPE : Dtor
+ //
+ Package::~Package()
+ {}
+
+ std::string Package::summary() const
+ { return _pimpl->summary(); }
+
+ std::list<std::string> Package::description() const
+ { return _pimpl->description(); }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/Package.h
+ *
+*/
+#ifndef ZYPP_PACKAGE_H
+#define ZYPP_PACKAGE_H
+
+#include <list>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+
+#include "zypp/Resolvable.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ { /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(PackageImpl)
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(Package)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : Package
+ //
+ /** */
+ class Package : public Resolvable
+ {
+ public:
+ /** Default ctor */
+ Package( detail::PackageImplPtr impl_r );
+ /** Dtor */
+ virtual ~Package();
+
+ public:
+
+ /** */
+ std::string summary() const;
+ /** */
+ std::list<std::string> description() const;
+
+ private:
+ /** Pointer to implementation */
+ detail::PackageImplPtr _pimpl;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PACKAGE_H
*/
#include <iostream>
-#include "zypp/base/Logger.h"
#include "zypp/Resolvable.h"
#include "zypp/detail/ResolvableImpl.h"
// METHOD NAME : Resolvable::Resolvable
// METHOD TYPE : Ctor
//
- Resolvable::Resolvable()
- : _pimpl( new detail::ResolvableImpl )
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : Resolvable::Resolvable
- // METHOD TYPE : Ctor
- //
Resolvable::Resolvable( detail::ResolvableImplPtr impl_r )
: _pimpl( impl_r )
{}
const ResArch & Resolvable::arch() const
{ return _pimpl->arch(); }
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Resolvable::~Resolvable
+ // METHOD TYPE : Dtor
+ //
+ detail::constResolvableImplPtr Resolvable::sayFriend() const
+ { return _pimpl; }
+
/******************************************************************
**
** FUNCTION NAME : operator<<
*/
std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
{
- str << '[' << obj.kind() << ']' << obj.name() << '-' << obj.edition() << '.' << obj.arch();
- return str;
+ return str << *obj.sayFriend();
}
/////////////////////////////////////////////////////////////////
#include <iosfwd>
-#include "zypp/base/PtrTypes.h"
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
-
- class ResKind;
- class ResName;
- class ResEdition;
- class ResArch;
-
///////////////////////////////////////////////////////////////////
namespace detail
{ /////////////////////////////////////////////////////////////////
- /** Hides implementation */
- class ResolvableImpl;
- typedef base::shared_ptr<ResolvableImpl> ResolvableImplPtr;
+ DEFINE_PTR_TYPE(ResolvableImpl)
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(Resolvable)
+
+ class ResKind;
+ class ResName;
+ class ResEdition;
+ class ResArch;
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Resolvable
//
/** */
- class Resolvable
+ class Resolvable : public base::ReferenceCounted, private base::NonCopyable
{
public:
- /** Default ctor */
- Resolvable();
/** ctor */
Resolvable( detail::ResolvableImplPtr impl_r );
/** Dtor */
- ~Resolvable();
+ virtual ~Resolvable();
+
public:
/** */
const ResKind & kind() const;
const ResEdition & edition() const;
/** */
const ResArch & arch() const;
+
private:
/** Pointer to implementation */
detail::ResolvableImplPtr _pimpl;
+ public:
+ /** Avoid a bunch of friend decl. */
+ detail::constResolvableImplPtr sayFriend() const;
};
///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/Selection.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/Selection.h"
+#include "zypp/detail/SelectionImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Selection::Selection
+ // METHOD TYPE : Ctor
+ //
+ Selection::Selection( detail::SelectionImplPtr impl_r )
+ : Resolvable( impl_r )
+ , _pimpl( impl_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Selection::~Selection
+ // METHOD TYPE : Dtor
+ //
+ Selection::~Selection()
+ {}
+
+ std::string Selection::summary() const
+ { return _pimpl->summary(); }
+
+ std::list<std::string> Selection::description() const
+ { return _pimpl->description(); }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/Selection.h
+ *
+*/
+#ifndef ZYPP_SELECTION_H
+#define ZYPP_SELECTION_H
+
+#include <list>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+
+#include "zypp/Resolvable.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ { /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(SelectionImpl)
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(Selection)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : Selection
+ //
+ /** */
+ class Selection : public Resolvable
+ {
+ public:
+ /** Default ctor */
+ Selection( detail::SelectionImplPtr impl_r );
+ /** Dtor */
+ virtual ~Selection();
+
+ public:
+
+ /** */
+ std::string summary() const;
+ /** */
+ std::list<std::string> description() const;
+
+ private:
+ /** Pointer to implementation */
+ detail::SelectionImplPtr _pimpl;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SELECTION_H
## ##################################################
include_HEADERS = \
+ Logger.h \
+ NonCopyable.h \
PtrTypes.h \
+ ReferenceCounted.h \
String.h \
- Logger.h \
StringVal.h
## ##################################################
lib@PACKAGE@_base_la_SOURCES = \
- String.cc \
Logger.cc \
+ String.cc \
StringVal.cc
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/NonCopyable.h
+*/
+#ifndef ZYPP_BASE_NONCOPYABLE_H
+#define ZYPP_BASE_NONCOPYABLE_H
+
+#include <boost/noncopyable.hpp>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace base
+ { /////////////////////////////////////////////////////////////////
+
+ /** Ensure derived classes cannot be copied.
+ * Use private inheritance.
+ */
+ typedef boost::noncopyable NonCopyable;
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace base
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_BASE_NONCOPYABLE_H
| |
\---------------------------------------------------------------------*/
/** \file zypp/base/PtrTypes.h
- *
+ * \ingroup ZYPP_BASE_SMART_PTR
+ * \see ZYPP_BASE_SMART_PTR
*/
#ifndef ZYPP_BASE_PTRTYPES_H
#define ZYPP_BASE_PTRTYPES_H
namespace base
{ /////////////////////////////////////////////////////////////////
+ /** \defgroup ZYPP_BASE_SMART_PTR ZYPP_BASE_SMART_PTR
+ * Smart pointer types.
+ *
+ * Namespace zypp::base provides 3 smart pointer types \b using the
+ * boostsmart pointer library.
+ *
+ * \li \c scoped_ptr Simple sole ownership of single objects. Noncopyable.
+ *
+ * \li \c shared_ptr Object ownership shared among multiple pointers
+ *
+ * \li \c weak_ptr Non-owning observers of an object owned by shared_ptr.
+ */
+ /*@{*/
+
/** */
using boost::scoped_ptr;
/** */
using boost::weak_ptr;
+ /*@}*/
+
/////////////////////////////////////////////////////////////////
} // namespace base
///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/ReferenceCounted.h
+ *
+*/
+#ifndef ZYPP_BASE_REFERENCECOUNTED_H
+#define ZYPP_BASE_REFERENCECOUNTED_H
+
+#include <iosfwd>
+#include <boost/intrusive_ptr.hpp>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace base
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ReferenceCounted
+ //
+ /** Base class for reference counted objects.
+ * \todo Define exceptions.
+ * \todo Make counter thread safe.
+ * \todo get rid of base namesapace.
+ */
+ class ReferenceCounted
+ {
+ public:
+ /** Default ctor.
+ * Initial reference count is zero.
+ */
+ ReferenceCounted()
+ : _counter( 0 )
+ {}
+
+ /** Copy ctor.
+ * Initial reference count is zero.
+ */
+ ReferenceCounted( const ReferenceCounted & rhs )
+ : _counter( 0 )
+ {}
+
+ /** Dtor.
+ * \throw INTERNAL if reference count is not zero.
+ */
+ virtual ~ReferenceCounted()
+ { if ( _counter ) throw( "~ReferenceCounted: nonzero reference count" ); }
+
+ /** Assignment.
+ * Reference count remains untouched.
+ */
+ ReferenceCounted & operator=( const ReferenceCounted & )
+ { return *this; }
+
+ public:
+ /** Add a reference. */
+ void ref() const
+ { ++_counter; }
+
+ /** Release a reference.
+ * Deletes the object if reference count gets zero.
+ * \throw INTERNAL if reference count is zero.
+ */
+ void unref() const
+ {
+ if ( !_counter )
+ throw( "ReferenceCounted::unref: zero reference count" );
+ if ( --_counter == 0 )
+ delete this;
+ }
+
+ private:
+ /** The reference counter. */
+ mutable unsigned _counter;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** Use boost::intrusive_ptr as Ptr type*/
+ using boost::intrusive_ptr;
+ using boost::static_pointer_cast;
+ using boost::const_pointer_cast;
+ using boost::dynamic_pointer_cast;
+
+ /** Called by zypp::base::intrusive_ptr to add a reference.
+ * \relates ReferenceCounted
+ * \see ZYPP_BASE_SMART_PTR
+ */
+ inline void intrusive_ptr_add_ref( const ReferenceCounted * ptr_r )
+ { if( ptr_r ) ptr_r->ref(); }
+
+ /** Called by zypp::base::intrusive_ptr to add a reference.
+ * \relates ReferenceCounted
+ * \see ZYPP_BASE_SMART_PTR
+ */
+ inline void intrusive_ptr_release( const ReferenceCounted * ptr_r )
+ { if( ptr_r ) ptr_r->unref(); }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace base
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
+/** Forward declaration of Ptr types */
+#define DEFINE_PTR_TYPE(NAME) \
+class NAME; \
+typedef zypp::base::intrusive_ptr<NAME> NAME##Ptr; \
+typedef zypp::base::intrusive_ptr<const NAME> const##NAME##Ptr;
+
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_BASE_REFERENCECOUNTED_H
## ##################################################
-include_HEADERS = \
- ResolvableImpl.h
+include_HEADERS = \
+ ResolvableImpl.h \
+ PackageImpl.h \
+ SelectionImpl.h
noinst_LTLIBRARIES = lib@PACKAGE@_detail.la
## ##################################################
-lib@PACKAGE@_detail_la_SOURCES = \
- ResolvableImpl.cc
+lib@PACKAGE@_detail_la_SOURCES = \
+ ResolvableImpl.cc \
+ PackageImpl.cc \
+ SelectionImpl.cc
## ##################################################
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/PackageImpl.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/detail/PackageImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : PackageImpl::PackageImpl
+ // METHOD TYPE : Ctor
+ //
+ PackageImpl::PackageImpl( const ResName & name_r,
+ const ResEdition & edition_r,
+ const ResArch & arch_r )
+ : ResolvableImpl( ResKind("package"), name_r, edition_r, arch_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : PackageImpl::~PackageImpl
+ // METHOD TYPE : Dtor
+ //
+ PackageImpl::~PackageImpl()
+ {}
+
+ std::string PackageImpl::summary() const
+ { return std::string(); }
+
+ std::list<std::string> PackageImpl::description() const
+ { return std::list<std::string>(); }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/PackageImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_PACKAGEIMPL_H
+#define ZYPP_DETAIL_PACKAGEIMPL_H
+
+#include <list>
+
+#include "zypp/detail/ResolvableImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ { /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(PackageImpl)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PackageImpl
+ //
+ /** */
+ class PackageImpl : public ResolvableImpl
+ {
+ public:
+ /** */
+ PackageImpl( const ResName & name_r,
+ const ResEdition & edition_r,
+ const ResArch & arch_r );
+ /** Dtor */
+ virtual ~PackageImpl();
+
+ public:
+ /** */
+ virtual std::string summary() const;
+ /** */
+ virtual std::list<std::string> description() const;
+#if 0
+ /** */
+ virtual std::list<std::string> insnotify() const;
+ /** */
+ virtual std::list<std::string> delnotify() const;
+ /** */
+ virtual FSize size() const;
+ /** */
+ virtual bool providesSources() const;
+ /** */
+ virtual std::string instSrcLabel() const;
+ /** */
+ virtual Vendor instSrcVendor() const;
+ /** */
+ virtual unsigned instSrcRank() const;
+ /** */
+ virtual PkgSplitSet splitprovides() const;
+ /** */
+ virtual Date buildtime() const;
+ /** */
+ virtual std::string buildhost() const;
+ /** */
+ virtual Date installtime() const;
+ /** */
+ virtual std::string distribution() const;
+ /** */
+ virtual Vendor vendor() const;
+ /** */
+ virtual std::string license() const;
+ /** */
+ virtual std::list<std::string> licenseToConfirm() const;
+ /** */
+ virtual std::string packager() const;
+ /** */
+ virtual std::string group() const;
+ /** */
+ virtual YStringTreeItem * group_ptr() const;
+ /** */
+ virtual std::list<std::string> changelog() const;
+ /** */
+ virtual std::string url() const;
+ /** */
+ virtual std::string os() const;
+ /** */
+ virtual std::list<std::string> prein() const;
+ /** */
+ virtual std::list<std::string> postin() const;
+ /** */
+ virtual std::list<std::string> preun() const;
+ /** */
+ virtual std::list<std::string> postun() const;
+ /** */
+ virtual std::string sourceloc() const;
+ /** */
+ virtual FSize sourcesize() const;
+ /** */
+ virtual FSize archivesize() const;
+ /** */
+ virtual std::list<std::string> authors() const;
+ /** */
+ virtual std::list<std::string> filenames() const;
+ /** */
+ virtual std::list<std::string> recommends() const;
+ /** */
+ virtual std::list<std::string> suggests() const;
+ /** */
+ virtual std::string location() const;
+ /** */
+ virtual unsigned int medianr() const;
+ /** */
+ virtual std::list<std::string> keywords() const;
+ /** */
+ virtual std::string md5sum() const;
+ /** */
+ virtual std::string externalUrl() const;
+ /** */
+ virtual std::list<PkgEdition> patchRpmBaseVersions() const;
+ /** */
+ virtual FSize patchRpmSize() const;
+ /** */
+ virtual bool forceInstall() const;
+ /** */
+ virtual std::string patchRpmMD5() const;
+ /** */
+ virtual bool isRemote() const;
+ /** */
+ virtual PMError providePkgToInstall( Pathname& path_r ) const;
+ /** */
+ virtual PMError provideSrcPkgToInstall( Pathname& path_r ) const;
+ /** */
+ virtual constInstSrcPtr source() const;
+ /** */
+ virtual bool prefererCandidate() const;
+ /** */
+ virtual void du( PkgDu & dudata_r ) const;
+ /** */
+ virtual std::list<PMPackageDelta> deltas() const;
+#endif
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PACKAGEIMPL_H
*/
#include <iostream>
-#include "zypp/base/Logger.h"
#include "zypp/detail/ResolvableImpl.h"
using namespace std;
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : ResolvableImpl
+ // METHOD NAME : ResolvableImpl::ResolvableImpl
+ // METHOD TYPE : Ctor
//
+ ResolvableImpl::ResolvableImpl( const ResKind & kind_r,
+ const ResName & name_r,
+ const ResEdition & edition_r,
+ const ResArch & arch_r )
+ : _kind( kind_r )
+ , _name( name_r )
+ , _edition( edition_r )
+ , _arch( arch_r )
+ {}
+
///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ResolvableImpl::~ResolvableImpl
+ // METHOD TYPE : Dtor
+ //
+ ResolvableImpl::~ResolvableImpl()
+ {}
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const ResolvableImpl & obj )
+ {
+ str << '[' << obj.kind() << ']' << obj.name() << '-' << obj.edition() << '.' << obj.arch();
+ return str;
+ }
/////////////////////////////////////////////////////////////////
} // namespace detail
#ifndef ZYPP_DETAIL_RESOLVABLEIMPL_H
#define ZYPP_DETAIL_RESOLVABLEIMPL_H
-#include <iosfwd>
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
#include "zypp/ResKind.h"
#include "zypp/ResName.h"
///////////////////////////////////////////////////////////////////
namespace detail
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(ResolvableImpl)
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ResolvableImpl
//
/** */
- class ResolvableImpl
+ class ResolvableImpl : public base::ReferenceCounted, private base::NonCopyable
{
public:
- /** Default ctor */
- ResolvableImpl()
- {}
/** ctor */
ResolvableImpl( const ResKind & kind_r,
const ResName & name_r,
const ResEdition & edition_r,
- const ResArch & arch_r )
- : _kind( kind_r )
- , _name( name_r )
- , _edition( edition_r )
- , _arch( arch_r )
- {}
+ const ResArch & arch_r );
/** Dtor */
- ~ResolvableImpl()
- {}
+ virtual ~ResolvableImpl();
+
public:
/** */
const ResKind & kind() const
/** */
const ResArch & arch() const
{ return _arch; }
+
private:
+ /** */
ResKind _kind;
+ /** */
ResName _name;
+ /** */
ResEdition _edition;
+ /** */
ResArch _arch;
};
///////////////////////////////////////////////////////////////////
+ /** \relates ResolvableImpl Stream output */
+ extern std::ostream & operator<<( std::ostream & str, const ResolvableImpl & obj );
+
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/SelectionImpl.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/detail/SelectionImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : SelectionImpl::SelectionImpl
+ // METHOD TYPE : Ctor
+ //
+ SelectionImpl::SelectionImpl( const ResName & name_r,
+ const ResEdition & edition_r,
+ const ResArch & arch_r )
+ : ResolvableImpl( ResKind("selection"), name_r, edition_r, arch_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : SelectionImpl::~SelectionImpl
+ // METHOD TYPE : Dtor
+ //
+ SelectionImpl::~SelectionImpl()
+ {}
+
+ std::string SelectionImpl::summary() const
+ { return std::string(); }
+
+ std::list<std::string> SelectionImpl::description() const
+ { return std::list<std::string>(); }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/SelectionImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_SELECTIONIMPL_H
+#define ZYPP_DETAIL_SELECTIONIMPL_H
+
+#include <list>
+
+#include "zypp/detail/ResolvableImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ { /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(SelectionImpl)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : SelectionImpl
+ //
+ /** */
+ class SelectionImpl : public ResolvableImpl
+ {
+ public:
+ /** */
+ SelectionImpl( const ResName & name_r,
+ const ResEdition & edition_r,
+ const ResArch & arch_r );
+ /** Dtor */
+ virtual ~SelectionImpl();
+
+ public:
+ /** */
+ virtual std::string summary() const;
+ /** */
+ virtual std::list<std::string> description() const;
+#if 0
+ virtual std::string summary( const LangCode & lang = LangCode("") ) const;
+ virtual std::list<std::string> description( const LangCode & lang = LangCode("") ) const;
+ virtual std::list<std::string> insnotify( const LangCode & lang = LangCode("") ) const;
+ virtual std::list<std::string> delnotify( const LangCode & lang = LangCode("") ) const;
+ virtual FSize size() const;
+ virtual bool providesSources() const;
+ virtual std::string instSrcLabel() const;
+ virtual Vendor instSrcVendor() const;
+ virtual unsigned instSrcRank() const;
+ virtual std::string category() const;
+ virtual bool visible() const;
+ virtual std::list<std::string> suggests() const;
+ virtual std::list<PMSelectionPtr> suggests_ptrs() const;
+ virtual std::list<std::string> recommends() const;
+ virtual std::list<PMSelectionPtr> recommends_ptrs() const;
+ virtual std::list<std::string> inspacks( const LangCode & lang = LangCode("") ) const;
+ virtual std::list<std::string> delpacks( const LangCode & lang = LangCode("") ) const;
+ virtual PM::LocaleSet supportedLocales() const;
+ virtual std::set<PMSelectablePtr> pureInspacks_ptrs( const LangCode & lang ) const;
+ virtual std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & lang ) const;
+ virtual std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & lang ) const;
+ virtual FSize archivesize() const;
+ virtual std::string order() const;
+ virtual bool isBase() const;
+ virtual PMError provideSelToInstall( Pathname & path_r ) const;
+#endif
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_SELECTIONIMPL_H