27 using parser::ParseException;
35 const HistoryActionID HistoryActionID::NONE (HistoryActionID::NONE_e);
38 const HistoryActionID HistoryActionID::REPO_ADD (HistoryActionID::REPO_ADD_e);
39 const HistoryActionID HistoryActionID::REPO_REMOVE (HistoryActionID::REPO_REMOVE_e);
40 const HistoryActionID HistoryActionID::REPO_CHANGE_ALIAS (HistoryActionID::REPO_CHANGE_ALIAS_e);
41 const HistoryActionID HistoryActionID::REPO_CHANGE_URL (HistoryActionID::REPO_CHANGE_URL_e);
43 HistoryActionID::HistoryActionID(
const std::string & strval_r)
44 : _id(parse(strval_r))
49 typedef std::map<std::string,ID> MapType;
60 _table[
"NONE"] = _table[
"none"] =
NONE_e;
63 MapType::const_iterator it = _table.find( strval_r );
64 if ( it != _table.end() )
67 WAR <<
"Unknown history action ID '" + strval_r +
"'" << endl;
74 typedef std::pair<std::string,std::string> PairType;
75 typedef std::map<ID, PairType> MapType;
80 _table[
INSTALL_e] = PairType(
"install" ,
"install" );
81 _table[
REMOVE_e] = PairType(
"remove" ,
"remove " );
82 _table[
REPO_ADD_e] = PairType(
"radd" ,
"radd " );
86 _table[
NONE_e] = PairType(
"NONE" ,
"NONE " );
89 return( pad ? _table[
_id].second : _table[
_id].first );
93 {
return str <<
id.asString(); }
137 if ( fields_r.size() < expect_r )
139 ZYPP_THROW( ParseException(
str::form(
"Bad number of fields. Got %zd, expected at least %zd.",
147 catch (
const std::exception & excpt )
167 : _pimpl( new
Impl( fields_r, expect_r ) )
171 : _pimpl( new
Impl( fields_r, expectedId_r, expect_r ) )
179 if ( fields_r.size() >= 2 )
184 #define OUTS(E,T) case HistoryActionID::E: return Ptr( new T( fields_r ) ); break;
202 {
return _pimpl->_field.empty(); }
205 {
return _pimpl->_field.size(); }
208 {
return _pimpl->_field.begin(); }
211 {
return _pimpl->_field.end(); }
215 static const std::string _empty;
216 return( idx_r <
size() ?
_pimpl->_field[idx_r] : _empty );
220 {
return _pimpl->_field.at( idx_r ); }
227 {
return _pimpl->_action; }
repository providing the package
std::string alias() const
repository alias
std::vector< std::string > FieldVector
static std::map< std::string, ServiceType::Type > _table
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::string reqby() const
requested by (user, pid:appname, or empty (solver))
std::string userdata() const
userdata/transactionID
Impl(FieldVector &fields_r, HistoryActionID action_r, size_type expect_r)
std::string reqby() const
requested by (user, pid:appname, or empty (solver))
const_iterator begin() const
Iterator pointing to 1st element in vector (or end()).
FieldVector::size_type size_type
HistoryLogDataRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
bool empty() const
Whether FieldVector is empty.
std::string repoAlias() const
repository providing the package
HistoryLogData(FieldVector &fields_r, size_type expect_r=2)
Ctor moving FieldVector (via swap).
CheckSum checksum() const
package checksum
std::string alias() const
repository alias
Url newUrl() const
repositories new url
Edition represents [epoch:]version[-release]
RWCOW_pointer< Impl > _pimpl
Implementation class.
A zypp history log line for a removed packge.
Arch arch() const
package architecture
std::string oldAlias() const
repositories old alias
Url url() const
repository url
Arch arch() const
package architecture
std::string joinEscaped(_Iterator begin, _Iterator end, const char sep_r= ' ')
Join strings using separator sep_r, quoting or escaping the values.
size_type size() const
Number of fields in vector.
HistoryLogDataRepoAliasChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
const_iterator end() const
Iterator pointing behind the last element in vector.
virtual ~HistoryLogData()
Dtor.
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoAdd(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
FieldVector::const_iterator const_iterator
Store and operate on date (time_t).
A zypp history log line for an installed packaged.
requested by (user, pid:appname, or empty (solver))
std::ostream & operator<<(std::ostream &str, const Exception &obj)
std::string trim(const std::string &s, const Trim trim_r)
A zypp history log line for a repo url change.
const std::string & asString(bool pad=false) const
std::string name() const
package name
HistoryActionID action() const
HistoryActionID (or NONE_e if unknown)
HistoryLogDataInstall(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string userdata() const
userdata/transactionID
Edition edition() const
package edition
A zypp history log line for a removed repository.
static Ptr create(FieldVector &fields_r)
Factory method creating HistoryLogData classes.
const std::string & optionalAt(size_type idx_r) const
Access (optional) field by number.
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoUrlChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
A zypp history log line split into fieldsEach valid history log line starts with a date and HistoryAc...
static HistoryActionID::ID parse(const std::string &strval_r)
void _checkFields(const FieldVector &fields_r, size_type expect_r)
std::string form(const char *format,...)
Printf style construction of std::string.
std::string alias() const
repository alias
requested by (user, pid:appname, or empty (solver))
Impl(FieldVector &fields_r, size_type expect_r)
A zypp history log line for a repo alias change.
std::string newAlias() const
repositories new alias
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string name() const
package name
std::string userdata() const
userdata/transactionID
const std::string & at(size_type idx_r) const
Access (required) field by number.
Edition edition() const
package edition
A zypp history log line for an added repository.
Enumeration of known history actions.
#define HISTORY_LOG_DATE_FORMAT
shared_ptr< HistoryLogData > Ptr