libzypp  17.28.8
MetaLinkParser.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_MEDIA_METALINKPARSER_H
13 #define ZYPP_MEDIA_METALINKPARSER_H
14 
15 #include <string>
16 
17 #include <zypp/base/Exception.h>
18 #include <zypp/base/NonCopyable.h>
19 #include <zypp/base/InputStream.h>
21 #include <zypp/Url.h>
22 #include <zypp/ByteArray.h>
23 
24 namespace zypp::media {
25 
26 struct ml_parsedata;
27 
29  int priority = 0;
30  int maxConnections = -1; //< How many connections can be opened to that mirror, -1 means no limit was defined.
32 };
33 
35 public:
38 
43  void parse(const Pathname &filename);
44 
49  void parse(const InputStream &is);
50 
55  void parseBytes(const char* bytes, size_t len);
60  void parseEnd();
61 
65  std::vector<Url> getUrls() const;
66 
70  const std::vector<MetalinkMirror> &getMirrors() const;
71 
76 
77  const std::vector<UByteArray> &getZsyncBlockHashes() const;
78  const std::vector<UByteArray> &getSHA1BlockHashes() const;
79 
80 private:
81  struct ml_parsedata *pd;
82 };
83 
84 UByteArray hexstr2bytes( std::string str );
85 
86 } // namespace zypp::media
87 
88 #endif // ZYPP_MEDIA_METALINKPARSER_H
Helper to create and pass std::istream.
Definition: InputStream.h:57
Url manipulation class.
Definition: Url.h:92
void parseEnd()
tells the parser that all chunks are now processed
struct ml_parsedata * pd
void parse(const Pathname &filename)
parse a file consisting of metalink xml data
MediaBlockList getBlockList() const
return the block list from the parsed metalink data
void parseBytes(const char *bytes, size_t len)
parse a chunk of a file consisting of metalink xml data.
const std::vector< UByteArray > & getSHA1BlockHashes() const
const std::vector< UByteArray > & getZsyncBlockHashes() const
const std::vector< MetalinkMirror > & getMirrors() const
return the mirrors from the parsed metalink data
std::vector< Url > getUrls() const
return the download urls from the parsed metalink data
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
UByteArray hexstr2bytes(std::string str)