From d133f9ba0c8ee916b1323df24f9ee1bd48221952 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Wed, 30 Jan 2008 10:19:54 +0000 Subject: [PATCH] - more progress trying to adapt to the solvstore semantics --- zypp/TranslatedText.h | 4 ++++ zypp/cache/SolvStore.cc | 32 ++++++++++++++++++++++++-------- zypp/cache/SolvStore.h | 6 +++--- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/zypp/TranslatedText.h b/zypp/TranslatedText.h index 10f3b14..39646cd 100644 --- a/zypp/TranslatedText.h +++ b/zypp/TranslatedText.h @@ -66,6 +66,10 @@ namespace zypp std::string text( const Locale &lang = Locale() ) const; std::set locales() const; + /** String representation. */ + const char * c_str( const Locale &lang = Locale() ) const + { return text(lang).c_str(); } + void setText( const std::string &text, const Locale &lang = Locale()); void setText( const std::list &text, const Locale &lang = Locale()); diff --git a/zypp/cache/SolvStore.cc b/zypp/cache/SolvStore.cc index 9976fa6..518e67f 100644 --- a/zypp/cache/SolvStore.cc +++ b/zypp/cache/SolvStore.cc @@ -58,9 +58,18 @@ struct SolvStore::Impl _pool = pool_create(); _repo = repo_create(_pool, alias.c_str() ); _repodata = repo_add_repodata(_repo); - + + //_attr_resobject_summary = str2id(_pool, "summary"); + //_attr_resobject_description = str2id(_pool, "description"); + _attr_resobject_installedSize = str2id(_pool, "installedSize", 1); + _attr_resobject_buildTime = str2id(_pool, "buildTime", 1); + _attr_resobject_installOnly = str2id(_pool, "installOnly", 1); + _attr_resobject_vendor = str2id(_pool, "vendor", 1); + _attr_resobject_insnotify = str2id(_pool, "insnotify", 1); + _attr_resobject_delnotify = str2id(_pool, "delnotify", 1); + // license to confirm, insnotify, delnotify + _attr_package_authors = str2id(_pool, "package:authors", 1); - _attr_package_description = str2id(_pool, "package:description", 1); _attr_package_diskusage = str2id(_pool, "package:diskusage", 1); _attr_package_downloadsize = str2id(_pool, "package:downloadsize", 1); _attr_package_eula = str2id(_pool, "package:eula", 1); @@ -76,7 +85,6 @@ struct SolvStore::Impl _attr_package_nosource = str2id(_pool, "package:nosource", 1); _attr_package_source = str2id(_pool, "package:source", 1); _attr_package_sourceid = str2id(_pool, "package:sourceid", 1); - _attr_package_summary = str2id(_pool, "package:summary", 1); _attr_package_time = str2id(_pool, "package:time", 1); } @@ -103,6 +111,13 @@ struct SolvStore::Impl Pathname _cachedir; Repodata *_repodata; + Id _attr_resobject_installedSize; + Id _attr_resobject_buildTime; + Id _attr_resobject_installOnly; + Id _attr_resobject_vendor; + Id _attr_resobject_delnotify; + Id _attr_resobject_insnotify; + Id _attr_package_authors; Id _attr_package_description; Id _attr_package_diskusage; @@ -147,10 +162,11 @@ void SolvStore::commit() // NOOP } -void SolvStore::appendResObjectAttributes( const data::RecordId &rid, - const data::ResObject_Ptr & res ) +void SolvStore::appendResObjectAttributes( Id rid, + const data::ResObject_Ptr & res ) { - + repodata_set_str(_pimpl->_repodata, rid, _pimpl->_attr_resobject_insnotify, res->insnotify.c_str()); + repodata_set_str(_pimpl->_repodata, rid, _pimpl->_attr_resobject_delnotify, res->delnotify.c_str()); // appendTranslatedStringAttribute( rid, attrResObjectDescription(), res->description ); // appendTranslatedStringAttribute( rid, attrResObjectSummary(), res->summary ); // appendNumericAttribute( rid, attrResObjectInstalledSize(), res->installedSize ); @@ -163,8 +179,8 @@ void SolvStore::appendResObjectAttributes( const data::RecordId &rid, } -void SolvStore::appendPackageBaseAttributes( const RecordId & pkgid, - const data::Packagebase_Ptr & package ) +void SolvStore::appendPackageBaseAttributes( Id rid, + const data::Packagebase_Ptr & package ) { // appendStringAttribute( pkgid, attrPackageBuildhost(), package->buildhost ); diff --git a/zypp/cache/SolvStore.h b/zypp/cache/SolvStore.h index 629c4e5..7143aa0 100644 --- a/zypp/cache/SolvStore.h +++ b/zypp/cache/SolvStore.h @@ -263,11 +263,11 @@ namespace zypp * to avoid some duplication across types. */ //@{ - void appendResObjectAttributes( const data::RecordId &rid, + void appendResObjectAttributes( Id id, const data::ResObject_Ptr & res ); - void appendPackageBaseAttributes(const data::RecordId & pkgid, - const data::Packagebase_Ptr & package); + void appendPackageBaseAttributes( Id id, + const data::Packagebase_Ptr & package); //@} void cleanRepository( const std::string &alias, -- 2.7.4