libzypp  10.5.0
zypp::parser::HistoryLogReader Class Reference

Reads a zypp history log file and calls the ProcessItem function passed in the constructor for each item read. More...

#include <HistoryLogReader.h>

List of all members.

Classes

struct  Impl

Public Types

typedef function< bool(const
HistoryItem::Ptr &)> 
ProcessItem

Public Member Functions

 HistoryLogReader (const Pathname &repo_file, const ProcessItem &callback)
 ~HistoryLogReader ()
void readAll (const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
 Read the whole log file.
void readFrom (const Date &date, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
 Read log from specified date.
void readFromTo (const Date &fromDate, const Date &toDate, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
 Read log between fromDate and toDate.
void setIgnoreInvalidItems (bool ignoreInvalid=false)
 Set the reader to ignore invalid log entries and continue with the rest.
bool ignoreInvalidItems () const
 Whether the reader is set to ignore invalid log entries.

Private Attributes

RW_pointer< Impl,
rw_pointer::Scoped< Impl > > 
_pimpl

Detailed Description

Reads a zypp history log file and calls the ProcessItem function passed in the constructor for each item read.

Example:

struct HistoryItemCollector { vector<HistoryItem::Ptr> items;

bool operator()( const HistoryItem::Ptr & item_ptr ) { items.push_back(item_ptr); return true; } }

...

HistoryItemCollector ic; HistoryLogReader reader("/var/log/zypp/history", boost::ref(ic));

try { reader.readAll(); } catch (const Exception & e) { cout << e.asUserHistory() << endl; }

See also:
http://en.opensuse.org/Libzypp/Package_History

Definition at line 73 of file HistoryLogReader.h.


Member Typedef Documentation

Definition at line 76 of file HistoryLogReader.h.


Constructor & Destructor Documentation

zypp::parser::HistoryLogReader::HistoryLogReader ( const Pathname &  repo_file,
const ProcessItem callback 
)

Definition at line 248 of file HistoryLogReader.cc.

zypp::parser::HistoryLogReader::~HistoryLogReader ( )

Definition at line 253 of file HistoryLogReader.cc.


Member Function Documentation

void zypp::parser::HistoryLogReader::readAll ( const ProgressData::ReceiverFnc progress = ProgressData::ReceiverFnc())

Read the whole log file.

Parameters:
progressAn optional progress data receiver function.

Definition at line 262 of file HistoryLogReader.cc.

void zypp::parser::HistoryLogReader::readFrom ( const Date date,
const ProgressData::ReceiverFnc progress = ProgressData::ReceiverFnc() 
)

Read log from specified date.

Parameters:
dateDate from which to read.
progressAn optional progress data receiver function.
See also:
readFromTo()

Definition at line 265 of file HistoryLogReader.cc.

void zypp::parser::HistoryLogReader::readFromTo ( const Date fromDate,
const Date toDate,
const ProgressData::ReceiverFnc progress = ProgressData::ReceiverFnc() 
)

Read log between fromDate and toDate.

The date comparison's precision goes to seconds. Omitted time parts get replaced by zeroes, so if e.g. the time is not specified at all, the date means midnight of the specified date. So

fromDate = Date("2009-01-01", "%Y-%m-%d"); toDate = Date("2009-01-02", "%Y-%m-%d");

will yield log entries from midnight of January, 1st untill one second before midnight of January, 2nd.

Parameters:
fromDateDate from which to read.
toDateDate on which to stop reading.
progressAn optional progress data receiver function.

Definition at line 269 of file HistoryLogReader.cc.

void zypp::parser::HistoryLogReader::setIgnoreInvalidItems ( bool  ignoreInvalid = false)

Set the reader to ignore invalid log entries and continue with the rest.

Parameters:
ignoreInvalidtrue will cause the reader to ignore invalid entries

Definition at line 256 of file HistoryLogReader.cc.

bool zypp::parser::HistoryLogReader::ignoreInvalidItems ( ) const

Whether the reader is set to ignore invalid log entries.

See also:
setIngoreInvalidItems()

Definition at line 259 of file HistoryLogReader.cc.


Member Data Documentation


The documentation for this class was generated from the following files: