Mailinglist Archive: zypp-devel (148 mails)
| < Previous | Next > |
Re: [zypp-devel] We're going to loose resolvables of kind 'Language'.
- From: Michael Andres <ma@xxxxxxx>
- Date: Tue, 18 Mar 2008 22:30:42 +0100
- Message-id: <20080318213042.GA6979@xxxxxxx>
On Tue, Jan 29, Katarina Machalkova wrote:
Basic interface is in class ResPool
const LocaleSet & ResPool::getAvailableLocales() const;
See class sat::LocaleSupport
Example:
const LocaleSet & avlocales( ResPool::instance().getAvailableLocales() );
for_( it, avlocales.begin(), avlocales.end() )
{
sat::LocaleSupport myLocale( *it );
if ( ! myLocale.isRequested() )
{
MIL << "Will enable support for locale '" << myLocale.locale() << "'." <<
endl;
myLocale.setRequested( true );
}
MIL << "Packages supporting locale '" << myLocale.locale() << "':" << endl;
for_( it, myLocale.begin(), myLocale.end() )
{
// iterate over sat::Solvables:
// MIL << " " << *it << endl;
// or get the PoolItems:
PoolItem pi(*it);
MIL << " " << pi << endl;
}
}
Is it ok for the UIs to construct the PoolItem (ASAP as well
the Selectable) from the sat::Solvable (inside the loop)?
Or would you prefer to have a transform iterator like:
for_( it, poolItemIterator(myLocale.begin()),
poolItemIterator(myLocale.end()) )
{
// *it now is a PoolItem
}
for_( it, selectableIterator(myLocale.begin()),
selectableIterator(myLocale.end()) )
{
// *it now is a ui::Selectable
}
A selectableIterator would also visit each Selectable only once,
even if multiple PoolItems refer to it.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
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@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
i) returning an iterator over all available languages
Basic interface is in class ResPool
const LocaleSet & ResPool::getAvailableLocales() const;
ii) for selected language, returning an it. over all its related packages ?
See class sat::LocaleSupport
Example:
const LocaleSet & avlocales( ResPool::instance().getAvailableLocales() );
for_( it, avlocales.begin(), avlocales.end() )
{
sat::LocaleSupport myLocale( *it );
if ( ! myLocale.isRequested() )
{
MIL << "Will enable support for locale '" << myLocale.locale() << "'." <<
endl;
myLocale.setRequested( true );
}
MIL << "Packages supporting locale '" << myLocale.locale() << "':" << endl;
for_( it, myLocale.begin(), myLocale.end() )
{
// iterate over sat::Solvables:
// MIL << " " << *it << endl;
// or get the PoolItems:
PoolItem pi(*it);
MIL << " " << pi << endl;
}
}
Is it ok for the UIs to construct the PoolItem (ASAP as well
the Selectable) from the sat::Solvable (inside the loop)?
Or would you prefer to have a transform iterator like:
for_( it, poolItemIterator(myLocale.begin()),
poolItemIterator(myLocale.end()) )
{
// *it now is a PoolItem
}
for_( it, selectableIterator(myLocale.begin()),
selectableIterator(myLocale.end()) )
{
// *it now is a ui::Selectable
}
A selectableIterator would also visit each Selectable only once,
even if multiple PoolItems refer to it.
--
cu,
Michael Andres
+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres YaST Development ma@xxxxxxxxxx
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@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx
| < Previous | Next > |