libzypp  17.31.31
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 
25 namespace zyppng
26 {
27 
29  {
30  public:
31 
32  ProvideMediaSpec( const std::string &label, const 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 
52  ProvideMediaSpec & setMedianr( unsigned medianr );
53 
58  zypp::Pathname mediaFile () const;
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 
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 
103 
104  template <typename... T>
105  static ProvideFileSpecRef create ( T... args ) {
106  return std::make_shared<ProvideFileSpec>( std::forward<T>(args)... );
107  }
108 
114  const zypp::Pathname &destFilenameHint() const;
116 
117  bool checkExistsOnly () const;
118  ProvideFileSpec & setCheckExistsOnly( const bool set = true );
119 
120 
125  bool optional() const;
127  ProvideFileSpec & setOptional( bool val );
128 
130  const zypp::ByteCount &downloadSize() const;
133 
135  const zypp::CheckSum &checksum() const;
137  ProvideFileSpec &setChecksum( const zypp::CheckSum &val_r );
138 
139 
141  const zypp::ByteCount &openSize() const;
144 
146  const zypp::CheckSum &openChecksum() const;
149 
151  const zypp::ByteCount &headerSize() const;
154 
156  const zypp::CheckSum &headerChecksum() const;
159 
161  const zypp::Pathname &deltafile() const;
164 
172  const HeaderValueMap &customHeaders() const;
173 
177  ProvideFileSpec &setCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
178 
182  ProvideFileSpec &addCustomHeaderValue ( const std::string &key, const HeaderValueMap::Value &val );
183 
184  public:
185  class Impl;
186  private:
188  };
189 
191  std::ostream & operator<<( std::ostream &str, const ProvideFileSpec &obj );
192 
194  std::ostream & dumpOn( std::ostream &str, const ProvideFileSpec &obj );
195 
196 } // namespace zypp
197 
198 #endif // ZYPP_MEDIA_PROVIDESPEC_H_INCLUDED
ProvideFileSpec & setHeaderChecksum(const zypp::CheckSum &val_r)
Set the headerChecksum.
Definition: providespec.cc:237
ProvideFileSpec & setOptional(bool val)
Set whether the resource is optional.
Definition: providespec.cc:201
Describes a resource file located on a medium.
const zypp::ByteCount & openSize() const
The size of the resource once it has been uncompressed or unpacked.
Definition: providespec.cc:216
zypp::RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: providespec.h:85
Store and operate with byte count.
Definition: ByteCount.h:30
const zypp::CheckSum & openChecksum() const
The checksum of the resource once it has been uncompressed or unpacked.
Definition: providespec.cc:222
static ProvideFileSpecRef create(T... args)
Definition: providespec.h:105
std::ostream & dumpOn(std::ostream &str, const ProvideFileSpec &obj)
Definition: providespec.cc:267
zypp::RWCOW_pointer< Impl > _pimpl
Implementation class.
Definition: providespec.h:185
ProvideMediaSpec & setMedianr(unsigned medianr)
Definition: providespec.cc:107
ProvideMediaSpec(const std::string &label, const zypp::Pathname &verifyData=zypp::Pathname(), unsigned medianr=1)
Definition: providespec.cc:89
String related utilities and Regular expression matching.
const zypp::Pathname & deltafile() const
The existing deltafile that can be used to reduce download size ( zchunk or metalink ) ...
Definition: providespec.cc:240
const std::string & label() const
Definition: providespec.cc:95
ProvideFileSpec & setOpenChecksum(const zypp::CheckSum &val_r)
Set the openChecksum.
Definition: providespec.cc:225
ProvideFileSpec & setDestFilenameHint(const zypp::Pathname &filename)
Definition: providespec.cc:189
std::ostream & operator<<(std::ostream &str, const MediaDataVerifierRef &obj)
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:30
unsigned medianr() const
Definition: providespec.cc:104
const zypp::CheckSum & checksum() const
The checksum of the resource on the server.
Definition: providespec.cc:210
zypp::Pathname mediaFile() const
Definition: providespec.cc:113
ProvideFileSpec & setDeltafile(const zypp::Pathname &path)
Set the deltafile.
Definition: providespec.cc:243
zypp::TriBool isSameMedium(const ProvideMediaSpec &other)
Definition: providespec.cc:140
const zypp::CheckSum & headerChecksum() const
The checksum of the header prepending the resource (e.g.
Definition: providespec.cc:234
ProvideFileSpec & setHeaderSize(const zypp::ByteCount &val_r)
Set the headerSize.
Definition: providespec.cc:231
ProvideFileSpec & addCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition: providespec.cc:258
const zypp::ByteCount & downloadSize() const
The size of the resource on the server.
Definition: providespec.cc:204
const zypp::Pathname & destFilenameHint() const
Definition: providespec.cc:186
ProvideFileSpec & setOpenSize(const zypp::ByteCount &val_r)
Set the openSize.
Definition: providespec.cc:219
ProvideMediaSpec & addCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition: providespec.cc:134
HeaderValueMap & customHeaders()
Definition: providespec.cc:122
ProvideFileSpec & setChecksum(const zypp::CheckSum &val_r)
Set the checksum.
Definition: providespec.cc:213
ProvideMediaSpec & setLabel(const std::string &label)
Definition: providespec.cc:98
ProvideMediaSpec & setCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition: providespec.cc:128
friend std::ostream & dumpOn(std::ostream &str, const ProvideFileSpec &obj)
Definition: providespec.cc:267
ProvideMediaSpec & setMediaFile(const zypp::Pathname &pName)
Definition: providespec.cc:116
ProvideFileSpec & setDownloadSize(const zypp::ByteCount &val_r)
Set the downloadSize.
Definition: providespec.cc:207
bool optional() const
Whether this is an optional resource.
Definition: providespec.cc:198
ProvideFileSpec & setCheckExistsOnly(const bool set=true)
Definition: providespec.cc:195
friend std::ostream & operator<<(std::ostream &str, const ProvideFileSpec &obj)
Definition: providespec.cc:264
ProvideFileSpec & setCustomHeaderValue(const std::string &key, const HeaderValueMap::Value &val)
Definition: providespec.cc:252
const zypp::ByteCount & headerSize() const
The size of the header prepending the resource (e.g.
Definition: providespec.cc:228
HeaderValueMap & customHeaders()
Definition: providespec.cc:246
bool checkExistsOnly() const
Definition: providespec.cc:192