Pathname Pattern::script() const
{ return pimpl().script(); }
+ std::set<std::string> Pattern::install_packages( const Locale & lang ) const
+ {
+ return pimpl().install_packages();
+ }
/////////////////////////////////////////////////////////////////
} // namespace zypp
/** */
Pathname script() const;
/** */
- // data here:
+
+ std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
protected:
/** Ctor */
return pimpl().order();
}
- std::set<std::string> Selection::suggests() const
- {
- return pimpl().suggests();
- }
-
- std::set<std::string> Selection::recommends() const
- {
- return pimpl().recommends();
- }
-
- std::set<std::string> Selection::install_packages( const Locale & lang) const
+ std::set<std::string> Selection::install_packages( const Locale & lang ) const
{
return pimpl().install_packages();
}
/** selection presentation order */
Label order() const;
- std::set<std::string> suggests() const;
- std::set<std::string> recommends() const;
std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
protected:
Pathname PatternImplIf::script() const
{ return Pathname(); }
+ static void copycaps( std::set<std::string> & out, const CapSet & in)
+ {
+ for (CapSet::const_iterator it = in.begin(); it != in.end(); ++it) {
+ if (isKind<capability::NamedCap>( *it )
+ && it->refers() == ResTraits<zypp::Package>::kind )
+ {
+ out.insert( it->index() );
+ }
+ }
+ }
+
+ std::set<std::string> PatternImplIf::install_packages( const Locale & lang) const
+ {
+ std::set<std::string> result;
+
+ copycaps( result, self()->dep( Dep::REQUIRES ) );
+ copycaps( result, self()->dep( Dep::RECOMMENDS) );
+
+ return result;
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
virtual Pathname icon() const PURE_VIRTUAL;
virtual Pathname script() const PURE_VIRTUAL;
+
+ /** ui helper */
+ virtual std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
};
///////////////////////////////////////////////////////////////////
*
*/
#include "zypp/detail/SelectionImplIf.h"
+#include "zypp/ResTraits.h"
#include <iostream>
using namespace std;
Label SelectionImplIf::order() const
{ return Label(); }
- std::set<std::string> SelectionImplIf::suggests() const
- { return std::set<std::string>(); }
-
- std::set<std::string> SelectionImplIf::recommends() const
- { return std::set<std::string>(); }
+ static void copycaps( std::set<std::string> & out, const CapSet & in)
+ {
+ for (CapSet::const_iterator it = in.begin(); it != in.end(); ++it) {
+ if (isKind<capability::NamedCap>( *it )
+ && it->refers() == ResTraits<zypp::Package>::kind )
+ {
+ out.insert( it->index() );
+ }
+ }
+ }
std::set<std::string> SelectionImplIf::install_packages( const Locale & lang) const
- { return std::set<std::string>(); }
+ {
+ std::set<std::string> result;
+#warning does not honor language packs
+ copycaps( result, self()->dep( Dep::REQUIRES ) );
+ copycaps( result, self()->dep( Dep::RECOMMENDS) );
+
+ return result;
+ }
/////////////////////////////////////////////////////////////////
} // namespace detail
/** */
virtual Label order() const PURE_VIRTUAL;
- virtual std::set<std::string> suggests() const PURE_VIRTUAL;
- virtual std::set<std::string> recommends() const PURE_VIRTUAL;
- virtual std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
+ /** ui helper */
+ virtual std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
#if 0
// NOTE LangCode id zypp:Locale
out << " <description>"<< (obj->description()) << "</description>" << std::endl;
- out << " <grouplist>" << std::endl;
- //recommended selections
- std::set<std::string> rec_sel = obj->recommends();
- std::set<std::string>::const_iterator it;
- for (it = rec_sel.begin(); it != rec_sel.end(); ++it)
- out << " <metapkg type=\"optional\">" << *it << "</metapkg>" << std::endl;
-
- std::set<std::string> sug_sel = obj->suggests();
- it = sug_sel.begin();
- for (; it != sug_sel.end(); ++it)
- out << " <metapkg type=\"optional\">" << *it << "</metapkg>" << std::endl;
-
- out << " </grouplist>" << std::endl;
-
- out << " <packagelist>" << std::endl;
-
- std::set<std::string> ins_pkg = obj->install_packages();
- it = ins_pkg.begin();
- for (; it != ins_pkg.end(); ++it)
- {
- out << " <packagereq type=\"optional\">" << *it << "</packagereq>" << std::endl;
- }
- out << " </packagelist>" << std::endl;
out << " </group>" << std::endl;
out << "</groups>" << std::endl;
return out.str();