libzypp 9.41.1

zypp::HistoryLogData Class Reference

A zypp history log line split into fieldsEach valid history log line starts with a date and HistoryActionID field. More...

#include <HistoryLogData.h>

Inheritance diagram for zypp::HistoryLogData:
zypp::HistoryLogDataInstall zypp::HistoryLogDataRemove zypp::HistoryLogDataRepoAdd zypp::HistoryLogDataRepoAliasChange zypp::HistoryLogDataRepoRemove zypp::HistoryLogDataRepoUrlChange

List of all members.

Classes

class  Impl

Public Types

enum  Index { DATE_INDEX = 0, ACTION_INDEX = 1 }
 

< indices of known fields

More...
typedef shared_ptr
< HistoryLogData
Ptr
typedef shared_ptr< const
HistoryLogData
constPtr
typedef std::vector< std::string > FieldVector
typedef FieldVector::size_type size_type
typedef FieldVector::const_iterator const_iterator

Public Member Functions

 HistoryLogData (FieldVector &fields_r, size_type expect_r=2)
 Ctor moving FieldVector (via swap).
 HistoryLogData (FieldVector &fields_r, HistoryActionID action_r, size_type expect_r=2)
 Ctor moving FieldVector (via swap).
virtual ~HistoryLogData ()
 Dtor.
bool empty () const
 Whether FieldVector is empty.
size_type size () const
 Number of fields in vector.
const_iterator begin () const
 Iterator pointing to 1st element in vector (or end()).
const_iterator end () const
 Iterator pointing behind the last element in vector.
const std::string & optionalAt (size_type idx_r) const
 Access (optional) field by number.
const std::string & operator[] (size_type idx_r) const
const std::string & at (size_type idx_r) const
 Access (required) field by number.
Date date () const
 date
HistoryActionID action () const
 HistoryActionID (or NONE_e if unknown)

Static Public Member Functions

static Ptr create (FieldVector &fields_r)
 Factory method creating HistoryLogData classes.

Protected Member Functions

HistoryLogDataoperator= (const HistoryLogData &)
 no base class assign

Private Attributes

RWCOW_pointer< Impl_pimpl
 Implementation class.

Related Functions

(Note that these are not member functions.)
std::ostream & operator<< (std::ostream &str, const HistoryLogData &obj)

Detailed Description

A zypp history log line split into fields

Each valid history log line starts with a date and HistoryActionID field.

Subsequent fields depend on the kind of action. See derived classes for convenient access to those flields.

HistoryLogData itself provides mostly generic access to the fields plain string values. Derived classes for well known entries tell

Definition at line 100 of file HistoryLogData.h.


Member Typedef Documentation

typedef std::vector<std::string> zypp::HistoryLogData::FieldVector

Definition at line 106 of file HistoryLogData.h.

typedef FieldVector::size_type zypp::HistoryLogData::size_type

Definition at line 107 of file HistoryLogData.h.

typedef FieldVector::const_iterator zypp::HistoryLogData::const_iterator

Definition at line 108 of file HistoryLogData.h.


Member Enumeration Documentation


Constructor & Destructor Documentation

zypp::HistoryLogData::HistoryLogData ( FieldVector fields_r,
size_type  expect_r = 2 
) [explicit]

Ctor moving FieldVector (via swap).

Exceptions:
ParseExceptionif fields_r has not at least expect_r entries
Note:
2 fields (date and action) are always required.

Definition at line 166 of file HistoryLogData.cc.

Referenced by create().

zypp::HistoryLogData::HistoryLogData ( FieldVector fields_r,
HistoryActionID  action_r,
size_type  expect_r = 2 
)

Ctor moving FieldVector (via swap).

Exceptions:
ParseExceptionif fields_r has the wrong HistoryActionID or not at least expect_r entries.
Note:
2 fields (date and action) are always required.

Definition at line 170 of file HistoryLogData.cc.

zypp::HistoryLogData::~HistoryLogData ( ) [virtual]

Dtor.

Definition at line 174 of file HistoryLogData.cc.


Member Function Documentation

HistoryLogData::Ptr zypp::HistoryLogData::create ( FieldVector fields_r) [static]

Factory method creating HistoryLogData classes.

Moves fields_r into a HistoryLogData or derived object, depending on the HistoryActionID. For known action ids a coresponing HistoryLogData class is created, to allow convenient access to the field values. For unknown action ids a plain HistoryLogData object is created. HistoryActionID NONE_e id used in this case.

Exceptions:
ParseExceptionif fields_r does not contain the required format.

Definition at line 177 of file HistoryLogData.cc.

References ACTION_INDEX, HistoryLogData(), zypp::HistoryActionID::NONE_e, OUTS, zypp::HistoryActionID::toEnum(), and zypp::str::trim().

Referenced by zypp::parser::HistoryLogReader::Impl::parseLine().

bool zypp::HistoryLogData::empty ( ) const

Whether FieldVector is empty.

Definition at line 201 of file HistoryLogData.cc.

References _pimpl.

HistoryLogData::size_type zypp::HistoryLogData::size ( ) const

Number of fields in vector.

Definition at line 204 of file HistoryLogData.cc.

References _pimpl.

Referenced by optionalAt().

HistoryLogData::const_iterator zypp::HistoryLogData::begin ( ) const

Iterator pointing to 1st element in vector (or end()).

Definition at line 207 of file HistoryLogData.cc.

References _pimpl.

Referenced by zypp::operator<<().

HistoryLogData::const_iterator zypp::HistoryLogData::end ( ) const

Iterator pointing behind the last element in vector.

Definition at line 210 of file HistoryLogData.cc.

References _pimpl.

Referenced by zypp::operator<<().

const std::string& zypp::HistoryLogData::operator[] ( size_type  idx_r) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 157 of file HistoryLogData.h.

References optionalAt().

const std::string & zypp::HistoryLogData::at ( size_type  idx_r) const

Access (required) field by number.

Exceptions:
std::out_of_rangeif idx_r is out of range.
See also:
optionalAt

Definition at line 219 of file HistoryLogData.cc.

References _pimpl.

Date zypp::HistoryLogData::date ( ) const

date

Definition at line 223 of file HistoryLogData.cc.

References _pimpl.

HistoryActionID zypp::HistoryLogData::action ( ) const

HistoryActionID (or NONE_e if unknown)

Definition at line 226 of file HistoryLogData.cc.

References _pimpl.

HistoryLogData& zypp::HistoryLogData::operator= ( const HistoryLogData ) [protected]

no base class assign


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  str,
const HistoryLogData obj 
) [related]

Stream output

Definition at line 230 of file HistoryLogData.cc.


Member Data Documentation

Implementation class.

Pointer to implementation

Definition at line 178 of file HistoryLogData.h.

Referenced by action(), at(), begin(), date(), empty(), end(), optionalAt(), and size().


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