Author: dmacvicar Date: Wed Jul 4 14:14:03 2007 New Revision: 5877 URL: http://svn.opensuse.org/viewcvs/zypp?rev=5877&view=rev Log: Dont forget c++ sucks, so you have to inline the templates even if they are non 3-liners functions. Bahhh too much code in the header files. Modified: branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.cc branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.h Modified: branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.cc?rev=5877&r1=5876&r2=5877&view=diff ============================================================================== --- branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.cc (original) +++ branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.cc Wed Jul 4 14:14:03 2007 @@ -7,18 +7,12 @@ | | \---------------------------------------------------------------------*/ -#include <iostream> -#include <fstream> -#include "zypp/ZConfig.h" -#include "zypp/base/Logger.h" -#include "zypp/media/MediaManager.h" -#include "zypp/base/UserRequestException.h" - -#include "zypp/MediaProducts.h" #undef ZYPP_BASE_LOGGER_LOGGROUP #define ZYPP_BASE_LOGGER_LOGGROUP "zypp" +#include "zypp/MediaProducts.h" + using namespace std; namespace zypp @@ -46,29 +40,9 @@ } } -template<class _OutputIterator> -void productsInMedia( const Url & url_r, _OutputIterator result ) -{ - if (! url_r.isValid()) - ZYPP_THROW( Exception("Empty URL passed to SourceFactory") ); +// template<class _OutputIterator> +// void productsInMedia( const Url & url_r, _OutputIterator result ) - media::MediaManager media_mgr; - // open the media - media::MediaId id = media_mgr.open(url_r); - media_mgr.attach(id); - Pathname products_file = Pathname("media.1/products"); - - try { - media_mgr.provideFile (id, products_file); - products_file = media_mgr.localPath (id, products_file); - scanProductsFile (products_file, result); - } - catch ( const Exception & excpt ) { - ZYPP_CAUGHT(excpt); - MIL << "No products description found on the Url" << endl; - } - media_mgr.release(id); -} } // ns zypp Modified: branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.h?rev=5877&r1=5876&r2=5877&view=diff ============================================================================== --- branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.h (original) +++ branches/REFACTORING-10_3/libzypp/zypp/MediaProducts.h Wed Jul 4 14:14:03 2007 @@ -12,6 +12,13 @@ #ifndef ZYPP_MEDIAPRODUCTS_H_ #define ZYPP_MEDIAPRODUCTS_H_ +#include <iostream> +#include <fstream> +#include "zypp/ZConfig.h" +#include "zypp/base/Logger.h" +#include "zypp/media/MediaManager.h" +#include "zypp/base/UserRequestException.h" + #include "zypp/ProgressData.h" namespace zypp @@ -47,7 +54,28 @@ * \throws MediaException If accessng the media fails */ template <class _OutputIterator> - void productsInMedia( const Url & url_r, _OutputIterator result ); + void productsInMedia( const Url & url_r, _OutputIterator result ) + { + if (! url_r.isValid()) + ZYPP_THROW( Exception("Empty URL passed to SourceFactory") ); + + media::MediaManager media_mgr; + // open the media + media::MediaId id = media_mgr.open(url_r); + media_mgr.attach(id); + Pathname products_file = Pathname("media.1/products"); + + try { + media_mgr.provideFile (id, products_file); + products_file = media_mgr.localPath (id, products_file); + scanProductsFile (products_file, result); + } + catch ( const Exception & excpt ) { + ZYPP_CAUGHT(excpt); + MIL << "No products description found on the Url" << std::endl; + } + media_mgr.release(id); + } } // ns zypp -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org