15#include <zypp/base/PtrTypes.h>
16#include <zypp/base/String.h>
17#include <zypp/base/Logger.h>
18#include <zypp-core/parser/ParseException>
27 using parser::ParseException;
46 : _id(parse(strval_r))
51 typedef std::map<std::string,ID> MapType;
52 static MapType _table;
64 _table[
"NONE"] = _table[
"none"] =
NONE_e;
67 MapType::const_iterator it = _table.find( strval_r );
68 if ( it != _table.end() )
71 WAR <<
"Unknown history action ID '" + strval_r +
"'" << endl;
78 typedef std::pair<std::string,std::string> PairType;
79 typedef std::map<ID, PairType> MapType;
80 static MapType _table;
84 _table[
INSTALL_e] = PairType(
"install" ,
"install" );
85 _table[
REMOVE_e] = PairType(
"remove" ,
"remove " );
86 _table[
REPO_ADD_e] = PairType(
"radd" ,
"radd " );
92 _table[
NONE_e] = PairType(
"NONE" ,
"NONE " );
95 return( pad ? _table[
_id].second : _table[
_id].first );
99 {
return str <<
id.asString(); }
143 if ( fields_r.size() < expect_r )
153 catch (
const std::exception & excpt )
173 : _pimpl( new
Impl( fields_r, expect_r ) )
177 : _pimpl( new
Impl( fields_r, expectedId_r, expect_r ) )
185 if ( fields_r.size() >= 2 )
190#define OUTS(E,T) case HistoryActionID::E: return Ptr( new T( fields_r ) ); break;
210 {
return _pimpl->_field.empty(); }
213 {
return _pimpl->_field.size(); }
216 {
return _pimpl->_field.begin(); }
219 {
return _pimpl->_field.end(); }
223 static const std::string _empty;
224 return( idx_r <
size() ?
_pimpl->_field[idx_r] : _empty );
228 {
return _pimpl->_field.at( idx_r ); }
235 {
return _pimpl->_action; }
#define HISTORY_LOG_DATE_FORMAT
Store and operate on date (time_t).
Edition represents [epoch:]version[-release]
A zypp history log line for an installed packaged.
HistoryLogDataInstall(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string userdata() const
userdata/transactionID
@ EDITION_INDEX
package edition
@ REQBY_INDEX
requested by (user@hostname, pid:appname, or empty (solver))
@ ARCH_INDEX
package architecture
@ USERDATA_INDEX
userdata/transactionID
@ REPOALIAS_INDEX
repository providing the package
@ CHEKSUM_INDEX
package checksum
CheckSum checksum() const
package checksum
std::string name() const
package name
Arch arch() const
package architecture
std::string reqby() const
requested by (user@hostname, pid:appname, or empty (solver))
std::string repoAlias() const
repository providing the package
Edition edition() const
package edition
A zypp history log line for a removed packge.
Arch arch() const
package architecture
@ REQBY_INDEX
requested by (user@hostname, pid:appname, or empty (solver))
@ ARCH_INDEX
package architecture
@ USERDATA_INDEX
userdata/transactionID
@ EDITION_INDEX
package edition
HistoryLogDataRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
Edition edition() const
package edition
std::string name() const
package name
std::string userdata() const
userdata/transactionID
std::string reqby() const
requested by (user@hostname, pid:appname, or empty (solver))
A zypp history log line for an added repository.
@ URL_INDEX
repository url
@ ALIAS_INDEX
repository alias
@ USERDATA_INDEX
userdata/transactionID
std::string alias() const
repository alias
Url url() const
repository url
HistoryLogDataRepoAdd(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string userdata() const
userdata/transactionID
A zypp history log line for a repo alias change.
std::string userdata() const
userdata/transactionID
std::string oldAlias() const
repositories old alias
@ NEWALIAS_INDEX
repositories new alias
@ USERDATA_INDEX
userdata/transactionID
@ OLDALIAS_INDEX
repositories old alias
std::string newAlias() const
repositories new alias
HistoryLogDataRepoAliasChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
A zypp history log line for a removed repository.
@ USERDATA_INDEX
userdata/transactionID
@ ALIAS_INDEX
repository alias
HistoryLogDataRepoRemove(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string alias() const
repository alias
std::string userdata() const
userdata/transactionID
A zypp history log line for a repo url change.
Url newUrl() const
repositories new url
std::string alias() const
repository alias
@ NEWURL_INDEX
repositories new url
@ USERDATA_INDEX
userdata/transactionID
@ ALIAS_INDEX
repository alias
std::string userdata() const
userdata/transactionID
HistoryLogDataRepoUrlChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
A zypp history log line identifying the program that triggered the following commit.
std::string command() const
the commandline executed
std::string executedBy() const
executed by user@hostname
HistoryLogDataStampCommand(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
@ COMMAND_INDEX
the commandline executed
@ USER_INDEX
executed by user@hostname
@ USERDATA_INDEX
userdata/transactionID
std::string userdata() const
userdata/transactionID
Impl(FieldVector &fields_r, size_type expect_r)
void _checkFields(const FieldVector &fields_r, size_type expect_r)
Impl(FieldVector &fields_r, HistoryActionID action_r, size_type expect_r)
A zypp history log line split into fields.
HistoryActionID action() const
HistoryActionID (or NONE_e if unknown)
FieldVector::const_iterator const_iterator
FieldVector::size_type size_type
shared_ptr< HistoryLogData > Ptr
static Ptr create(FieldVector &fields_r)
Factory method creating HistoryLogData classes.
const_iterator end() const
Iterator pointing behind the last element in vector.
virtual ~HistoryLogData()
Dtor.
const std::string & at(size_type idx_r) const
Access (required) field by number.
const std::string & optionalAt(size_type idx_r) const
Access (optional) field by number.
const_iterator begin() const
Iterator pointing to 1st element in vector (or end()).
@ ACTION_INDEX
HistoryActionID.
bool empty() const
Whether FieldVector is empty.
RWCOW_pointer< Impl > _pimpl
Implementation class.
HistoryLogData(FieldVector &fields_r, size_type expect_r=2)
Ctor moving FieldVector (via swap).
std::vector< std::string > FieldVector
size_type size() const
Number of fields in vector.
A zypp history log line for an installed packaged.
std::string repoAlias() const
repository providing the package
std::string newstate() const
std::string name() const
package name
std::string userdata() const
userdata/transactionID
Patch::Category category() const
Arch arch() const
package architecture
@ OLDSTATE_INDEX
the state of the patch before the change
@ CATEGORY_INDEX
patch category
@ EDITION_INDEX
patch edition
@ ARCH_INDEX
patch architecture
@ NEWSTATE_INDEX
the state of the patch after the change
@ SEVERITY_INDEX
patch severity
@ REPOALIAS_INDEX
repository providing the patch
@ USERDATA_INDEX
userdata/transactionID
Edition edition() const
package edition
Patch::SeverityFlag severity() const
std::string oldstate() const
HistoryLogPatchStateChange(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
Category categoryEnum() const
This patch's category as enum of wellknown categories.
SeverityFlag
Possible severity levels for (security) patches.
SeverityFlag severityFlag() const
Severity string mapped to an enum.
String related utilities and Regular expression matching.
std::string joinEscaped(TIterator begin, TIterator end, const char sep_r=' ')
Join strings using separator sep_r, quoting or escaping the values.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string trim(const std::string &s, const Trim trim_r)
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Enumeration of known history actions.
static const HistoryActionID REPO_REMOVE
static const HistoryActionID PATCH_STATE_CHANGE
const std::string & asString(bool pad=false) const
static const HistoryActionID REMOVE
static const HistoryActionID NONE
static const HistoryActionID STAMP_COMMAND
static const HistoryActionID REPO_ADD
static const HistoryActionID REPO_CHANGE_ALIAS
static const HistoryActionID REPO_CHANGE_URL
static HistoryActionID::ID parse(const std::string &strval_r)
static const HistoryActionID INSTALL
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.