Mailinglist Archive: zypp-devel (227 mails)

< Previous Next >
[zypp-devel] using PoolQuery in UIs
  • From: Jan Kupec <jkupec@xxxxxxx>
  • Date: Thu, 10 Apr 2008 16:48:13 +0200
  • Message-id: <47FE28AD.9020205@xxxxxxx>
Duncan Mac-Vicar Prett wrote:
Jan Kupec wrote:
<nice-to-have>
Duncan do you think you could make use of the PoolQuery (selectable
iterator) in the Qt package selector? I certainly want to use it in
zypper (search showing selectables by default). The could should be much
cleaner using it.
</nice-to-have>

Cheers,

jano

I could look into it, can you point me how to use it?

See zypp/PoolQuery_test.cc for how to set up various queries. Once set
up, you just iterate using selectable{Begin,End}(). Typically you do:


PoolQuery q;
q.addString("zypper");
q.addAttribute(sat::SolvAttr::name);
if (search_in_descriptions)
{
q.addAttribute(sat::SolvAttr::summary);
q.addAttribute(sat::SolvAttr::description);
}
if (use_globs)
q.setMatchGlob();

// etc....

for (PoolQuery::Selectable_iterator it = q.selectableBegin();
it != q.selectableEnd(); ++it)
{
Selectable::Ptr s = *it;
}

q.begin() q.end() returns solvables; the SolvIterMixin makes also
q.poolItem{Begin,End} available IIRC.


If you'll need some convenience methods, or the perfomance is bad or
what, just tell me. Just bear in mind it currently returns one
selectable for each solvable, this needs to be fixed yet.

CCing zypp-devel just in case someone finds the info useful.

j.
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages