From 3d35c5bf068721c994db68769f18d818c32b4de4 Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Mon, 23 Jan 2006 16:11:35 +0000 Subject: [PATCH] generate all kinds --- devel/devel.kkaempf/HelixMessageImpl.cc | 49 ++++++++++ devel/devel.kkaempf/HelixMessageImpl.h | 51 ++++++++++ devel/devel.kkaempf/HelixPackageImpl.h | 4 +- devel/devel.kkaempf/HelixParser.cc | 2 +- devel/devel.kkaempf/HelixPatchImpl.cc | 82 ++++++++++++++++ devel/devel.kkaempf/HelixPatchImpl.h | 68 +++++++++++++ devel/devel.kkaempf/HelixPatternImpl.cc | 66 +++++++++++++ devel/devel.kkaempf/HelixPatternImpl.h | 64 +++++++++++++ devel/devel.kkaempf/HelixProductImpl.cc | 66 +++++++++++++ devel/devel.kkaempf/HelixProductImpl.h | 64 +++++++++++++ devel/devel.kkaempf/HelixScriptImpl.cc | 53 +++++++++++ devel/devel.kkaempf/HelixScriptImpl.h | 54 +++++++++++ devel/devel.kkaempf/HelixSourceImpl.cc | 164 +++++++++++++++++++++++++++++--- devel/devel.kkaempf/HelixSourceImpl.h | 1 - devel/devel.kkaempf/Makefile.am | 14 ++- devel/devel.kkaempf/rcparse.cc | 16 +--- 16 files changed, 790 insertions(+), 28 deletions(-) create mode 100644 devel/devel.kkaempf/HelixMessageImpl.cc create mode 100644 devel/devel.kkaempf/HelixMessageImpl.h create mode 100644 devel/devel.kkaempf/HelixPatchImpl.cc create mode 100644 devel/devel.kkaempf/HelixPatchImpl.h create mode 100644 devel/devel.kkaempf/HelixPatternImpl.cc create mode 100644 devel/devel.kkaempf/HelixPatternImpl.h create mode 100644 devel/devel.kkaempf/HelixProductImpl.cc create mode 100644 devel/devel.kkaempf/HelixProductImpl.h create mode 100644 devel/devel.kkaempf/HelixScriptImpl.cc create mode 100644 devel/devel.kkaempf/HelixScriptImpl.h diff --git a/devel/devel.kkaempf/HelixMessageImpl.cc b/devel/devel.kkaempf/HelixMessageImpl.cc new file mode 100644 index 0000000..09b58bf --- /dev/null +++ b/devel/devel.kkaempf/HelixMessageImpl.cc @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixMessageImpl.cc + * +*/ + +#include "HelixMessageImpl.h" +#include "zypp/base/String.h" +#include "zypp/base/Logger.h" + +using namespace std; +using namespace zypp::detail; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixMessageImpl +// +/////////////////////////////////////////////////////////////////// + +/** Default ctor +*/ +HelixMessageImpl::HelixMessageImpl (const zypp::HelixParser & parsed) +{ +} + +string +HelixMessageImpl::text () const +{ return _text; } + +string +HelixMessageImpl::type () const +{ return _type; } + +ByteCount +HelixMessageImpl::size() const +{ return _size_installed; } + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixMessageImpl.h b/devel/devel.kkaempf/HelixMessageImpl.h new file mode 100644 index 0000000..c3b5eed --- /dev/null +++ b/devel/devel.kkaempf/HelixMessageImpl.h @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixMessageImpl.h + * +*/ +#ifndef ZYPP_SOLVER_TEMPORARY_HELIXMESSAGEIMPL_H +#define ZYPP_SOLVER_TEMPORARY_HELIXMESSAGEIMPL_H + +#include "zypp/detail/MessageImpl.h" +#include "HelixParser.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixMessageImpl +// +/** Class representing a package +*/ +class HelixMessageImpl : public detail::MessageImplIf +{ +public: + + class HelixParser; + /** Default ctor + */ + HelixMessageImpl( const zypp::HelixParser & data ); + + std::string text () const; + std::string type () const; + virtual ByteCount size() const; + +protected: + std::string _text; + std::string _type; + ByteCount _size_installed; + + + }; + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOLVER_TEMPORARY_HELIXMESSAGEIMPL_H diff --git a/devel/devel.kkaempf/HelixPackageImpl.h b/devel/devel.kkaempf/HelixPackageImpl.h index 0a2b4b7..d5a5ea6 100644 --- a/devel/devel.kkaempf/HelixPackageImpl.h +++ b/devel/devel.kkaempf/HelixPackageImpl.h @@ -9,8 +9,8 @@ /** \file zypp/solver/temporary/HelixPackageImpl.h * */ -#ifndef ZYPP_SOLVER_TEMPORARY_RCPACKAGEIMPL_H -#define ZYPP_SOLVER_TEMPORARY_RCPACKAGEIMPL_H +#ifndef ZYPP_SOLVER_TEMPORARY_HELIXPACKAGEIMPL_H +#define ZYPP_SOLVER_TEMPORARY_HELIXPACKAGEIMPL_H #include "zypp/detail/PackageImpl.h" #include "HelixParser.h" diff --git a/devel/devel.kkaempf/HelixParser.cc b/devel/devel.kkaempf/HelixParser.cc index 9c210a7..38137e3 100644 --- a/devel/devel.kkaempf/HelixParser.cc +++ b/devel/devel.kkaempf/HelixParser.cc @@ -105,7 +105,7 @@ parse_dep_attrs(bool *is_obsolete, bool *is_pre, const xmlChar **attrs) else if (attr == "release") drelease = value; else if (attr == "arch") darch = value; else if (attr == "obsoletes") *is_obsolete = true; - else if (attr == "pre") if (value && *value == '1') *is_pre = true; + else if (attr == "pre") if (value == "1") *is_pre = true; else { _DBG("HelixParser") << "! Unknown attribute: " << attr << " = " << value << endl; } diff --git a/devel/devel.kkaempf/HelixPatchImpl.cc b/devel/devel.kkaempf/HelixPatchImpl.cc new file mode 100644 index 0000000..b6dbdb9 --- /dev/null +++ b/devel/devel.kkaempf/HelixPatchImpl.cc @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixPatchImpl.cc + * +*/ + +#include "HelixPatchImpl.h" +#include "zypp/base/String.h" +#include "zypp/base/Logger.h" + +using namespace std; +using namespace zypp::detail; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixPatchImpl +// +/////////////////////////////////////////////////////////////////// + +/** Default ctor +*/ +HelixPatchImpl::HelixPatchImpl (const zypp::HelixParser & parsed) + : _size_installed(parsed.installedSize) +{ +} + +ByteCount HelixPatchImpl::size() const +{ return _size_installed; } + + /** Patch ID */ +std::string HelixPatchImpl::id() const +{ return ""; } + + /** Patch time stamp */ +unsigned int HelixPatchImpl::timestamp() const +{ return 0; } + + /** Patch category (recommended, security,...) */ +std::string HelixPatchImpl::category() const +{ return ""; } + + /** Does the system need to reboot to finish the update process? */ +bool HelixPatchImpl::reboot_needed() const +{ return false; } + + /** Does the patch affect the package manager itself? */ +bool HelixPatchImpl::affects_pkg_manager() const +{ return false; } + + /** Is the patch installation interactive? (does it need user input?) */ +bool HelixPatchImpl::interactive() +{ return false; } + + /** The list of all atoms building the patch */ +PatchImplIf::AtomList HelixPatchImpl::all_atoms() +{ return AtomList(); } + + /** The list of those atoms which have not been installed */ +PatchImplIf::AtomList HelixPatchImpl::not_installed_atoms() +{ return AtomList(); } + + +// TODO check necessarity of functions below +void HelixPatchImpl::mark_atoms_to_freshen(bool freshen) +{ return; } + +bool HelixPatchImpl::any_atom_selected() +{ return false; } + + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixPatchImpl.h b/devel/devel.kkaempf/HelixPatchImpl.h new file mode 100644 index 0000000..a26c0e8 --- /dev/null +++ b/devel/devel.kkaempf/HelixPatchImpl.h @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixPatchImpl.h + * +*/ +#ifndef ZYPP_SOLVER_TEMPORARY_HELIXPATCHIMPL_H +#define ZYPP_SOLVER_TEMPORARY_HELIXPATCHIMPL_H + +#include "zypp/detail/PatchImpl.h" +#include "HelixParser.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixPatchImpl +// +/** Class representing a package +*/ +class HelixPatchImpl : public detail::PatchImplIf +{ +public: + + class HelixParser; + /** Default ctor + */ + HelixPatchImpl( const zypp::HelixParser & data ); + + + /** Patch ID */ + virtual std::string id() const ; + /** Patch time stamp */ + virtual unsigned int timestamp() const ; + /** Patch category (recommended, security,...) */ + virtual std::string category() const ; + /** Does the system need to reboot to finish the update process? */ + virtual bool reboot_needed() const ; + /** Does the patch affect the package manager itself? */ + virtual bool affects_pkg_manager() const ; + /** */ + virtual ByteCount size() const; + + /** Is the patch installation interactive? (does it need user input?) */ + virtual bool interactive() ; + /** The list of all atoms building the patch */ + virtual AtomList all_atoms() ; + /** The list of those atoms which have not been installed */ + virtual AtomList not_installed_atoms() ; + +// TODO check necessarity of functions below + virtual void mark_atoms_to_freshen(bool freshen) ; + virtual bool any_atom_selected() ; + +protected: + ByteCount _size_installed; + }; + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOLVER_TEMPORARY_HELIXPACKAGEIMPL_H diff --git a/devel/devel.kkaempf/HelixPatternImpl.cc b/devel/devel.kkaempf/HelixPatternImpl.cc new file mode 100644 index 0000000..42025ce --- /dev/null +++ b/devel/devel.kkaempf/HelixPatternImpl.cc @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixPatternImpl.cc + * +*/ + +#include "HelixPatternImpl.h" +#include "zypp/base/String.h" +#include "zypp/base/Logger.h" + +using namespace std; +using namespace zypp::detail; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixPatternImpl +// +/////////////////////////////////////////////////////////////////// + +/** Default ctor +*/ +HelixPatternImpl::HelixPatternImpl (const zypp::HelixParser & parsed) + : _summary(parsed.summary) + , _description() + , _group(parsed.section) + , _install_only(parsed.installOnly) + , _size_installed(parsed.installedSize) + , _size_archive(parsed.fileSize) +{ + _description.push_back(parsed.description); +} + +/** Pattern summary */ +Label HelixPatternImpl::summary() const +{ return _summary; } + +/** Pattern description */ +Text HelixPatternImpl::description() const +{ return _description; } + +PackageGroup HelixPatternImpl::group() const +{ return _group; } + +ByteCount HelixPatternImpl::size() const +{ return _size_installed; } + +/** */ +ByteCount HelixPatternImpl::archivesize() const +{ return _size_archive; } + +bool HelixPatternImpl::installOnly() const +{ return _install_only; } + + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixPatternImpl.h b/devel/devel.kkaempf/HelixPatternImpl.h new file mode 100644 index 0000000..a4ada90 --- /dev/null +++ b/devel/devel.kkaempf/HelixPatternImpl.h @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixPatternImpl.h + * +*/ +#ifndef ZYPP_SOLVER_TEMPORARY_HELIXPATTERNIMPL_H +#define ZYPP_SOLVER_TEMPORARY_HELIXPATTERNIMPL_H + +#include "zypp/detail/PatternImpl.h" +#include "HelixParser.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixPatternImpl +// +/** Class representing a package +*/ +class HelixPatternImpl : public detail::PatternImplIf +{ +public: + + class HelixParser; + /** Default ctor + */ + HelixPatternImpl( const zypp::HelixParser & data ); + + /** Pattern summary */ + virtual Label summary() const; + /** Pattern description */ + virtual Text description() const; + virtual ByteCount size() const; + /** */ + virtual PackageGroup group() const; + /** */ + virtual ByteCount archivesize() const; + /** */ + virtual bool installOnly() const; + /** */ + +protected: + Label _summary; + Text _description; + PackageGroup _group; + bool _install_only; + + ByteCount _size_installed; + ByteCount _size_archive; + + + }; + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOLVER_TEMPORARY_HELIXPACKAGEIMPL_H diff --git a/devel/devel.kkaempf/HelixProductImpl.cc b/devel/devel.kkaempf/HelixProductImpl.cc new file mode 100644 index 0000000..10b27bd --- /dev/null +++ b/devel/devel.kkaempf/HelixProductImpl.cc @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixProductImpl.cc + * +*/ + +#include "HelixProductImpl.h" +#include "zypp/base/String.h" +#include "zypp/base/Logger.h" + +using namespace std; +using namespace zypp::detail; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixProductImpl +// +/////////////////////////////////////////////////////////////////// + +/** Default ctor +*/ +HelixProductImpl::HelixProductImpl (const zypp::HelixParser & parsed) + : _summary(parsed.summary) + , _description() + , _group(parsed.section) + , _install_only(parsed.installOnly) + , _size_installed(parsed.installedSize) + , _size_archive(parsed.fileSize) +{ + _description.push_back(parsed.description); +} + +/** Package summary */ +Label HelixProductImpl::summary() const +{ return _summary; } + +/** Package description */ +Text HelixProductImpl::description() const +{ return _description; } + +PackageGroup HelixProductImpl::group() const +{ return _group; } + +ByteCount HelixProductImpl::size() const +{ return _size_installed; } + +/** */ +ByteCount HelixProductImpl::archivesize() const +{ return _size_archive; } + +bool HelixProductImpl::installOnly() const +{ return _install_only; } + + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixProductImpl.h b/devel/devel.kkaempf/HelixProductImpl.h new file mode 100644 index 0000000..b750853 --- /dev/null +++ b/devel/devel.kkaempf/HelixProductImpl.h @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixProductImpl.h + * +*/ +#ifndef ZYPP_SOLVER_TEMPORARY_HELIXPRODUCTIMPL_H +#define ZYPP_SOLVER_TEMPORARY_HELIXPRODUCTIMPL_H + +#include "zypp/detail/ProductImpl.h" +#include "HelixParser.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixProductImpl +// +/** Class representing a package +*/ +class HelixProductImpl : public detail::ProductImplIf +{ +public: + + class HelixParser; + /** Default ctor + */ + HelixProductImpl( const zypp::HelixParser & data ); + + /** Product summary */ + virtual Label summary() const; + /** Product description */ + virtual Text description() const; + virtual ByteCount size() const; + /** */ + virtual PackageGroup group() const; + /** */ + virtual ByteCount archivesize() const; + /** */ + virtual bool installOnly() const; + /** */ + +protected: + Label _summary; + Text _description; + PackageGroup _group; + bool _install_only; + + ByteCount _size_installed; + ByteCount _size_archive; + + + }; + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOLVER_TEMPORARY_HELIXPACKAGEIMPL_H diff --git a/devel/devel.kkaempf/HelixScriptImpl.cc b/devel/devel.kkaempf/HelixScriptImpl.cc new file mode 100644 index 0000000..ca88a7c --- /dev/null +++ b/devel/devel.kkaempf/HelixScriptImpl.cc @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixScriptImpl.cc + * +*/ + +#include "HelixScriptImpl.h" +#include "zypp/base/String.h" +#include "zypp/base/Logger.h" + +using namespace std; +using namespace zypp::detail; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixScriptImpl +// +/////////////////////////////////////////////////////////////////// + +/** Default ctor +*/ +HelixScriptImpl::HelixScriptImpl (const zypp::HelixParser & parsed) + : _size_installed(parsed.installedSize) +{ +} + +/** Get the script to perform the change */ +std::string HelixScriptImpl::do_script() const +{ return "do_script"; } + +/** Get the script to undo the change */ +std::string HelixScriptImpl::undo_script() const +{ return "undo_script"; } + +/** Check whether script to undo the change is available */ +bool HelixScriptImpl::undo_available() const +{ return false; } + +ByteCount HelixScriptImpl::size() const +{ return _size_installed; } + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixScriptImpl.h b/devel/devel.kkaempf/HelixScriptImpl.h new file mode 100644 index 0000000..aa98042 --- /dev/null +++ b/devel/devel.kkaempf/HelixScriptImpl.h @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/solver/temporary/HelixPackageImpl.h + * +*/ +#ifndef ZYPP_SOLVER_TEMPORARY_HELIXSCRIPTIMPL_H +#define ZYPP_SOLVER_TEMPORARY_HELIXSCRIPTIMPL_H + +#include "zypp/detail/ScriptImpl.h" +#include "HelixParser.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixScriptImpl +// +/** Class representing a script +*/ +class HelixScriptImpl : public detail::ScriptImplIf +{ +public: + + class HelixParser; + /** Default ctor + */ + HelixScriptImpl( const zypp::HelixParser & data ); + + /** Get the script to perform the change */ + virtual std::string do_script() const; + /** Get the script to undo the change */ + virtual std::string undo_script() const; + /** Check whether script to undo the change is available */ + virtual bool undo_available() const; + /** */ + virtual ByteCount size() const; + +protected: + ByteCount _size_installed; + + + }; + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOLVER_TEMPORARY_HELIXPACKAGEIMPL_H diff --git a/devel/devel.kkaempf/HelixSourceImpl.cc b/devel/devel.kkaempf/HelixSourceImpl.cc index 641e283..e95df5d 100644 --- a/devel/devel.kkaempf/HelixSourceImpl.cc +++ b/devel/devel.kkaempf/HelixSourceImpl.cc @@ -22,10 +22,16 @@ #include "HelixExtract.h" #include "HelixSourceImpl.h" #include "HelixPackageImpl.h" +#include "HelixScriptImpl.h" +#include "HelixMessageImpl.h" +#include "HelixPatchImpl.h" +#include "HelixPatternImpl.h" +#include "HelixProductImpl.h" #include "zypp/solver/temporary/Channel.h" #include "zypp/solver/temporary/extract.h" #include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" using namespace std; @@ -38,6 +44,7 @@ HelixSourceImpl::HelixSourceImpl(media::MediaAccess::Ptr & media_r, const Pathna load (path_r.asString()); } + Dependencies HelixSourceImpl::createDependencies (const HelixParser & parsed) { @@ -56,6 +63,7 @@ HelixSourceImpl::createDependencies (const HelixParser & parsed) return deps; } + Package::Ptr HelixSourceImpl::createPackage (const HelixParser & parsed) { @@ -81,60 +89,194 @@ HelixSourceImpl::createPackage (const HelixParser & parsed) Message::Ptr -HelixSourceImpl::createMessage (const HelixParser & data) +HelixSourceImpl::createMessage (const HelixParser & parsed) { + try + { + shared_ptr impl(new HelixMessageImpl(parsed)); + + // Collect basic Resolvable data + NVRAD dataCollect( parsed.name, + Edition( parsed.version, parsed.release, parsed.epoch ), + Arch( parsed.arch ), + createDependencies (parsed)); + Message::Ptr message = detail::makeResolvableFromImpl(dataCollect, impl); + return message; + } + catch (const Exception & excpt_r) + { + ERR << excpt_r << endl; + throw "Cannot create message object"; + } return NULL; } Script::Ptr -HelixSourceImpl::createScript (const HelixParser & data) +HelixSourceImpl::createScript (const HelixParser & parsed) { + try + { + shared_ptr impl(new HelixScriptImpl(parsed)); + + // Collect basic Resolvable data + NVRAD dataCollect( parsed.name, + Edition( parsed.version, parsed.release, parsed.epoch ), + Arch( parsed.arch ), + createDependencies (parsed)); + Script::Ptr script = detail::makeResolvableFromImpl(dataCollect, impl); + return script; + } + catch (const Exception & excpt_r) + { + ERR << excpt_r << endl; + throw "Cannot create script object"; + } return NULL; } Patch::Ptr -HelixSourceImpl::createPatch (const HelixParser & data) +HelixSourceImpl::createPatch (const HelixParser & parsed) { + try + { + shared_ptr impl(new HelixPatchImpl(parsed)); + + // Collect basic Resolvable data + NVRAD dataCollect( parsed.name, + Edition( parsed.version, parsed.release, parsed.epoch ), + Arch( parsed.arch ), + createDependencies (parsed)); + Patch::Ptr patch = detail::makeResolvableFromImpl(dataCollect, impl); + return patch; + } + catch (const Exception & excpt_r) + { + ERR << excpt_r << endl; + throw "Cannot create patch object"; + } return NULL; } Pattern::Ptr -HelixSourceImpl::createPattern (const HelixParser & data) +HelixSourceImpl::createPattern (const HelixParser & parsed) { + try + { + shared_ptr impl(new HelixPatternImpl(parsed)); + + // Collect basic Resolvable data + NVRAD dataCollect( parsed.name, + Edition( parsed.version, parsed.release, parsed.epoch ), + Arch( parsed.arch ), + createDependencies (parsed)); + Pattern::Ptr pattern = detail::makeResolvableFromImpl(dataCollect, impl); + return pattern; + } + catch (const Exception & excpt_r) + { + ERR << excpt_r << endl; + throw "Cannot create pattern object"; + } return NULL; } Product::Ptr -HelixSourceImpl::createProduct (const HelixParser & data) +HelixSourceImpl::createProduct (const HelixParser & parsed) { + try + { + shared_ptr impl(new HelixProductImpl(parsed)); + + // Collect basic Resolvable data + NVRAD dataCollect( parsed.name, + Edition( parsed.version, parsed.release, parsed.epoch ), + Arch( parsed.arch ), + createDependencies (parsed)); + Product::Ptr product = detail::makeResolvableFromImpl(dataCollect, impl); + return product; + } + catch (const Exception & excpt_r) + { + ERR << excpt_r << endl; + throw "Cannot create product object"; + } return NULL; } //----------------------------------------------------------------------------- void -HelixSourceImpl::parserCallback (const HelixParser & data) +HelixSourceImpl::parserCallback (const HelixParser & parsed) { - if (data.kind == ResTraits::kind) { - Package::Ptr p = createPackage (data); + try { + if (parsed.kind == ResTraits::kind) { + Package::Ptr p = createPackage (parsed); _store.insert (p); } + else if (parsed.kind == ResTraits::kind) { + Message::Ptr m = createMessage (parsed); + _store.insert (m); + } + else if (parsed.kind == ResTraits