00001
00002
00003
00004
00005
00006
00007
00008
00013 #include <string>
00014 #include <iostream>
00015 #include "zypp/source/SourceInfo.h"
00016
00017 using namespace boost;
00018
00020 namespace zypp
00021 {
00022 namespace source
00023 {
00024
00025 SourceInfo::SourceInfo()
00026 : _enabled (indeterminate)
00027 , _autorefresh(indeterminate)
00028 , _base_source( indeterminate )
00029 {
00030
00031 }
00032
00033 SourceInfo::SourceInfo( const Url & url, const Pathname & path, const std::string & alias, const Pathname & cache_dir, tribool autorefresh)
00034 : _enabled (true),
00035 _autorefresh(autorefresh),
00036 _base_source( indeterminate ),
00037 _url(url),
00038 _cache_dir(cache_dir),
00039 _path(path),
00040 _alias(alias)
00041 {
00042
00043 }
00044
00045 SourceInfo & SourceInfo::setEnabled( boost::tribool enabled )
00046 {
00047 _enabled = enabled;
00048 return *this;
00049 }
00050
00051 SourceInfo & SourceInfo::setAutorefresh( boost::tribool autorefresh )
00052 {
00053 _autorefresh = autorefresh;
00054 return *this;
00055 }
00056
00057 SourceInfo & SourceInfo::setBaseSource( bool val_r )
00058 {
00059 _base_source = val_r;
00060 return *this;
00061 }
00062
00063 SourceInfo & SourceInfo::setUrl( const Url &url )
00064 {
00065 _url = url;
00066 return *this;
00067 }
00068
00069 SourceInfo & SourceInfo::setPath( const Pathname &p )
00070 {
00071 _path = p;
00072 return *this;
00073 }
00074
00075 SourceInfo & SourceInfo::setAlias( const std::string &alias )
00076 {
00077 _alias = alias;
00078 return *this;
00079 }
00080
00081 SourceInfo & SourceInfo::setType( const std::string &t )
00082 {
00083 _type = t;
00084 return *this;
00085 }
00086
00087 SourceInfo & SourceInfo::setCacheDir( const Pathname &p )
00088 {
00089 _cache_dir = p;
00090 return *this;
00091 }
00092
00093 SourceInfo & SourceInfo::setDescription( const std::string &description )
00094 {
00095 _description = description;
00096 return *this;
00097 }
00098
00099 SourceInfo & SourceInfo::setChecksum( const CheckSum &checksum )
00100 {
00101 _checksum = checksum;
00102 return *this;
00103 }
00104
00105 SourceInfo & SourceInfo::setTimestamp( const Date ×tamp )
00106 {
00107 _timestamp = timestamp;
00108 return *this;
00109 }
00110
00111 tribool SourceInfo::enabled() const
00112 { return _enabled; }
00113
00114 tribool SourceInfo::autorefresh() const
00115 { return _autorefresh; }
00116
00117 boost::tribool SourceInfo::baseSource() const
00118 { return _base_source; }
00119
00120 Pathname SourceInfo::cacheDir() const
00121 { return _cache_dir; }
00122
00123 Pathname SourceInfo::path() const
00124 { return _path; }
00125
00126 std::string SourceInfo::alias() const
00127 { return _alias; }
00128
00129 std::string SourceInfo::description() const
00130 { return _description; }
00131
00132 CheckSum SourceInfo::checksum() const
00133 { return _checksum; }
00134
00135 Date SourceInfo::timestamp() const
00136 { return _timestamp; }
00137
00138 std::string SourceInfo::type() const
00139 { return _type; }
00140
00141 Url SourceInfo::url() const
00142 { return _url; }
00143
00144 std::ostream & SourceInfo::dumpOn( std::ostream & str ) const
00145 {
00146 str << "--------------------------------------" << std::endl;
00147 str << "- alias : " << alias() << std::endl;
00148 str << "- url : " << url() << std::endl;
00149 str << "- type : " << type() << std::endl;
00150 str << "- basesource : " << baseSource() << std::endl;
00151 str << "- enabled : " << enabled() << std::endl;
00152 str << "- autorefresh : " << autorefresh() << std::endl;
00153 str << "- path : " << path() << std::endl;
00154 str << "- cache_dir : " << cacheDir() << std::endl;
00155 return str;
00156 }
00157
00158 }
00160 }