Author: mlandres Date: Fri Sep 12 13:56:18 2008 New Revision: 11034 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11034&view=rev Log: - Add url lists query to Product interface. A generic query and convenience methods to query urls for "releasenotes", "register", "updateurls", "extraurls", "optionalurls" and "smolt" Modified: trunk/libzypp/VERSION.cmake trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/Product.cc trunk/libzypp/zypp/Product.h Modified: trunk/libzypp/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=11034&r1=11033&r2=11034&view=diff ============================================================================== --- trunk/libzypp/VERSION.cmake (original) +++ trunk/libzypp/VERSION.cmake Fri Sep 12 13:56:18 2008 @@ -59,7 +59,7 @@ # changes file. See './mkChangelog -h' for help. # SET(LIBZYPP_MAJOR "5") -SET(LIBZYPP_COMPATMINOR "8") +SET(LIBZYPP_COMPATMINOR "10") SET(LIBZYPP_MINOR "10") SET(LIBZYPP_PATCH "0") # Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=11034&r1=11033&r2=11034&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Fri Sep 12 13:56:18 2008 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Fri Sep 12 12:59:50 CEST 2008 - ma@suse.de + +- Add url lists query to Product interface. A generic query and + convenience methods to query urls for "releasenotes", "register", + "updateurls", "extraurls", "optionalurls" and "smolt" +- revision 11029 + +------------------------------------------------------------------- Fri Sep 12 01:38:25 CEST 2008 - jkupec@suse.cz - ServiceType and ServiceInfo::type() added (contains only RIS for Modified: trunk/libzypp/zypp/Product.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Product.cc?rev=11034&r1=11033&r2=11034&view=diff ============================================================================== --- trunk/libzypp/zypp/Product.cc (original) +++ trunk/libzypp/zypp/Product.cc Fri Sep 12 13:56:18 2008 @@ -144,42 +144,31 @@ std::string Product::updaterepoKey() const { return lookupStrAttribute( sat::SolvAttr::productUpdaterepoKey ); } - Url Product::releaseNotesUrl() const - { - std::list<Url> ret; - fillList( ret, satSolvable(), sat::SolvAttr::productRelnotesurl ); - if ( ! ret.empty() ) - return ret.front(); - return Url(); - } - - std::list<Url> Product::updateUrls() const + std::liststd::string Product::flags() const { - std::list<Url> ret; - fillList( ret, satSolvable(), sat::SolvAttr::productUpdateurls ); + std::liststd::string ret; + fillList( ret, satSolvable(), sat::SolvAttr::productFlags ); return ret; } - std::list<Url> Product::extraUrls() const - { - std::list<Url> ret; - fillList( ret, satSolvable(), sat::SolvAttr::productExtraurls ); - return ret; - } + ///////////////////////////////////////////////////////////////// - std::list<Url> Product::optionalUrls() const + Product::UrlList Product::urls( const std::string & key_r ) const { - std::list<Url> ret; - fillList( ret, satSolvable(), sat::SolvAttr::productOptionalurls ); + UrlList ret; +#warning IMPLEMENT PRODUCT URLS return ret; } - std::liststd::string Product::flags() const - { - std::liststd::string ret; - fillList( ret, satSolvable(), sat::SolvAttr::productFlags ); - return ret; - } + Product::UrlList Product::releaseNotesUrls() const { return urls( "releasenotes" ); } + Product::UrlList Product::registerUrls() const { return urls( "register" ); } + Product::UrlList Product::smoltUrls() const { return urls( "smolt" ); } + Product::UrlList Product::updateUrls() const { return urls( "updateurls" ); } + Product::UrlList Product::extraUrls() const { return urls( "extraurls" ); } + Product::UrlList Product::optionalUrls() const { return urls( "optionalurls" ); } + + std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj ) + { return dumpRange( str << obj.key() << ' ', obj.begin(), obj.end() ); } ///////////////////////////////////////////////////////////////// } // namespace zypp Modified: trunk/libzypp/zypp/Product.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Product.h?rev=11034&r1=11033&r2=11034&view=diff ============================================================================== --- trunk/libzypp/zypp/Product.h (original) +++ trunk/libzypp/zypp/Product.h Fri Sep 12 13:56:18 2008 @@ -73,30 +73,48 @@ */ std::string updaterepoKey() const; - /** The URL to download the release notes for this product */ - Url releaseNotesUrl() const; + /** The product flags */ + std::liststd::string flags() const; + + public: + /***/ + class UrlList; + + /** Rerieve urls flagged with \c key_r for this product. + * + * This is the most common interface. There are convenience methods for + * wellknown flags like \c "releasenotes", \c "register", \c "updateurls", + * \c "extraurls", \c "optionalurls" and \c "smolt" below. + */ + UrlList urls( const std::string & key_r ) const; + + /** The URL to download the release notes for this product. */ + UrlList releaseNotesUrls() const; + + /** The URL for registration. */ + UrlList registerUrls() const; + + /** The URL for SMOLT \see http://smolts.org/wiki/Main_Page. */ + UrlList smoltUrls() const; /** * Online updates for the product. * They are complementary, not alternatives. #163192 */ - std::list<Url> updateUrls() const; + UrlList updateUrls() const; /** * Additional software for the product * They are complementary, not alternatives. */ - std::list<Url> extraUrls() const; + UrlList extraUrls() const; /** - * Optional software for the product + * Optional software for the product. * (for example. Non OSS repositories) * They are complementary, not alternatives. */ - std::list<Url> optionalUrls() const; - - /** The product flags */ - std::liststd::string flags() const; + UrlList optionalUrls() const; protected: friend Ptr make<Self>( const sat::Solvable & solvable_r ); @@ -106,6 +124,52 @@ virtual ~Product(); }; + /** Helper to iterate a products URL lists. + * \ref first is a convenience for 'lists' with just + * one entry (e.g. releaseNotesUrls) + */ + class Product::UrlList + { + private: + /** \todo Change to directly iterate the .solv */ + typedef std::list<Url> ListType; + + public: + typedef ListType::value_type value_type; + typedef ListType::size_type size_type; + typedef ListType::const_iterator const_iterator; + + bool empty() const + { return _list.empty(); } + + size_type size() const + { return _list.size(); } + + const_iterator begin() const + { return _list.begin(); } + + const_iterator end() const + { return _list.end(); } + + /** The first Url or an empty Url. */ + Url first() const + { return empty() ? value_type() : _list.front(); } + + public: + /** The key used to retrieve this list (for debug) */ + std::string key() const + { return _key; } + + private: + friend class Product; + /** Change to directly iterate the .solv */ + std::string _key; + ListType _list; + }; + + /** \relates Product::UrlList Stream output. */ + std::ostream & operator<<( std::ostream & str, const Product::UrlList & obj ); + ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org