Mailinglist Archive: yast-devel (156 mails)

< Previous Next >
Re: [yast-devel] Adding missing API to libzypp (or between libzypp and apps)
  • From: Katarina Machalkova <kmachalkova@xxxxxxx>
  • Date: Wed, 27 Jun 2007 14:53:45 +0200
  • Message-id: <200706271453.50095.kmachalkova@xxxxxxx>
>  I don't have any feature request for libzypp; we can work out things
> pretty easily (say, dependencies listing), and I think it already has
> enough bloat. :P

Well, the idea steadily evolved into something like 'writing a wrapper over 
libzypp' (called 'zypp4ui' for the time being) so that an application that 
needs to call libzypp function doesn't have to use libzypp low-level 
functions.

Example:  in your application, instead of doing:

list <ZyppSelectable> patchList; 
for ( ZyppPoolIterator it = zyppPatchesBegin(); it != zyppPatchesEnd();
          ++it )
    {
        ZyppSel   selectable = *it;
        ZyppPatch zyppPatch = tryCastToZyppPatch( selectable->theObj() );

        if ( zyppPatch )
        {
                patchList.push_back (*it)
         }
    }
do_something_with_all_patches( patchList );
//example_end

one just does:

list <ZyppSelectable> patchList = zypp4ui::Patch::listAll();
do_something_with_all_patches(patchList);

This low-level iteration through zypp pool would be wrapped into 
zypp4ui::Patch::listAll(), so that your application just calls this function, 
without adding the iteration code itself into the code of your library.

I'll update the idea page by adding some information what I've done in this 
project so far.

B.
-- 
   \\\\\              Katarina Machalkova    
  \\\\\\\__o          YaST developer
__\\\\\\\'/_          & hedgehog painter
< Previous Next >
References