Imported Upstream version 17.22.0
[platform/upstream/libzypp.git] / zypp / parser / yum / RepomdFileReader.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/parser/yum/RepomdFileReader.h
10  * Interface of repomd.xml file reader.
11  */
12 #ifndef zypp_source_yum_RepomdFileReader_H
13 #define zypp_source_yum_RepomdFileReader_H
14
15 #include "zypp/base/PtrTypes.h"
16 #include "zypp/base/NonCopyable.h"
17 #include "zypp/base/Function.h"
18
19 #include "zypp/OnMediaLocation.h"
20
21 namespace zypp
22 {
23   namespace parser
24   {
25     namespace yum
26     {
27
28
29   /**
30    * Reads through a repomd.xml file and collects type, location, checksum and
31    * other data about metadata files to be processed.
32    *
33    * After each file entry is read, an \ref OnMediaLocation and the resource type
34    * string are prepared and passed to the \ref _callback.
35    */
36   class RepomdFileReader : private base::NonCopyable
37   {
38   public:
39     /** Callback taking \ref OnMediaLocation and the resource type string */
40     typedef function< bool( OnMediaLocation &&, const std::string & )> ProcessResource;
41
42    /**
43     * CTOR. Creates also \ref xml::Reader and starts reading.
44     * 
45     * \param repomd_file is the repomd.xml file you want to read
46     * \param callback is a function.
47     *
48     * \see RepomdFileReader::ProcessResource
49     */
50     RepomdFileReader( const Pathname & repomd_file, const ProcessResource & callback );
51
52     /** DTOR */
53     ~RepomdFileReader();
54
55   private:
56     class Impl;
57     RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
58   };
59
60
61     } // namespace yum
62   } // namespace parser
63 } // namespace zypp
64
65 #endif // zypp_source_yum_RepomdFileReader_H