PatternImpl.cc

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #include <iostream>
00013 
00014 #include "zypp/base/Easy.h"
00015 #include "zypp/base/Logger.h"
00016 #include "zypp/base/LogTools.h"
00017 #include "zypp/base/String.h"
00018 
00019 #include "zypp/CapFactory.h"
00020 #include "zypp/TranslatedText.h"
00021 #include "zypp/repo/RepositoryImpl.h"
00022 #include "zypp/repo/cached/PatternImpl.h"
00023 #include "zypp/cache/CacheAttributes.h"
00024 
00025 
00026 using namespace std;
00027 
00029 namespace zypp { namespace repo { namespace cached {
00030 
00032 //
00033 //        CLASS NAME : PatternImpl
00034 //
00036 
00039 PatternImpl::PatternImpl (const data::RecordId &id, cached::RepoImpl::Ptr repository_r)
00040     : _repository (repository_r),
00041       _id(id)
00042 {}
00043 
00044 Repository
00045 PatternImpl::repository() const
00046 {
00047   return _repository->selfRepository();
00048 }
00049 
00051 // ResObject Attributes
00053 
00054 TranslatedText PatternImpl::summary() const
00055 {
00056   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
00057 }
00058 
00059 TranslatedText PatternImpl::description() const
00060 {
00061   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
00062 }
00063 
00064 TranslatedText PatternImpl::insnotify() const
00065 {
00066   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
00067 }
00068 
00069 TranslatedText PatternImpl::delnotify() const
00070 {
00071   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
00072 }
00073 
00074 TranslatedText PatternImpl::licenseToConfirm() const
00075 {
00076   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
00077 }
00078 
00079 Vendor PatternImpl::vendor() const
00080 {
00081   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
00082 }
00083 
00084 
00085 ByteCount PatternImpl::size() const
00086 {
00087   return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
00088 }
00089 
00090 bool PatternImpl::installOnly() const
00091 {
00092   return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
00093 }
00094 
00095 Date PatternImpl::buildtime() const
00096 {
00097   return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
00098 }
00099 
00100 Date PatternImpl::installtime() const
00101 {
00102   return Date();
00103 }
00104 
00106 // PATTERN
00108 
00109 bool PatternImpl::isDefault() const
00110 {
00111   return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatternIsDefault() );
00112 }
00113 
00114 bool PatternImpl::userVisible() const
00115 {
00116   return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatternUserVisible() );
00117 }
00118 
00119 TranslatedText PatternImpl::category() const
00120 {
00121   return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrPatternCategory() );
00122 }
00123 
00124 Pathname PatternImpl::icon() const
00125 {
00126   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternIcon() );
00127 }
00128 
00129 Pathname PatternImpl::script() const
00130 {
00131 #warning DUBIOUS ATTRIBUTE
00132   return "";
00133   //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternScript() );
00134 }
00135 
00136 Label PatternImpl::order() const
00137 {
00138   return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternOrder() );
00139 }
00140 
00141 
00142 void PatternImpl::initUiCapSetFromAttr( CapSet & caps_r, const cache::Attribute & attr_r ) const
00143 {
00144   std::list<std::string> capstr;
00145   _repository->resolvableQuery().queryStringContainerAttribute( _id, attr_r, std::back_inserter(capstr) );
00146   for_( it, capstr.begin(), capstr.end() )
00147   {
00148     caps_r.insert( CapFactory().parse<ResType>( *it ) );
00149   }
00150 }
00151 
00152 const CapSet & PatternImpl::includes() const
00153 {
00154   if ( ! _includes )
00155   {
00156     // lazy init
00157     _includes.reset( new CapSet );
00158     initUiCapSetFromAttr( *_includes, cache::attrPatternUiIncludes() );
00159   }
00160   return *_includes;
00161 }
00162 
00163 const CapSet & PatternImpl::extends() const
00164 {
00165   if ( ! _extends )
00166   {
00167     // lazy init
00168     _extends.reset( new CapSet );
00169     initUiCapSetFromAttr( *_extends, cache::attrPatternUiExtends() );
00170   }
00171   return *_extends;
00172 }
00173 
00175 } } } // namespace zypp::repo::cached
00177 

Generated on Tue Sep 25 19:23:01 2007 for libzypp by  doxygen 1.5.3