libzypp 17.37.17
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-media/ng/ProvideFwd>
22#include <zypp-media/ng/HeaderValueMap>
23#include <boost/iterator/iterator_adaptor.hpp>
24
25namespace zyppng
26{
27
29 {
30 public:
31
32 ProvideMediaSpec(std::string label="", zypp::Pathname verifyData = zypp::Pathname(), unsigned medianr = 1 );
33
37 const std::string &label() const;
38
42 ProvideMediaSpec &setLabel( const std::string &label );
43
47 unsigned medianr() const;
48
53
59
64
70 const HeaderValueMap &customHeaders() const;
71
75 ProvideMediaSpec &setCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
76
80 ProvideMediaSpec &addCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
81
82 zypp::TriBool isSameMedium ( const ProvideMediaSpec &other ) const;
83
84 public:
85 class Impl;
86 private:
88 };
89
90
92 {
93 friend std::ostream & operator<<( std::ostream &str, const ProvideFileSpec &obj );
94 friend std::ostream & dumpOn( std::ostream &str, const ProvideFileSpec &obj );
95
96 public:
98
100
102 ProvideFileSpec(ProvideFileSpec &&) noexcept = default;
103
104 ProvideFileSpec &operator=(const ProvideFileSpec &) = default;
105 ProvideFileSpec &operator=(ProvideFileSpec &&) noexcept = default;
106
109
110 template <typename... T>
111 static ProvideFileSpecRef create ( T... args ) {
112 return std::make_shared<ProvideFileSpec>( std::forward<T>(args)... );
113 }
114
120 const zypp::Pathname &destFilenameHint() const;
122
123 bool checkExistsOnly () const;
124 ProvideFileSpec & setCheckExistsOnly( const bool set = true );
125
126
131 bool optional() const;
133 ProvideFileSpec & setOptional( bool val );
134
136 const zypp::ByteCount &downloadSize() const;
139
141 const zypp::CheckSum &checksum() const;
144
145
147 const zypp::ByteCount &openSize() const;
150
152 const zypp::CheckSum &openChecksum() const;
155
157 const zypp::ByteCount &headerSize() const;
160
162 const zypp::CheckSum &headerChecksum() const;
165
167 const zypp::Pathname &deltafile() const;
170
172 bool mirrorsAllowed() const;
173
175 ProvideFileSpec &setMirrorsAllowed( bool set = true );
176
184 const HeaderValueMap &customHeaders() const;
185
189 ProvideFileSpec &setCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
190
194 ProvideFileSpec &addCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
195
196 zypp::OnMediaLocation asOnMediaLocation ( const zypp::Pathname &path, unsigned int mediaNr ) const;
197
198 public:
199 class Impl;
200 private:
202 };
203
205 std::ostream & operator<<( std::ostream &str, const ProvideFileSpec &obj );
206
208 std::ostream & dumpOn( std::ostream &str, const ProvideFileSpec &obj );
209
210} // namespace zypp
211
212#endif // ZYPP_MEDIA_PROVIDESPEC_H_INCLUDED
Store and operate with byte count.
Definition ByteCount.h:32
Describes a resource file located on a medium.
bool optional() const
Whether this is an optional resource.
ProvideFileSpec & setHeaderChecksum(const zypp::CheckSum &val_r)
Set the headerChecksum.
const zypp::CheckSum & openChecksum() const
The checksum of the resource once it has been uncompressed or unpacked.
ProvideFileSpec & setCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
ProvideFileSpec & setDeltafile(const zypp::Pathname &path)
Set the deltafile.
ProvideFileSpec & setCheckExistsOnly(const bool set=true)
HeaderValueMap & customHeaders()
const zypp::Pathname & destFilenameHint() const
ProvideFileSpec & setOptional(bool val)
Set whether the resource is optional.
friend std::ostream & operator<<(std::ostream &str, const ProvideFileSpec &obj)
const zypp::ByteCount & downloadSize() const
The size of the resource on the server.
zypp::OnMediaLocation asOnMediaLocation(const zypp::Pathname &path, unsigned int mediaNr) const
ProvideFileSpec & setOpenSize(const zypp::ByteCount &val_r)
Set the openSize.
ProvideFileSpec & setMirrorsAllowed(bool set=true)
Enables or disables the use of mirrors when fetching this file.
ProvideFileSpec & setChecksum(const zypp::CheckSum &val_r)
Set the checksum.
bool mirrorsAllowed() const
The requested file is allowed to be fetched via mirrors ( defaults to true )
const zypp::ByteCount & openSize() const
The size of the resource once it has been uncompressed or unpacked.
ProvideFileSpec & setOpenChecksum(const zypp::CheckSum &val_r)
Set the openChecksum.
ProvideFileSpec(const ProvideFileSpec &)=default
const zypp::Pathname & deltafile() const
The existing deltafile that can be used to reduce download size ( zchunk or metalink )
ProvideFileSpec & setDestFilenameHint(const zypp::Pathname &filename)
zypp::RWCOW_pointer< Impl > _pimpl
Implementation class.
const zypp::CheckSum & checksum() const
The checksum of the resource on the server.
static ProvideFileSpecRef create(T... args)
ProvideFileSpec & setDownloadSize(const zypp::ByteCount &val_r)
Set the downloadSize.
const zypp::CheckSum & headerChecksum() const
The checksum of the header prepending the resource (e.g.
ProvideFileSpec & setHeaderSize(const zypp::ByteCount &val_r)
Set the headerSize.
friend std::ostream & dumpOn(std::ostream &str, const ProvideFileSpec &obj)
ProvideFileSpec & addCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
ProvideFileSpec(ProvideFileSpec &&) noexcept=default
const zypp::ByteCount & headerSize() const
The size of the header prepending the resource (e.g.
bool checkExistsOnly() const
ProvideMediaSpec & setMedianr(unsigned medianr)
ProvideMediaSpec & setLabel(const std::string &label)
ProvideMediaSpec(std::string label="", zypp::Pathname verifyData=zypp::Pathname(), unsigned medianr=1)
HeaderValueMap & customHeaders()
zypp::TriBool isSameMedium(const ProvideMediaSpec &other) const
unsigned medianr() const
ProvideMediaSpec & setCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
zypp::Pathname mediaFile() const
ProvideMediaSpec & setMediaFile(const zypp::Pathname &pName)
const std::string & label() const
zypp::RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition providespec.h:87
ProvideMediaSpec & addCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
String related utilities and Regular expression matching.
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469