Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / parser / RepoindexFileReader.h
index fd18461..500b29f 100644 (file)
@@ -6,7 +6,7 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/RepoindexFileReader.h
+/** \file zypp/parser/RepoindexFileReader.h
  * Interface of repoindex.xml file reader.
  */
 #ifndef zypp_source_yum_RepoindexFileReader_H
 #include "zypp/base/PtrTypes.h"
 #include "zypp/base/NonCopyable.h"
 #include "zypp/base/Function.h"
-
-#include "zypp/RepoInfo.h"
+#include "zypp/base/InputStream.h"
+#include "zypp/Pathname.h"
+#include "zypp/Date.h"
 
 namespace zypp
 {
+  class RepoInfo;
+
   namespace parser
   {
 
@@ -28,13 +31,13 @@ namespace zypp
    *
    * After each repository is read, a \ref RepoInfo
    * is prepared and \ref _callback
-   * is called with these two objects passed in.
+   * is called with this object passed in.
    *
    * The \ref _callback is provided on construction.
    *
    *
    * \code
-   * RepoindexFileReader reader(repoindex_file, 
+   * RepoindexFileReader reader(repoindex_file,
    *                  bind( &SomeClass::callbackfunc, &SomeClassInstance, _1) );
    * \endcode
    */
@@ -44,28 +47,40 @@ namespace zypp
    /**
     * Callback definition.
     * First parameter is a \ref RepoInfo object with the resource
-    * second parameter is the resource type.
+    * FIXME return value is ignored
     */
-    typedef function< bool(
-        const RepoInfo & )>
-      ProcessResource;
+    typedef function< bool( const RepoInfo & )> ProcessResource;
 
    /**
     * CTOR. Creates also \ref xml::Reader and starts reading.
-    * 
-    * \param repoindex_file is the repoindex.xml file you want to read
+    *
+    * \param repoindexFile is the repoindex.xml file you want to read
     * \param callback is a function.
     *
     * \see RepoindexFileReader::ProcessResource
     */
-    RepoindexFileReader(
-      const Pathname & repoindex_file, const ProcessResource & callback);
+    RepoindexFileReader( const zypp::Pathname & repoindexFile,
+                         const ProcessResource & callback);
+
+    /**
+     * \short Constructor. Creates the reader and start reading.
+     *
+     * \param is a valid input stream
+     * \param callback Callback that will be called for each repository.
+     *
+     * \see RepoindexFileReader::ProcessResource
+     */
+     RepoindexFileReader( const InputStream &is,
+                          const ProcessResource & callback );
 
     /**
      * DTOR
      */
     ~RepoindexFileReader();
 
+    /** Metadata TTL (repoindex.xml:xpath:/repoindex@ttl or 0). */
+    Date::Duration ttl() const;
+
   private:
     class Impl;
     RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;