libzypp: zypp-media/ng/providespec.h Source File

libzypp 17.38.8

providespec.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
11#ifndef ZYPP_MEDIA_PROVIDESPEC_H_INCLUDED
12#define ZYPP_MEDIA_PROVIDESPEC_H_INCLUDED
13
14#include <iosfwd>
15
16#include <zypp-core/Url.h>
17#include <zypp-core/ByteCount.h>
18#include <zypp-core/CheckSum.h>
19#include <zypp-core/TriBool.h>
20#include <zypp-core/OnMediaLocation>
21#include <zypp-core/MirroredOrigin.h>
22#include <zypp-media/ng/ProvideFwd>
23#include <zypp-media/ng/HeaderValueMap>
24#include <boost/iterator/iterator_adaptor.hpp>
25
26namespace zyppng
27{
28
29 class ProvideMediaSpec
30 {
31 public:
32
33 ProvideMediaSpec(std::string label="", zypp::Pathname verifyData = zypp::Pathname(), unsigned medianr = 1 );
34
38 const std::string &label() const;
39
43 ProvideMediaSpec &setLabel( const std::string &label );
44
48 unsigned medianr() const;
49
53 ProvideMediaSpec & setMedianr( unsigned medianr );
54
59 zypp::Pathname mediaFile () const;
60
64 ProvideMediaSpec &setMediaFile( const zypp::Pathname &pName );
65
70 HeaderValueMap &customHeaders();
71 const HeaderValueMap &customHeaders() const;
72
76 ProvideMediaSpec &setCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
77
81 ProvideMediaSpec &addCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
82
83 zypp::TriBool isSameMedium ( const ProvideMediaSpec &other ) const;
84
85 static bool isSameMedium ( const zypp::MirroredOrigin &originA, const ProvideMediaSpec &specA, const zypp::MirroredOrigin &originB, const ProvideMediaSpec &specB );
86
87 public:
88 class Impl;
89 private:
90 zypp::RWCOW_pointer<Impl> _pimpl;
91 };
92
93
94 class ProvideFileSpec
95 {
96 friend std::ostream & operator<<( std::ostream &str, const ProvideFileSpec &obj );
97 friend std::ostream & dumpOn( std::ostream &str, const ProvideFileSpec &obj );
98
99 public:
100 ProvideFileSpec();
101
102 ProvideFileSpec(const zypp::OnMediaLocation &loc);
103
104 ProvideFileSpec(const ProvideFileSpec &) = default;
105 ProvideFileSpec(ProvideFileSpec &&) noexcept = default;
106
107 ProvideFileSpec &operator=(const ProvideFileSpec &) = default;
108 ProvideFileSpec &operator=(ProvideFileSpec &&) noexcept = default;
109
111 ~ProvideFileSpec();
112
113 template <typename... T>
114 static ProvideFileSpecRef create ( T... args ) {
115 return std::make_shared<ProvideFileSpec>( std::forward<T>(args)... );
116 }
117
123 const zypp::Pathname &destFilenameHint() const;
124 ProvideFileSpec &setDestFilenameHint ( const zypp::Pathname &filename );
125
126 bool checkExistsOnly () const;
127 ProvideFileSpec & setCheckExistsOnly( const bool set = true );
128
129
134 bool optional() const;
136 ProvideFileSpec & setOptional( bool val );
137
139 const zypp::ByteCount &downloadSize() const;
141 ProvideFileSpec &setDownloadSize( const zypp::ByteCount &val_r );
142
144 const zypp::CheckSum &checksum() const;
146 ProvideFileSpec &setChecksum( const zypp::CheckSum &val_r );
147
148
150 const zypp::ByteCount &openSize() const;
152 ProvideFileSpec &setOpenSize( const zypp::ByteCount &val_r );
153
155 const zypp::CheckSum &openChecksum() const;
157 ProvideFileSpec &setOpenChecksum( const zypp::CheckSum &val_r );
158
160 const zypp::ByteCount &headerSize() const;
162 ProvideFileSpec &setHeaderSize( const zypp::ByteCount &val_r );
163
165 const zypp::CheckSum &headerChecksum() const;
167 ProvideFileSpec &setHeaderChecksum( const zypp::CheckSum &val_r );
168
170 const zypp::Pathname &deltafile() const;
172 ProvideFileSpec &setDeltafile( const zypp::Pathname &path );
173
175 bool mirrorsAllowed() const;
176
178 ProvideFileSpec &setMirrorsAllowed( bool set = true );
179
186 HeaderValueMap &customHeaders();
187 const HeaderValueMap &customHeaders() const;
188
192 ProvideFileSpec &setCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
193
197 ProvideFileSpec &addCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
198
199 zypp::OnMediaLocation asOnMediaLocation ( const zypp::Pathname &path, unsigned int mediaNr ) const;
200
201 public:
202 class Impl;
203 private:
204 zypp::RWCOW_pointer<Impl> _pimpl;
205 };
206
208 std::ostream & operator<<( std::ostream &str, const ProvideFileSpec &obj );
209
211 std::ostream & dumpOn( std::ostream &str, const ProvideFileSpec &obj );
212
213} // namespace zypp
214
215#endif // ZYPP_MEDIA_PROVIDESPEC_H_INCLUDED
ByteCount.h
MirroredOrigin.h
TriBool.h
Url.h
Impl
zypp::ByteCount
Store and operate with byte count.
Definition ByteCount.h:32
zypp::CheckSum
Definition CheckSum.h:34
zypp::MirroredOrigin
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Definition MirroredOrigin.h:170
zypp::OnMediaLocation
Describes a resource file located on a medium.
Definition onmedialocation.h:37
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zyppng::HeaderValueMap
Definition headervaluemap.h:66
zyppng::HeaderValueMap::Value
HeaderValue Value
Definition headervaluemap.h:68
zyppng::ProvideFileSpec
Definition providespec.h:95
zyppng::ProvideFileSpec::ProvideFileSpec
ProvideFileSpec()
Definition providespec.cc:192
zyppng::ProvideFileSpec::optional
bool optional() const
Whether this is an optional resource.
Definition providespec.cc:224
zyppng::ProvideFileSpec::setHeaderChecksum
ProvideFileSpec & setHeaderChecksum(const zypp::CheckSum &val_r)
Set the headerChecksum.
Definition providespec.cc:263
zyppng::ProvideFileSpec::openChecksum
const zypp::CheckSum & openChecksum() const
The checksum of the resource once it has been uncompressed or unpacked.
Definition providespec.cc:248
zyppng::ProvideFileSpec::setCustomHeaderValue
ProvideFileSpec & setCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition providespec.cc:284
zyppng::ProvideFileSpec::setDeltafile
ProvideFileSpec & setDeltafile(const zypp::Pathname &path)
Set the deltafile.
Definition providespec.cc:269
zyppng::ProvideFileSpec::setCheckExistsOnly
ProvideFileSpec & setCheckExistsOnly(const bool set=true)
Definition providespec.cc:221
zyppng::ProvideFileSpec::customHeaders
HeaderValueMap & customHeaders()
Definition providespec.cc:278
zyppng::ProvideFileSpec::destFilenameHint
const zypp::Pathname & destFilenameHint() const
Definition providespec.cc:212
zyppng::ProvideFileSpec::setOptional
ProvideFileSpec & setOptional(bool val)
Set whether the resource is optional.
Definition providespec.cc:227
zyppng::ProvideFileSpec::operator<<
friend std::ostream & operator<<(std::ostream &str, const ProvideFileSpec &obj)
relates: ProvideSpec Stream output
Definition providespec.cc:310
zyppng::ProvideFileSpec::downloadSize
const zypp::ByteCount & downloadSize() const
The size of the resource on the server.
Definition providespec.cc:230
zyppng::ProvideFileSpec::asOnMediaLocation
zypp::OnMediaLocation asOnMediaLocation(const zypp::Pathname &path, unsigned int mediaNr) const
Definition providespec.cc:296
zyppng::ProvideFileSpec::setOpenSize
ProvideFileSpec & setOpenSize(const zypp::ByteCount &val_r)
Set the openSize.
Definition providespec.cc:245
zyppng::ProvideFileSpec::setMirrorsAllowed
ProvideFileSpec & setMirrorsAllowed(bool set=true)
Enables or disables the use of mirrors when fetching this file.
Definition providespec.cc:275
zyppng::ProvideFileSpec::setChecksum
ProvideFileSpec & setChecksum(const zypp::CheckSum &val_r)
Set the checksum.
Definition providespec.cc:239
zyppng::ProvideFileSpec::mirrorsAllowed
bool mirrorsAllowed() const
The requested file is allowed to be fetched via mirrors ( defaults to true ).
Definition providespec.cc:272
zyppng::ProvideFileSpec::openSize
const zypp::ByteCount & openSize() const
The size of the resource once it has been uncompressed or unpacked.
Definition providespec.cc:242
zyppng::ProvideFileSpec::setOpenChecksum
ProvideFileSpec & setOpenChecksum(const zypp::CheckSum &val_r)
Set the openChecksum.
Definition providespec.cc:251
zyppng::ProvideFileSpec::ProvideFileSpec
ProvideFileSpec(const ProvideFileSpec &)=default
zyppng::ProvideFileSpec::deltafile
const zypp::Pathname & deltafile() const
The existing deltafile that can be used to reduce download size ( zchunk or metalink ).
Definition providespec.cc:266
zyppng::ProvideFileSpec::setDestFilenameHint
ProvideFileSpec & setDestFilenameHint(const zypp::Pathname &filename)
Definition providespec.cc:215
zyppng::ProvideFileSpec::_pimpl
zypp::RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition providespec.h:204
zyppng::ProvideFileSpec::checksum
const zypp::CheckSum & checksum() const
The checksum of the resource on the server.
Definition providespec.cc:236
zyppng::ProvideFileSpec::create
static ProvideFileSpecRef create(T... args)
Definition providespec.h:114
zyppng::ProvideFileSpec::setDownloadSize
ProvideFileSpec & setDownloadSize(const zypp::ByteCount &val_r)
Set the downloadSize.
Definition providespec.cc:233
zyppng::ProvideFileSpec::headerChecksum
const zypp::CheckSum & headerChecksum() const
The checksum of the header prepending the resource (e.g.
Definition providespec.cc:260
zyppng::ProvideFileSpec::setHeaderSize
ProvideFileSpec & setHeaderSize(const zypp::ByteCount &val_r)
Set the headerSize.
Definition providespec.cc:257
zyppng::ProvideFileSpec::dumpOn
friend std::ostream & dumpOn(std::ostream &str, const ProvideFileSpec &obj)
relates: ProvideSpec Verbose stream output
Definition providespec.cc:313
zyppng::ProvideFileSpec::addCustomHeaderValue
ProvideFileSpec & addCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition providespec.cc:290
zyppng::ProvideFileSpec::ProvideFileSpec
ProvideFileSpec(ProvideFileSpec &&) noexcept=default
zyppng::ProvideFileSpec::headerSize
const zypp::ByteCount & headerSize() const
The size of the header prepending the resource (e.g.
Definition providespec.cc:254
zyppng::ProvideFileSpec::checkExistsOnly
bool checkExistsOnly() const
Definition providespec.cc:218
zyppng::ProvideMediaSpec::Impl
Definition providespec.cc:35
zyppng::ProvideMediaSpec::setMedianr
ProvideMediaSpec & setMedianr(unsigned medianr)
Definition providespec.cc:113
zyppng::ProvideMediaSpec::setLabel
ProvideMediaSpec & setLabel(const std::string &label)
Definition providespec.cc:104
zyppng::ProvideMediaSpec::ProvideMediaSpec
ProvideMediaSpec(std::string label="", zypp::Pathname verifyData=zypp::Pathname(), unsigned medianr=1)
Definition providespec.cc:95
zyppng::ProvideMediaSpec::customHeaders
HeaderValueMap & customHeaders()
Definition providespec.cc:128
zyppng::ProvideMediaSpec::isSameMedium
zypp::TriBool isSameMedium(const ProvideMediaSpec &other) const
Definition providespec.cc:146
zyppng::ProvideMediaSpec::medianr
unsigned medianr() const
Definition providespec.cc:110
zyppng::ProvideMediaSpec::setCustomHeaderValue
ProvideMediaSpec & setCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition providespec.cc:134
zyppng::ProvideMediaSpec::mediaFile
zypp::Pathname mediaFile() const
Definition providespec.cc:119
zyppng::ProvideMediaSpec::setMediaFile
ProvideMediaSpec & setMediaFile(const zypp::Pathname &pName)
Definition providespec.cc:122
zyppng::ProvideMediaSpec::label
const std::string & label() const
Definition providespec.cc:101
zyppng::ProvideMediaSpec::_pimpl
zypp::RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition providespec.h:90
zyppng::ProvideMediaSpec::addCustomHeaderValue
ProvideMediaSpec & addCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition providespec.cc:140
zypp::TriBool
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
str
String related utilities and Regular expression matching.
zypp::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
relates: Capability Detailed stream output
Definition Capability.cc:589
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zyppng
Definition MediaNetworkRequestExecutor.h:16
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
CheckSum.h