Author: jkupec
Date: Wed Jun 6 09:56:59 2007
New Revision: 5678
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5678&view=rev
Log:
PatchesFileReader moved to parser namespace
Modified:
trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc
trunk/libzypp/zypp/parser/yum/PatchesFileReader.h
trunk/libzypp/zypp/parser/yum/RepoParser.cc
Modified: trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc?rev=5678&r1=5677&r2=5678&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc Wed Jun 6 09:56:59 2007
@@ -16,62 +16,72 @@
using namespace std;
using namespace zypp::xml;
-namespace zypp { namespace source { namespace yum {
-
-PatchesFileReader::PatchesFileReader( const Pathname &repomd_file, ProcessResource callback )
- : _tag(tag_NONE), _callback(callback)
-{
- Reader reader( repomd_file );
- MIL << "Reading " << repomd_file << endl;
- reader.foreachNode( bind( &PatchesFileReader::consumeNode, this, _1 ) );
-}
-
-bool PatchesFileReader::consumeNode( Reader & reader_r )
+namespace zypp
{
- //MIL << reader_r->name() << endl;
- std::string data_type;
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT )
+ namespace parser
{
- if ( reader_r->name() == "patches" )
- {
- _tag = tag_Patches;
- return true;
- }
- if ( reader_r->name() == "patch" )
+ namespace yum
{
- _tag = tag_Patch;
- _id = reader_r->getAttribute("id").asString();
- return true;
- }
- if ( reader_r->name() == "location" )
- {
- _tag = tag_Location;
- _location.filename( reader_r->getAttribute("href").asString() );
- return true;
- }
- if ( reader_r->name() == "checksum" )
+
+
+ PatchesFileReader::PatchesFileReader( const Pathname &repomd_file, ProcessResource callback )
+ : _tag(tag_NONE), _callback(callback)
+ {
+ Reader reader( repomd_file );
+ MIL << "Reading " << repomd_file << endl;
+ reader.foreachNode( bind( &PatchesFileReader::consumeNode, this, _1 ) );
+ }
+
+ bool PatchesFileReader::consumeNode( Reader & reader_r )
+ {
+ //MIL << reader_r->name() << endl;
+ std::string data_type;
+ if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT )
{
- _tag = tag_CheckSum;
- string checksum_type = reader_r->getAttribute("type").asString() ;
- string checksum_vaue = reader_r.nodeText().asString();
- _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
- return true;
+ if ( reader_r->name() == "patches" )
+ {
+ _tag = tag_Patches;
+ return true;
+ }
+ if ( reader_r->name() == "patch" )
+ {
+ _tag = tag_Patch;
+ _id = reader_r->getAttribute("id").asString();
+ return true;
+ }
+ if ( reader_r->name() == "location" )
+ {
+ _tag = tag_Location;
+ _location.filename( reader_r->getAttribute("href").asString() );
+ return true;
+ }
+ if ( reader_r->name() == "checksum" )
+ {
+ _tag = tag_CheckSum;
+ string checksum_type = reader_r->getAttribute("type").asString() ;
+ string checksum_vaue = reader_r.nodeText().asString();
+ _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
+ return true;
+ }
+ if ( reader_r->name() == "timestamp" )
+ {
+ // ignore it
+ return true;
+ }
}
- if ( reader_r->name() == "timestamp" )
+ else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
{
- // ignore it
+ //MIL << "end element" << endl;
+ if ( reader_r->name() == "patch" )
+ _callback( _location, _id );
return true;
}
- }
- else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
- {
- //MIL << "end element" << endl;
- if ( reader_r->name() == "patch" )
- _callback( _location, _id );
return true;
}
- return true;
-}
-} } } //ns zypp::source::yum
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp/parser/yum/PatchesFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchesFileReader.h?rev=5678&r1=5677&r2=5678&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchesFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/PatchesFileReader.h Wed Jun 6 09:56:59 2007
@@ -19,70 +19,77 @@
using namespace std;
using namespace zypp::xml;
+
namespace zypp
{
- namespace source
+ namespace parser
{
namespace yum
{
- /**
- * Iterates through a patches.xml file giving on each iteration
- * a \ref OnMediaLocation object with the resource and its
- * patch id.
- * The iteration is done via a callback provided on
- * construction.
- *
- * \code
- * PatchesFileReader reader(patches_file,
- * bind( &SomeClass::callbackfunc, &object, _1, _2 ) );
- * \endcode
- */
- class PatchesFileReader
- {
- public:
-
- /**
- * Callback definition
- * first parameter is a \ref OnMediaLocation object with the resource
- * second parameter is the patch id.
- */
- typedef function