From ea808bd9638aeea3e79e160900db76ee2df70afa Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 12 Sep 2008 14:33:26 +0000 Subject: [PATCH] - implement the url retrieval --- zypp/Product.cc | 24 +++++++++++++++++++++++- zypp/sat/SolvAttr.cc | 1 - 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/zypp/Product.cc b/zypp/Product.cc index d2f9e2e..3eb4d8a 100644 --- a/zypp/Product.cc +++ b/zypp/Product.cc @@ -162,7 +162,29 @@ namespace zypp Product::UrlList Product::urls( const std::string & key_r ) const { UrlList ret; -#warning IMPLEMENT PRODUCT URLS + + sat::LookupAttr url( sat::SolvAttr::productUrl, *this ); + sat::LookupAttr url_type( sat::SolvAttr::productUrlType, *this ); + + sat::LookupAttr::iterator url_it(url.begin()); + sat::LookupAttr::iterator url_type_it(url_type.begin()); + + for (;url_it != url.end(); ++url_it, ++url_type_it) + { + /* safety checks, shouldn't happen (tm) */ + if (url_type_it == url_type.end()) + { + /* FIXME: Raise exception ?! */ + ERR << *this << " : The thing that should not happen, happened." << endl; + break; + } + + if ( url_type_it.asString() == key_r ) + { + ret._list.push_back(url_it.asString()); + } + } /* while (attribute array) */ + return ret; } diff --git a/zypp/sat/SolvAttr.cc b/zypp/sat/SolvAttr.cc index d2389d0..303f835 100644 --- a/zypp/sat/SolvAttr.cc +++ b/zypp/sat/SolvAttr.cc @@ -107,7 +107,6 @@ namespace sat const SolvAttr SolvAttr::productUpdaterepoKey ( PRODUCT_UPDATEREPOKEY ); const SolvAttr SolvAttr::productRegisterTarget ( PRODUCT_REGISTER_TARGET ); const SolvAttr SolvAttr::productRegisterRelease( PRODUCT_REGISTER_RELEASE ); - const SolvAttr SolvAttr::productUrl( PRODUCT_URL ); const SolvAttr SolvAttr::productUrlType( PRODUCT_URL_TYPE ); -- 2.7.4