1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/parser/RepoindexFileReader.h
10 * Interface of repoindex.xml file reader.
12 #ifndef zypp_source_yum_RepoindexFileReader_H
13 #define zypp_source_yum_RepoindexFileReader_H
15 #include "zypp/base/PtrTypes.h"
16 #include "zypp/base/NonCopyable.h"
17 #include "zypp/base/Function.h"
18 #include "zypp/base/InputStream.h"
19 #include "zypp/Pathname.h"
20 #include "zypp/Date.h"
30 * Reads through a repoindex.xml file and collects repositories.
32 * After each repository is read, a \ref RepoInfo
33 * is prepared and \ref _callback
34 * is called with this object passed in.
36 * The \ref _callback is provided on construction.
40 * RepoindexFileReader reader(repoindex_file,
41 * bind( &SomeClass::callbackfunc, &SomeClassInstance, _1) );
44 class RepoindexFileReader : private base::NonCopyable
48 * Callback definition.
49 * First parameter is a \ref RepoInfo object with the resource
50 * FIXME return value is ignored
52 typedef function< bool( const RepoInfo & )> ProcessResource;
55 * CTOR. Creates also \ref xml::Reader and starts reading.
57 * \param repoindexFile is the repoindex.xml file you want to read
58 * \param callback is a function.
60 * \see RepoindexFileReader::ProcessResource
62 RepoindexFileReader( const zypp::Pathname & repoindexFile,
63 const ProcessResource & callback);
66 * \short Constructor. Creates the reader and start reading.
68 * \param is a valid input stream
69 * \param callback Callback that will be called for each repository.
71 * \see RepoindexFileReader::ProcessResource
73 RepoindexFileReader( const InputStream &is,
74 const ProcessResource & callback );
79 ~RepoindexFileReader();
81 /** Metadata TTL (repoindex.xml:xpath:/repoindex@ttl or 0). */
82 Date::Duration ttl() const;
86 RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
93 #endif /*zypp_source_yum_RepoindexFileReader_H*/
95 // vim: set ts=2 sts=2 sw=2 et ai: