1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/parser/yum/RepomdFileReader.h
10 * Interface of repomd.xml file reader.
12 #ifndef zypp_source_yum_RepomdFileReader_H
13 #define zypp_source_yum_RepomdFileReader_H
15 #include "zypp/base/PtrTypes.h"
16 #include "zypp/base/NonCopyable.h"
17 #include "zypp/base/Function.h"
19 #include "zypp/OnMediaLocation.h"
20 #include "zypp/repo/yum/ResourceType.h"
31 * Reads through a repomd.xml file and collects type, location, checksum and
32 * other data about metadata files to be processed.
34 * After each file entry is read, a \ref OnMediaLocation
35 * and \ref repo::yum::ResourceType are prepared and passed to the \ref _callback.
37 * Depending on the \ref _callback type provided on construction, ResourceType may
38 * additionally be passed as a plain string. This form allows handling custom
39 * resource types (e.g. ones with embedded locale tag).
42 * RepomdFileReader reader(repomd_file,
43 * bind( &SomeClass::callbackfunc, &SomeClassInstance, _1, _2 ) );
46 class RepomdFileReader : private base::NonCopyable
49 /** Callbacl taking \ref OnMediaLocation and \ref repo::yum::ResourceType */
50 typedef function< bool( const OnMediaLocation &, const repo::yum::ResourceType & )> ProcessResource;
52 /** Alternate callback also receiving the ResourceType as string. */
53 typedef function< bool( const OnMediaLocation &, const repo::yum::ResourceType &, const std::string & )> ProcessResource2;
56 * CTOR. Creates also \ref xml::Reader and starts reading.
58 * \param repomd_file is the repomd.xml file you want to read
59 * \param callback is a function.
61 * \see RepomdFileReader::ProcessResource
63 RepomdFileReader( const Pathname & repomd_file, const ProcessResource & callback );
64 /** \overload taking ProcessResource2 callback */
65 RepomdFileReader( const Pathname & repomd_file, const ProcessResource2 & callback );
72 RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
80 #endif // zypp_source_yum_RepomdFileReader_H