Mailinglist Archive: zypp-devel (58 mails)

< Previous Next >
[zypp-devel] new: HistoryLogReader
  • From: Jan Kupec <jkupec@xxxxxxx>
  • Date: Wed, 28 Jan 2009 14:51:07 +0100
  • Message-id: <498062CB.4040000@xxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

FYI: zypp/parser/HistoryLogReader is now available in git. It reads
specified history log into HistoryItem* structures and for each item
read it calls a function provided in the constructor.

It provides three methods so far:
readAll()
readFrom(Date)
readFromTo(Date,Date)

The callback function gets a HistoryItem::Ptr as argument. This can be
cast into HistoryItemInstall and other subclasses. See zypp/HistoryLogData.h

If you have a suggestion to change this or add new methods, let me know.

Example usage:

- --------8<--------------------------
struct HistoryItemCollector
{
std::vector<HistoryItem::Ptr> items;

bool operator()( const HistoryItem::Ptr & item_ptr )
{
items.push_back(item_ptr);
//cout << *item_ptr << endl;
return true;
}
};

int main( int argc, const char * argv[] )
{
HistoryItemCollector ic;
parser::HistoryLogReader reader(argv[1], boost::ref(ic));

try
{
reader.readFromTo(
Date("2009-01-01", "%Y-%m-%d"),
Date("2009-01-02", "%Y-%m-%d"));
}
catch (const parser::ParseException & e)
{
cout << "error in " << argv[1] << ":" << endl;
cout << e.asUserHistory() << endl;
}

cout << "got " << ic.items.size() << endl;
return 0;
}
- --------8<--------------------------

- --
cheers,
jano


Ján Kupec
YaST team
- ---------------------------------------------------------(PGP)---
Key ID: 637EE901
Fingerprint: 93B9 C79B 2D20 51C3 800B E09B 8048 46A6 637E E901
- ---------------------------------------------------------(IRC)---
Server: irc.freenode.net
Nick: jniq
Channels: #zypp #yast #suse #susecz
- ---------------------------------------------------------(EOF)---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkmAYssACgkQgEhGpmN+6QHsnwCfYPvzvSQqzi4KNVq1mEzUUXCI
c8YAniVuddWGkTUDqIMNX8RnEAHGnMTp
=631N
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
Follow Ups