27 using parser::ParseException;
35 const HistoryActionID HistoryActionID::NONE (HistoryActionID::NONE_e);
36 const HistoryActionID HistoryActionID::INSTALL (HistoryActionID::INSTALL_e);
37 const HistoryActionID HistoryActionID::REMOVE (HistoryActionID::REMOVE_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);
42 const HistoryActionID HistoryActionID::STAMP_COMMAND (HistoryActionID::STAMP_COMMAND_e);
44 HistoryActionID::HistoryActionID(
const std::string & strval_r)
45 : _id(parse(strval_r))
50 typedef std::map<std::string,ID> MapType;
62 _table[
"NONE"] = _table[
"none"] =
NONE_e;
65 MapType::const_iterator it = _table.find( strval_r );
66 if ( it != _table.end() )
69 WAR <<
"Unknown history action ID '" + strval_r +
"'" << endl;
76 typedef std::pair<std::string,std::string> PairType;
77 typedef std::map<ID, PairType> MapType;
82 _table[
INSTALL_e] = PairType(
"install" ,
"install" );
83 _table[
REMOVE_e] = PairType(
"remove" ,
"remove " );
84 _table[
REPO_ADD_e] = PairType(
"radd" ,
"radd " );
89 _table[
NONE_e] = PairType(
"NONE" ,
"NONE " );
92 return( pad ? _table[
_id].second : _table[
_id].first );
96 {
return str <<
id.asString(); }
140 if ( fields_r.size() < expect_r )
142 ZYPP_THROW( ParseException(
str::form(
"Bad number of fields. Got %zd, expected at least %zd.",
150 catch (
const std::exception & excpt )
170 : _pimpl( new
Impl( fields_r, expect_r ) )
174 : _pimpl( new
Impl( fields_r, expectedId_r, expect_r ) )
182 if ( fields_r.size() >= 2 )
187 #define OUTS(E,T) case HistoryActionID::E: return Ptr( new T( fields_r ) ); break;
219 static const std::string _empty;
repository providing the package
std::string alias() const
repository alias
HistoryLogDataStampCommand(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
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 form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string oldAlias() const
repositories old alias
Url url() const
repository url
Arch arch() const
package architecture
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
std::string command() const
the commandline executed
HistoryActionID action() const
HistoryActionID (or NONE_e if unknown)
HistoryLogDataInstall(FieldVector &fields_r)
Ctor moving FieldVector (via swap).
std::string executedBy() const
executed by user
std::string userdata() const
userdata/transactionID
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).
std::string joinEscaped(TIterator begin, TIterator end, const char sep_r= ' ')
Join strings using separator sep_r, quoting or escaping the values.
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 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
A zypp history log line identifying the program that triggered the following commit.
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