Author: jkupec
Date: Wed Jun 6 10:33:09 2007
New Revision: 5679
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5679&view=rev
Log:
hiding impl of PatchesFileReader
Modified:
trunk/libzypp/tests/parser/yum/PatchesFileReader_test.cc
trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc
trunk/libzypp/zypp/parser/yum/PatchesFileReader.h
trunk/libzypp/zypp/parser/yum/RepoParser.cc
Modified: trunk/libzypp/tests/parser/yum/PatchesFileReader_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/parser/yum/PatchesFileReader_test.cc?rev=5679&r1=5678&r2=5679&view=diff
==============================================================================
--- trunk/libzypp/tests/parser/yum/PatchesFileReader_test.cc (original)
+++ trunk/libzypp/tests/parser/yum/PatchesFileReader_test.cc Wed Jun 6 10:33:09 2007
@@ -7,17 +7,16 @@
#include
#include
+#include "zypp/OnMediaLocation.h"
#include "zypp/parser/yum/PatchesFileReader.h"
#include "zypp/Url.h"
#include "zypp/PathInfo.h"
-using std::cout;
-using std::endl;
-using std::string;
+using namespace std;
using namespace zypp;
using namespace boost::unit_test;
-using namespace zypp::source::yum;
+using namespace zypp::parser::yum;
class Collector
{
Modified: trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc?rev=5679&r1=5678&r2=5679&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PatchesFileReader.cc Wed Jun 6 10:33:09 2007
@@ -6,10 +6,17 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
-#include <fstream>
+/** \file zypp/parser/yum/PatchesFileReader.cc
+ * Implementation of patches.xml file reader.
+ */
#include "zypp/base/String.h"
#include "zypp/base/Logger.h"
+
+#include "zypp/Date.h"
+#include "zypp/CheckSum.h"
+#include "zypp/OnMediaLocation.h"
+
+#include "zypp/parser/xml/Reader.h"
#include "zypp/parser/yum/PatchesFileReader.h"
@@ -24,15 +31,59 @@
{
- PatchesFileReader::PatchesFileReader( const Pathname &repomd_file, ProcessResource callback )
- : _tag(tag_NONE), _callback(callback)
+ enum Tag
{
- Reader reader( repomd_file );
- MIL << "Reading " << repomd_file << endl;
- reader.foreachNode( bind( &PatchesFileReader::consumeNode, this, _1 ) );
- }
+ tag_NONE,
+ tag_Patches,
+ tag_Patch,
+ tag_Location,
+ tag_CheckSum,
+ tag_Timestamp,
+ tag_OpenCheckSum
+ };
+
+
+ ///////////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatchesFileReader::Impl
+ //
+ class PatchesFileReader::Impl : private base::NonCopyable
+ {
+ public:
+ /**
+ * CTOR
+ */
+ Impl(const Pathname &patches_file, const ProcessResource & callback);
+
+ /**
+ * Callback provided to the XML parser. Don't use it.
+ */
+ bool consumeNode( Reader & reader_r );
- bool PatchesFileReader::consumeNode( Reader & reader_r )
+ private:
+ OnMediaLocation _location;
+ Tag _tag;
+ std::string _id;
+ ProcessResource _callback;
+ CheckSum _checksum;
+ std::string _checksum_type;
+ Date _timestamp;
+ };
+ ///////////////////////////////////////////////////////////////////////
+
+
+ PatchesFileReader::Impl::Impl(const Pathname & patches_file,
+ const ProcessResource & callback)
+ : _tag(tag_NONE), _callback(callback)
+ {
+ Reader reader( patches_file );
+ MIL << "Reading " << patches_file << endl;
+ reader.foreachNode(bind( &PatchesFileReader::Impl::consumeNode, this, _1 ));
+ }
+
+ // --------------------------------------------------------------------------
+
+ bool PatchesFileReader::Impl::consumeNode( Reader & reader_r )
{
//MIL << reader_r->name() << endl;
std::string data_type;
@@ -80,6 +131,21 @@
}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : PatchesFileReader
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ PatchesFileReader::PatchesFileReader(const Pathname & patches_file,
+ const ProcessResource & callback)
+ : _pimpl(new Impl(patches_file, callback))
+ {}
+
+ PatchesFileReader::~PatchesFileReader()
+ {}
+
+
} // ns yum
} // ns parser
} // ns zypp
Modified: trunk/libzypp/zypp/parser/yum/PatchesFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchesFileReader.h?rev=5679&r1=5678&r2=5679&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchesFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/PatchesFileReader.h Wed Jun 6 10:33:09 2007
@@ -6,18 +6,15 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
+/** \file zypp/parser/yum/PatchesFileReader.h
+ * Interface of patches.xml file reader.
+ */
#ifndef zypp_source_yum_PatchesFileReader_H
#define zypp_source_yum_PatchesFileReader_H
-#include "zypp/Date.h"
-#include "zypp/CheckSum.h"
-#include "zypp/OnMediaLocation.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
#include "zypp/base/Function.h"
-#include "zypp/parser/xml/Reader.h"
-
-using namespace std;
-using namespace zypp::xml;
namespace zypp
@@ -40,49 +37,39 @@
* bind( &SomeClass::callbackfunc, &object, _1, _2 ) );
* \endcode
*/
- class PatchesFileReader
+ class PatchesFileReader : private base::NonCopyable
{
public:
-
- /**
- * Callback definition
- * first parameter is a \ref OnMediaLocation object with the resource
- * second parameter is the patch id.
- */
- typedef function ProcessResource;
-
- enum Tag
- {
- tag_NONE,
- tag_Patches,
- tag_Patch,
- tag_Location,
- tag_CheckSum,
- tag_Timestamp,
- tag_OpenCheckSum
- };
-
- /**
- * Constructor
- * \param patches_file is the patches.xml file you want to read
- * \param callback is a function. \see PatchesFileReader::ProcessResource
- */
- PatchesFileReader( const Pathname &patches_file, ProcessResource callback );
-
- private:
+
+ /**
+ * Callback definition
+ * first parameter is a \ref OnMediaLocation object with the resource
+ * second parameter is the patch id.
+ */
+ typedef
+ function
+ ProcessResource;
+
+
+ /**
+ * CTOR. Creates also \ref xml::Reader and starts reading.
+ *
+ * \param patches_file is the patches.xml file you want to read
+ * \param callback is a function.
+ *
+ * \see PatchesFileReader::ProcessResource
+ */
+ PatchesFileReader(const Pathname &patches_file,
+ const ProcessResource & callback);
+
/**
- * Callback provided to the XML parser. Don't use it.
- */
- bool consumeNode( Reader & reader_r );
-
- private:
- OnMediaLocation _location;
- Tag _tag;
- std::string _id;
- ProcessResource _callback;
- CheckSum _checksum;
- std::string _checksum_type;
- Date _timestamp;
+ * DTOR
+ */
+ ~PatchesFileReader();
+
+ private:
+ class Impl;
+ RW_pointer _pimpl;
};
Modified: trunk/libzypp/zypp/parser/yum/RepoParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepoParser.cc?rev=5679&r1=5678&r2=5679&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepoParser.cc (original)
+++ trunk/libzypp/zypp/parser/yum/RepoParser.cc Wed Jun 6 10:33:09 2007
@@ -32,6 +32,7 @@
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+using namespace std;
using zypp::source::yum::YUMResourceType;
namespace zypp
@@ -45,7 +46,7 @@
/** \todo make this through ZYppCallbacks.h */
bool progress_function(ProgressData::value_type p)
{
- std::cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
+ cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
// cout << "\rParsing $name_would_come_in_handy [" << p << "%]" << flush;
return true;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org