Mailinglist Archive: zypp-devel (21 mails)

< Previous Next >
Re: [zypp-devel] ok to commit?
  • From: Dominik Heidler <dheidler@xxxxxxx>
  • Date: Thu, 14 Oct 2010 12:25:20 +0200
  • Message-id: <4CB6DA90.7030403@xxxxxxx>
Josef Reidinger write:
Dominik Heidler write:
diff --git a/zypp/media/MetaLinkParser.cc b/zypp/media/MetaLinkParser.cc
index 056a7f5..2c11cf6 100644
--- a/zypp/media/MetaLinkParser.cc
+++ b/zypp/media/MetaLinkParser.cc
@@ -386,16 +386,21 @@ MetaLinkParser::~MetaLinkParser()
}

void
-MetaLinkParser::parse(string filename)
+MetaLinkParser::parse(Pathname filename)
+{
+ parse(InputStream(filename));
+}
+
+void
+MetaLinkParser::parse(const InputStream &is)
{
char buf[4096];
- std::ifstream is(filename.c_str());
- if (!is)
+ if (!is.stream())
ZYPP_THROW(Exception("MetaLinkParser: no such file"));
- while (is.good())
+ while (is.stream().good())
{
- is.read(buf, sizeof(buf));
- parseBytes(buf, is.gcount());
+ is.stream().read(buf, sizeof(buf));
+ parseBytes(buf, is.stream().gcount());
}
parseEnd();
}
diff --git a/zypp/media/MetaLinkParser.h b/zypp/media/MetaLinkParser.h
index eacc486..b9073d0 100644
--- a/zypp/media/MetaLinkParser.h
+++ b/zypp/media/MetaLinkParser.h
@@ -16,6 +16,7 @@

#include "zypp/base/Exception.h"
#include "zypp/base/NonCopyable.h"
+#include "zypp/base/InputStream.h"
#include "zypp/media/MediaBlockList.h"
#include "zypp/Url.h"

@@ -33,7 +34,13 @@ public:
* parse a file consisting of metalink xml data
* \throws Exception
**/
- void parse(std::string filename);
+ void parse(Pathname filename);
+


Why there is not parse with InputStream variant in header? I think it could
be useful, as it allows to parse stream e.g. directly from network.
Josef


It's included (don't know how it got lost in the email)
Here the complete diff:
http://gitorious.org/opensuse/libzypp/commit/9775d0e85d999835e85e87678a4210e120ff9103

--
Dominik Heidler
Maxfeldstr. 5, D-90409 Nuernberg, Germany
SUSE LINUX Products GmbH, Nuernberg
_________________________________________

ドミニク
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups