[zypp-devel] Re: [zypp-commit] r6311 - zypper-sources.cc - base urls iterator
dmacvicar@svn.opensuse.org wrote:
Author: dmacvicar Date: Mon Jul 30 23:42:43 2007 New Revision: 6311
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6311&view=rev Log: dont use baseUrls (deprecated, perhaps we remove it) use the url iterator
Let's keep baseUrls(), it's handy for the application to store the set of urls and then work with it if appropriate. Example use case: when initializing repos (checking if to refresh for those with autorefresh enabled), if the app finds out the repo is invalid, it can disable it in its internal set and ignore it for the rest of the operation. But for list repos operation, as is the case below, it is appropriate to use the iterator which always works with data of the *.repo files. Jano
Modified: trunk/zypper/src/zypper-sources.cc
Modified: trunk/zypper/src/zypper-sources.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-sources.cc?rev=6311&r1=6310&r2=6311&view=diff ============================================================================== --- trunk/zypper/src/zypper-sources.cc (original) +++ trunk/zypper/src/zypper-sources.cc Mon Jul 30 23:42:43 2007 @@ -123,10 +123,8 @@ tr << repo.type().asString(); tr << repo.alias();
- std::set<Url> urls; - urls = repo.baseUrls(); - for ( RepoInfo::urls_const_iterator uit = urls.begin(); - uit != urls.end(); + for ( RepoInfo::urls_const_iterator uit = repo.baseUrlsBegin(); + uit != repo.baseUrlsEnd(); ++uit ) { tr << (*uit).asString();
-- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tuesday 31 July 2007 09:18:44 Jan Kupec wrote:
Let's keep baseUrls(), it's handy for the application to store the set of urls and then work with it if appropriate. Example use case: when initializing repos (checking if to refresh for those with autorefresh enabled), if the app finds out the repo is invalid, it can disable it in its internal set and ignore it for the rest of the operation.
But for list repos operation, as is the case below, it is appropriate to use the iterator which always works with data of the *.repo files.
The problem is that with the variable replacement, the iterator type of baseUrlsBegin() baseUrlsEnd() is different than std::set<Url> Having the accessor to the baseUrls as a set with one iterator type and the iterator itself would be confusing. Michael? Duncan -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Jul 31, Jan Kupec wrote:
dmacvicar@svn.opensuse.org wrote:
Author: dmacvicar Date: Mon Jul 30 23:42:43 2007 New Revision: 6311
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6311&view=rev Log: dont use baseUrls (deprecated, perhaps we remove it) use the url iterator
Let's keep baseUrls(), it's handy for the application to store the set of urls and then work with it if appropriate. Example use case: when initializing repos (checking if to refresh for those with autorefresh enabled), if the app finds out the repo is invalid, it can disable it in its internal set and ignore it for the rest of the operation.
Then the apllication can do: list<Url> myUrls( repo.baseUrlsBegin(), repo.baseUrlEend() ); instead of list<Url> myUrls( repo.baseUrls() ); IMO the iterator ctor is even more convenient, as you can use any container type: set<Url> myUrls( repo.baseUrlsBegin(), repo.baseUrlEend() ); vector<Url> myUrls( repo.baseUrlsBegin(), repo.baseUrlEend() ); -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Jan Kupec wrote:
dmacvicar@svn.opensuse.org wrote:
Author: dmacvicar Date: Mon Jul 30 23:42:43 2007 New Revision: 6311
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6311&view=rev Log: dont use baseUrls (deprecated, perhaps we remove it) use the url iterator
Let's keep baseUrls(), it's handy for the application to store the set of urls and then work with it if appropriate. Example use case: when initializing repos (checking if to refresh for those with autorefresh enabled), if the app finds out the repo is invalid, it can disable it in its internal set and ignore it for the rest of the operation.
WOW. Can't believe it. Two days passed until i realized i must have had my brain short-circuited when writing this!!! It should have been about baseUrls() but i've had knownRepositories() in my mind all the time! Jeesh, sorry for the noise. j.
But for list repos operation, as is the case below, it is appropriate to use the iterator which always works with data of the *.repo files.
Jano
Modified: trunk/zypper/src/zypper-sources.cc
Modified: trunk/zypper/src/zypper-sources.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-sources.cc?rev=6311&r1=6310&r2=6311&view=diff ============================================================================== --- trunk/zypper/src/zypper-sources.cc (original) +++ trunk/zypper/src/zypper-sources.cc Mon Jul 30 23:42:43 2007 @@ -123,10 +123,8 @@ tr << repo.type().asString(); tr << repo.alias();
- std::set<Url> urls; - urls = repo.baseUrls(); - for ( RepoInfo::urls_const_iterator uit = urls.begin(); - uit != urls.end(); + for ( RepoInfo::urls_const_iterator uit = repo.baseUrlsBegin(); + uit != repo.baseUrlsEnd(); ++uit ) { tr << (*uit).asString();
-- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (3)
-
Duncan Mac-Vicar Prett
-
Jan Kupec
-
Michael Andres