--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/Changelog.h
+ *
+*/
+#ifndef ZYPP_CHANGELOG_H
+#define ZYPP_CHANGELOG_H
+
+#include <string>
+#include <list>
+#include <iostream>
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ChangelogEntry
+ //
+ /** Single entry in a change log
+ */
+ class ChangelogEntry
+ {
+ public:
+ /** Default ctor */
+ ChangelogEntry( const Date & d,
+ const std::string & a,
+ const std::string & t )
+ : _date( d ), _author( a ), _text( t )
+ {};
+ /** Dtor */
+ ~ChangelogEntry()
+ {}
+ Date date() const { return _date; }
+ std::string author() const { return _author; }
+ std::string text() const { return _text; }
+
+ private:
+ Date _date;
+ std::string _author;
+ std::string _text;
+ };
+
+ typedef std::list<ChangelogEntry> Changelog;
+
+ inline std::ostream & operator<<( std::ostream & out,
+ const ChangelogEntry & obj )
+ {
+ out << obj.date() << " " << obj.author() << endl << obj.text() << endl;
+ return out;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
+#endif // ZYPP_CHANGELOG_H
Message.h \
Script.h \
Patch.h \
- Product.h
+ Product.h \
+ Changelog.h
## ##################################################
//
///////////////////////////////////////////////////////////////////
-
+ Changelog Package::changelog()
+ { return pimpl().changelog(); }
/////////////////////////////////////////////////////////////////
} // namespace zypp
const Arch & arch_r );
/** Dtor */
virtual ~Package();
+ /** Get the package change log */
+ Changelog changelog();
private:
/** Access implementation */
PackageGroup PackageImplIf::group() const
{ return PackageGroup(); }
- Text PackageImplIf::changelog() const
- { return Text(); }
+ Changelog PackageImplIf::changelog() const
+ { return Changelog(); }
std::string PackageImplIf::url() const
{ return std::string(); }
#include "zypp/detail/ResObjectImplIf.h"
#include "zypp/Edition.h"
#include "zypp/Arch.h"
+#include "zypp/Changelog.h"
///////////////////////////////////////////////////////////////////
namespace zypp
/** */
virtual PackageGroup group() const PURE_VIRTUAL;
/** */
- virtual Text changelog() const PURE_VIRTUAL;
+ virtual Changelog changelog() const PURE_VIRTUAL;
/** Don't ship it as class Url, because it might be
* in fact anything but a legal Url. */
virtual std::string url() const PURE_VIRTUAL;
{
_filenames.push_back(it->name);
}
-// TODO changelog
+ for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
+ it = other.changelog.begin();
+ it != other.changelog.end();
+ it++)
+ {
+ _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
+ it->author,
+ it->entry));
+ }
}
YUMPackageImpl::YUMPackageImpl(
);
_delta_rpms.push_back(delta);
}
-// TODO changelog
+ for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
+ it = parsed.changelog.begin();
+ it != parsed.changelog.end();
+ it++)
+ {
+ _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
+ it->author,
+ it->entry));
+ }
}
{ return _group; }
/** */
- Text YUMPackageImpl::changelog() const
+ Changelog YUMPackageImpl::changelog() const
{ return _changelog; }
/** Don't ship it as class Url, because it might be
#include "zypp/detail/PackageImpl.h"
#include "zypp/parser/yum/YUMParserData.h"
+#include "zypp/Changelog.h"
///////////////////////////////////////////////////////////////////
namespace zypp
/** */
virtual PackageGroup group() const;
/** */
- virtual Text changelog() const;
+ virtual Changelog changelog() const;
/** Don't ship it as class Url, because it might be
* in fact anything but a legal Url. */
virtual std::string url() const;
Label _license;
std::string _packager;
PackageGroup _group;
- Text _changelog;
+ Changelog _changelog;
std::string _type;
License _license_to_confirm;
Text _authors;