- Cleanup, mostly by removing, unused parser code and related classes.
authorMichael Andres <ma@suse.de>
Wed, 6 Aug 2008 15:17:49 +0000 (15:17 +0000)
committerMichael Andres <ma@suse.de>
Wed, 6 Aug 2008 15:17:49 +0000 (15:17 +0000)
31 files changed:
devel/devel.ma/Test.cc
devel/devel.ma/testdrafts/RepoParser.cc [deleted file]
package/libzypp.changes
tests/zypp/CMakeLists.txt
tests/zypp/TranslatedText_test.cc [deleted file]
zypp/CMakeLists.txt
zypp/RepoManager.cc
zypp/TranslatedText.cc [deleted file]
zypp/TranslatedText.h [deleted file]
zypp/data/RecordId.cc [deleted file]
zypp/data/RecordId.h [deleted file]
zypp/data/ResolvableData.cc [deleted file]
zypp/data/ResolvableData.h [deleted file]
zypp/data/ResolvableDataConsumer.cc [deleted file]
zypp/data/ResolvableDataConsumer.h [deleted file]
zypp/parser/LibXMLHelper.cc [deleted file]
zypp/parser/LibXMLHelper.h [deleted file]
zypp/parser/TagParser.cc [deleted file]
zypp/parser/TagParser.h [deleted file]
zypp/parser/XMLNodeIterator.cc [deleted file]
zypp/parser/XMLNodeIterator.h [deleted file]
zypp/parser/plaindir/RepoParser.cc
zypp/parser/plaindir/RepoParser.h
zypp/parser/susetags/ContentFileReader.cc
zypp/parser/susetags/ContentFileReader.h
zypp/parser/xml/XmlEscape.h [new file with mode: 0644]
zypp/parser/xml/XmlString.h
zypp/parser/xml/xml_escape_parser.cpp [moved from zypp/parser/xml_escape_parser.cpp with 100% similarity]
zypp/parser/xml/xml_escape_parser.hpp [new file with mode: 0644]
zypp/parser/xml_escape_parser.hpp
zypp/parser/xml_parser_assert.h [deleted file]

index 6601a28..1a756c3 100644 (file)
 #include <zypp/CheckSum.h>
 #include <zypp/Date.h>
 
-#include "zypp/parser/TagParser.h"
-#include "zypp/parser/susetags/PackagesFileReader.h"
-#include "zypp/parser/susetags/PackagesLangFileReader.h"
-#include "zypp/parser/susetags/PatternFileReader.h"
-#include "zypp/parser/susetags/ContentFileReader.h"
-#include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/parser/susetags/RepoParser.h"
-#include "zypp/cache/CacheStore.h"
-
 using namespace std;
 using namespace zypp;
-using namespace zypp::parser;
-using namespace zypp::parser::susetags;
 
 ///////////////////////////////////////////////////////////////////
 
-struct DummyConsumer : public zypp::data::ResolvableDataConsumer
-                     , private base::NonCopyable
-{
-  std::string idString( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string ret( kind_r.asString() );
-    ret += ":";
-    ret += res_r->name;
-    ret += "-";
-    ret += res_r->edition.asString();
-    ret += ".";
-    ret += res_r->arch.asString();
-    return ret;
-  }
-
-  data::RecordId                       _lastId;
-  std::map<std::string,data::RecordId> _idMap;
-  std::map<data::RecordId,std::string> _reverseMap;
-
-  bool hasEntry( const std::string & id_r )
-  {
-    return _idMap.find( id_r ) != _idMap.end();
-  }
-
-  data::RecordId newId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string id( idString( res_r, kind_r ) );
-    if ( hasEntry( id ) )
-      ZYPP_THROW(Exception(id));
-    _idMap[id] = ++_lastId;
-    _reverseMap[_lastId] = id;
-    MIL << "NEW_ID " << _lastId << " - " << id << endl;
-    logNew( res_r, kind_r );
-    return _lastId;
-  }
-
-  data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string id( idString( res_r, kind_r ) );
-    if ( ! hasEntry( id ) )
-      ZYPP_THROW(Exception(id));
-    data::RecordId ret = _idMap[id];
-    DBG << ret << " " << id << endl;
-    return ret;
-  }
-
-  std::string lookup( data::RecordId id_r )
-  {
-    if ( id_r == data::noRecordId )
-    {
-      return "";
-    }
-
-    if ( _reverseMap.find( id_r ) != _reverseMap.end() )
-    {
-      return _reverseMap[id_r];
-    }
-
-    WAR << "Lookup id " << id_r << "failed" << endl;
-    return std::string();
-  }
-
-  //
-  void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string shr( lookup( res_r->shareDataWith ) );
-  }
-
-  public:
-
-  virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Package>::kind );
-  }
-
-  virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<SrcPackage>::kind );
-  }
-
-  virtual data::RecordId consumeProduct      ( const data::RecordId & repository_id, const data::Product_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Product>::kind );
-  }
-
-  virtual data::RecordId consumePatch        ( const data::RecordId & repository_id, const data::Patch_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Patch>::kind );
-  }
-
-  virtual data::RecordId consumePackageAtom  ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Atom>::kind );
-  }
-
-  virtual data::RecordId consumeMessage      ( const data::RecordId & repository_id, const data::Message_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Message>::kind );
-  }
-
-  virtual data::RecordId consumeScript       ( const data::RecordId & repository_id, const data::Script_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Script>::kind );
-  }
-
-  virtual data::RecordId consumePattern      ( const data::RecordId & repository_id, const data::Pattern_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Pattern>::kind );
-  }
-
-  virtual data::RecordId consumeChangelog    ( const data::RecordId & repository_id, const Changelog & )
-  { return data::RecordId(); }
-
-  virtual data::RecordId consumeFilelist     ( const data::RecordId & repository_id, const data::Filenames & )
-  { return data::RecordId(); }
-
-  virtual void consumeDiskUsage    ( const data::RecordId & repository_id, const DiskUsage & du )
-  {
-    ERR << lookup( repository_id ) << endl;
-    //WAR << du << endl;
-    return;
-  }
-
-
-  void updatePackageLang( const data::RecordId & resolvable_id,
-                         const data::Packagebase_Ptr & data_r )
-  {
-    return;
-    SEC << lookup( resolvable_id ) << endl;
-    INT << "  " << data_r->summary.text() << endl;
-    INT << "  " << data_r->summary.text( Locale("en") ) << endl;
-    if ( data_r->licenseToConfirm.locales().size() )
-    {
-      INT << "  " << data_r->licenseToConfirm.text() << endl;
-      INT << "  " << data_r->licenseToConfirm.text( Locale("en") ) << endl;
-      INT << "  " << data_r->licenseToConfirm.locales() << endl;
-    }
- }
-};
-
 /******************************************************************
 **
 **      FUNCTION NAME : main
@@ -184,12 +33,6 @@ int main( int argc, char * argv[] )
 {
   INT << "===[START]==========================================" << endl;
 
-  Measure x("Parse");
-  DummyConsumer dummy;
-  RepoParser parser( data::RecordId(), dummy );
-
-  parser.parse( "REPO" );
-
   INT << "===[END]============================================" << endl << endl;
   return 0;
 }
diff --git a/devel/devel.ma/testdrafts/RepoParser.cc b/devel/devel.ma/testdrafts/RepoParser.cc
deleted file mode 100644 (file)
index 4368eb7..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-#include "Tools.h"
-#include "ExplicitMap.h"
-#include <boost/call_traits.hpp>
-
-#include <iostream>
-#include <fstream>
-#include <map>
-
-#include <zypp/base/LogControl.h>
-#include <zypp/base/LogTools.h>
-#include "zypp/base/Exception.h"
-#include "zypp/base/InputStream.h"
-#include "zypp/base/DefaultIntegral.h"
-#include <zypp/base/Function.h>
-#include <zypp/base/Iterator.h>
-
-#include <zypp/Pathname.h>
-#include <zypp/Edition.h>
-#include <zypp/CheckSum.h>
-#include <zypp/Date.h>
-
-#include "zypp/parser/TagParser.h"
-#include "zypp/parser/susetags/PackagesFileReader.h"
-#include "zypp/parser/susetags/PackagesLangFileReader.h"
-#include "zypp/parser/susetags/PatternFileReader.h"
-#include "zypp/parser/susetags/ContentFileReader.h"
-#include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/parser/susetags/RepoParser.h"
-#include "zypp/cache/CacheStore.h"
-
-using namespace std;
-using namespace zypp;
-using namespace zypp::parser;
-using namespace zypp::parser::susetags;
-
-///////////////////////////////////////////////////////////////////
-
-struct DummyConsumer : public zypp::data::ResolvableDataConsumer
-                     , private base::NonCopyable
-{
-  std::string idString( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string ret( kind_r.asString() );
-    ret += ":";
-    ret += res_r->name;
-    ret += "-";
-    ret += res_r->edition.asString();
-    ret += ".";
-    ret += res_r->arch.asString();
-    return ret;
-  }
-
-  data::RecordId                       _lastId;
-  std::map<std::string,data::RecordId> _idMap;
-  std::map<data::RecordId,std::string> _reverseMap;
-
-  bool hasEntry( const std::string & id_r )
-  {
-    return _idMap.find( id_r ) != _idMap.end();
-  }
-
-  data::RecordId newId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string id( idString( res_r, kind_r ) );
-    if ( hasEntry( id ) )
-      ZYPP_THROW(Exception(id));
-    _idMap[id] = ++_lastId;
-    _reverseMap[_lastId] = id;
-    MIL << "NEW_ID " << _lastId << " - " << id << endl;
-    logNew( res_r, kind_r );
-    return _lastId;
-  }
-
-  data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string id( idString( res_r, kind_r ) );
-    if ( ! hasEntry( id ) )
-      ZYPP_THROW(Exception(id));
-    data::RecordId ret = _idMap[id];
-    DBG << ret << " " << id << endl;
-    return ret;
-  }
-
-  std::string lookup( data::RecordId id_r )
-  {
-    if ( id_r == data::noRecordId )
-    {
-      return "";
-    }
-
-    if ( _reverseMap.find( id_r ) != _reverseMap.end() )
-    {
-      return _reverseMap[id_r];
-    }
-
-    WAR << "Lookup id " << id_r << "failed" << endl;
-    return std::string();
-  }
-
-  void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
-  {
-    std::string shr( lookup( res_r->shareDataWith ) );
-    if ( ! shr.empty() )
-    {
-      DBG << "  SHR: " << shr << endl;
-    }
-    //DBG << "  SUM: " << res_r->summary << endl;
-    if ( 0&&kind_r == ResTraits<Package>::kind )
-    {
-      data::Package_Ptr p = dynamic_pointer_cast<data::Package>(res_r);
-      DBG << "  PKG: " << p << endl;
-      DBG << "  LOC: " << p->repositoryLocation << endl;
-    }
-    static unsigned n = 20;
-    if ( 0&&! --n )
-      throw;
-  }
-
-  public:
-
-  virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Package>::kind );
-  }
-
-  virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<SrcPackage>::kind );
-  }
-
-  virtual data::RecordId consumeProduct      ( const data::RecordId & repository_id, const data::Product_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Product>::kind );
-  }
-
-  virtual data::RecordId consumePatch        ( const data::RecordId & repository_id, const data::Patch_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Patch>::kind );
-  }
-
-  virtual data::RecordId consumePackageAtom  ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Atom>::kind );
-  }
-
-  virtual data::RecordId consumeMessage      ( const data::RecordId & repository_id, const data::Message_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Message>::kind );
-  }
-
-  virtual data::RecordId consumeScript       ( const data::RecordId & repository_id, const data::Script_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Script>::kind );
-  }
-
-  virtual data::RecordId consumePattern      ( const data::RecordId & repository_id, const data::Pattern_Ptr & res_r )
-  {
-    return newId( res_r, ResTraits<Pattern>::kind );
-  }
-
-  virtual data::RecordId consumeChangelog    ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & )
-  { return data::RecordId(); }
-
-  virtual data::RecordId consumeFilelist     ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & )
-  { return data::RecordId(); }
-
-  void updatePackageLang( const data::RecordId & resolvable_id,
-                         const data::Packagebase_Ptr & data_r )
-  {
-    SEC << lookup( resolvable_id ) << endl;
-    INT << "  " << data_r->summary.text() << endl;
-    INT << "  " << data_r->summary.text( Locale("en") ) << endl;
-    if ( data_r->licenseToConfirm.locales().size() )
-    {
-      INT << "  " << data_r->licenseToConfirm.text() << endl;
-      INT << "  " << data_r->licenseToConfirm.text( Locale("en") ) << endl;
-      INT << "  " << data_r->licenseToConfirm.locales() << endl;
-    }
- }
-};
-
-/******************************************************************
-**
-**      FUNCTION NAME : main
-**      FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
-  INT << "===[START]==========================================" << endl;
-
-  DummyConsumer dummy;
-  RepoParser parser( data::RecordId(), dummy );
-
-  parser.parse( "REPO" );
-
-  INT << "===[END]============================================" << endl << endl;
-  return 0;
-}
-
index b66aeb6..eb92b7f 100644 (file)
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Wed Aug  6 17:15:48 CEST 2008 ma@suse.de
+
+- Cleanup, mostly by removing, unused parser code and related classes.
+- revision 10765
+
+-------------------------------------------------------------------
 Wed Aug  6 16:23:27 CEST 2008 ma@suse.de
 
 - Don't let exception escape MediaSetAccess dtor (bnc #415017)
index b6fb032..8d0fc60 100644 (file)
@@ -29,7 +29,6 @@ ADD_TESTS(
   RepoStatus
   ResKind
   Target
-  TranslatedText
   Url
   Vendor
   Vendor2
diff --git a/tests/zypp/TranslatedText_test.cc b/tests/zypp/TranslatedText_test.cc
deleted file mode 100644 (file)
index 495ed10..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <iostream>
-#include <list>
-#include <string>
-
-#include "zypp/base/Logger.h"
-#include "zypp/TranslatedText.h"
-#include "zypp/ZConfig.h"
-
-#include <boost/test/auto_unit_test.hpp>
-
-using boost::unit_test::test_suite;
-using boost::unit_test::test_case;
-
-using namespace std;
-using namespace zypp;
-
-BOOST_AUTO_TEST_CASE(translatedtext_test)
-{
-  TranslatedText testTT;
-  MIL << "Locale: en" << std::endl;
-  ZConfig::instance().setTextLocale(Locale("en"));
-  testTT.setText("default");
-  MIL << "value: '" << testTT.text() << "'" << std::endl;
-  BOOST_CHECK_EQUAL( testTT.text(), "default" );
-
-  testTT.setText("default english", Locale("en"));
-  BOOST_CHECK_EQUAL( testTT.text(), "default english" );
-
-  MIL << "Locale: es_ES" << std::endl;
-  ZConfig::instance().setTextLocale(Locale("es_ES"));
-
-  BOOST_CHECK_EQUAL( testTT.text(), "default english" );
-
-  testTT.setText("hola esto es neutro", Locale("es"));
-  testTT.setText("this is neutral", Locale("en"));
-
-  BOOST_CHECK_EQUAL( testTT.text(), "hola esto es neutro" );
-
-  testTT.setText("hola Spain", Locale("es_ES"));
-  BOOST_CHECK_EQUAL( testTT.text(), "hola Spain" );
-
-  MIL << "Locale: null" << std::endl;
-  ZConfig::instance().setTextLocale(Locale());
-  BOOST_CHECK_EQUAL( testTT.text(), "default" );
-}
-
index 32ca3d9..a0bfd6c 100644 (file)
@@ -65,7 +65,6 @@ SET( zypp_SRCS
   SysContent.cc
   Target.cc
   TmpPath.cc
-  TranslatedText.cc
   UpgradeStatistics.cc
   Url.cc
   VendorAttr.cc
@@ -158,7 +157,6 @@ SET( zypp_HEADERS
   SysContent.h
   Target.h
   TmpPath.h
-  TranslatedText.h
   TriBool.h
   UpgradeStatistics.h
   Url.h
@@ -243,23 +241,6 @@ INSTALL(  FILES
   DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/base
 )
 
-SET( zypp_data_SRCS
-  data/ResolvableData.cc
-  data/RecordId.cc
-  data/ResolvableDataConsumer.cc
-)
-
-SET( zypp_data_HEADERS
-  data/ResolvableData.h
-  data/RecordId.h
-  data/ResolvableDataConsumer.h
-)
-
-INSTALL(  FILES
-  ${zypp_data_HEADERS}
-  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/data
-)
-
 SET( zypp_media_SRCS
   media/MediaException.cc
   media/MediaAccess.cc
@@ -321,27 +302,19 @@ INSTALL(  FILES
 
 SET( zypp_parser_SRCS
   parser/ParseException.cc
-  parser/TagParser.cc
   parser/IniParser.cc
   parser/IniDict.cc
-  parser/LibXMLHelper.cc
-  parser/XMLNodeIterator.cc
   parser/RepoFileReader.cc
   parser/RepoindexFileReader.cc
   parser/ProductConfReader.cc
   parser/ServiceFileReader.cc
-  parser/xml_escape_parser.cpp
 )
 
 SET( zypp_parser_HEADERS
   parser/ParseException.h
-  parser/TagParser.h
   parser/IniParser.h
   parser/IniDict.h
-  parser/LibXMLHelper.h
   parser/ParserProgress.h
-  parser/XMLNodeIterator.h
-  parser/xml_parser_assert.h
   parser/RepoFileReader.h
   parser/ProductConfReader.h
   parser/xml_escape_parser.hpp
@@ -390,6 +363,7 @@ SET( zypp_parser_xml_SRCS
   parser/xml/Reader.cc
   parser/xml/XmlString.cc
   parser/xml/libxmlfwd.cc
+  parser/xml/xml_escape_parser.cpp
 )
 
 SET( zypp_parser_xml_HEADERS
@@ -399,8 +373,10 @@ SET( zypp_parser_xml_HEADERS
   parser/xml/ParseDefException.h
   parser/xml/ParseDefTraits.h
   parser/xml/Reader.h
+  parser/xml/XmlEscape.h
   parser/xml/XmlString.h
   parser/xml/libxmlfwd.h
+  parser/xml/xml_escape_parser.hpp
 )
 
 INSTALL(  FILES
@@ -767,7 +743,6 @@ ${zypp_parser_yum_SRCS}
 ${zypp_parser_plaindir_SRCS}
 ${zypp_parser_ws_SRCS}
 ${zypp_parser_SRCS}
-${zypp_data_SRCS}
 ${zypp_media_proxyinfo_SRCS}
 ${zypp_media_SRCS}
 ${zypp_url_SRCS}
@@ -800,7 +775,6 @@ ${zypp_parser_plaindir_HEADERS}
 ${zypp_parser_xml_HEADERS}
 ${zypp_parser_ws_HEADERS}
 ${zypp_parser_HEADERS}
-${zypp_data_HEADERS}
 ${zypp_ui_HEADERS}
 ${zypp_media_HEADERS}
 ${zypp_target_hal_HEADERS}
@@ -841,7 +815,6 @@ SET_LOGGROUP( "satsolver" ${zypp_sat_SRCS} )
 #SET_LOGGROUP( "group" ${zypp_parser_yum2_SRCS} )
 #SET_LOGGROUP( "group" ${zypp_capability_SRCS} )
 #SET_LOGGROUP( "group" ${zypp_ui_SRCS} )
-#SET_LOGGROUP( "group" ${zypp_data_SRCS} )
 #SET_LOGGROUP( "group" ${zypp_media_SRCS} )
 #SET_LOGGROUP( "group" ${zypp_target_hal_SRCS} )
 #SET_LOGGROUP( "group" ${zypp_parser_xml_SRCS} )
index dc32b45..c179335 100644 (file)
@@ -1345,7 +1345,7 @@ namespace zypp
         bind(&Impl::ServiceCollector::collect,collector,_1) );
 
     // only one service definition in the file
-    if ( tmpSet.size() == 1 ) 
+    if ( tmpSet.size() == 1 )
     {
       if ( filesystem::unlink(location) != 0 )
       {
@@ -1447,7 +1447,7 @@ namespace zypp
   void RepoManager::refreshService( const ServiceInfo & service )
   {
     //! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed)
-    
+
     // download the repo index file
     media::MediaManager mediamanager;
     //if (service.url().empty())
@@ -1549,7 +1549,7 @@ namespace zypp
     _pimpl->services.insert(service);
 
     // changed name, must change also repositories
-    if( oldAlias != service.alias() ) 
+    if( oldAlias != service.alias() )
     {
       std::vector<RepoInfo> toModify;
       getRepositoriesInService(oldAlias,
@@ -1564,7 +1564,7 @@ namespace zypp
     //! \todo changed enabled status
     if ( oldService.enabled() != service.enabled())
     {
-      
+
     }
 
     //! \todo refresh the service automatically if url is changed?
diff --git a/zypp/TranslatedText.cc b/zypp/TranslatedText.cc
deleted file mode 100644 (file)
index a8b44bb..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file        zypp/TranslatedText.cc
- *
-*/
-#include <iostream>
-
-#include "zypp/base/String.h"
-
-#include "zypp/TranslatedText.h"
-#include "zypp/ZConfig.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //        CLASS NAME : TranslatedText::Impl
-  //
-  /** TranslatedText implementation. */
-  struct TranslatedText::Impl
-  {
-    typedef std::map<Locale, std::string> TranslationMap;
-
-    Impl()
-    {}
-
-    Impl(const std::string &text, const Locale &lang)
-    { setText(text, lang); }
-
-    Impl(const std::list<std::string> &text, const Locale &lang)
-    { setText(text, lang); }
-
-    bool empty() const
-    {
-      return translations.empty();
-    }
-
-    std::string text( const Locale &lang ) const
-    {
-      // Traverse fallback list and return the 1st nonempty match.
-      // Take care NOT to create new map entries in queries.
-      Locale toReturn( lang );
-      if ( lang == Locale::noCode )
-      {
-        toReturn = ZConfig::instance().textLocale();
-      }
-
-      do
-      {
-        TranslationMap::const_iterator it = translations.find( toReturn );
-        if ( it != translations.end()
-             && ! it->second.empty() )
-        {
-          return it->second;
-        }
-
-       if ( toReturn != Locale::noCode )
-       {
-         // retry using next fallback:
-         toReturn = toReturn.fallback();
-       }
-       else
-       {
-         // there are no further fallbacks
-         return std::string();
-       }
-      } while( true );
-      // not reached.
-      return std::string();
-    }
-
-    std::set<Locale> locales() const
-    {
-      std::set<Locale> lcls;
-      for( TranslationMap::const_iterator it = translations.begin(); it != translations.end(); ++it )
-      {
-        lcls.insert((*it).first);
-      }
-      return lcls;
-    }
-
-    void setText( const std::string &text, const Locale &lang)
-    { translations[lang] = text; }
-
-    void setText( const std::list<std::string> &text, const Locale &lang)
-    { translations[lang] = str::join( text, "\n" ); }
-
-    /** \todo Do it by accessing the global ZYpp. */
-    Locale detectLanguage() const
-    {
-      return Locale();
-    }
-
-  private:
-    mutable TranslationMap translations;
-
-  public:
-    /** Offer default Impl. */
-    static shared_ptr<Impl> nullimpl()
-    {
-      static shared_ptr<Impl> _nullimpl( new Impl );
-      return _nullimpl;
-    }
-
-  private:
-    friend Impl * rwcowClone<Impl>( const Impl * rhs );
-    /** clone for RWCOW_pointer */
-    Impl * clone() const
-    { return new Impl( *this ); }
-  };
-  ///////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //        CLASS NAME : TranslatedText
-  //
-  ///////////////////////////////////////////////////////////////////
-
-  const TranslatedText TranslatedText::notext;
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //        METHOD NAME : TranslatedText::TranslatedText
-  //        METHOD TYPE : Ctor
-  //
-  TranslatedText::TranslatedText()
-  : _pimpl( Impl::nullimpl() )
-  {}
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //        METHOD NAME : TranslatedText::TranslatedText
-  //        METHOD TYPE : Ctor
-  //
-  TranslatedText::TranslatedText( const std::string &text,
-                                  const Locale &lang )
-  : _pimpl( new Impl(text, lang) )
-  {}
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //        METHOD NAME : TranslatedText::TranslatedText
-  //        METHOD TYPE : Ctor
-  //
-  TranslatedText::TranslatedText( const std::list<std::string> &text,
-                                  const Locale &lang )
-  : _pimpl( new Impl(text, lang) )
-  {}
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //        METHOD NAME : TranslatedText::~TranslatedText
-  //        METHOD TYPE : Dtor
-  //
-  TranslatedText::~TranslatedText()
-  {}
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  // Forward to implementation:
-  //
-  ///////////////////////////////////////////////////////////////////
-
-  std::string TranslatedText::text( const Locale &lang ) const
-  { return _pimpl->text( lang ); }
-
-  void TranslatedText::setText( const std::string &text, const Locale &lang )
-  { _pimpl->setText( text, lang ); }
-
-  std::set<Locale> TranslatedText::locales() const
-  {
-    return _pimpl->locales();
-  }
-
-  void TranslatedText::setText( const std::list<std::string> &text, const Locale &lang )
-  { _pimpl->setText( text, lang ); }
-
-  Locale TranslatedText::detectLanguage() const
-  { return _pimpl->detectLanguage(); }
-
-  bool TranslatedText::empty() const
-  { return _pimpl->empty(); }
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
diff --git a/zypp/TranslatedText.h b/zypp/TranslatedText.h
deleted file mode 100644 (file)
index 39646cd..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file      zypp/TranslatedText.h
- *
-*/
-#ifndef ZYPP_TRANSLATEDTEXT_H
-#define ZYPP_TRANSLATEDTEXT_H
-
-#include <iosfwd>
-#include <map>
-#include <list>
-#include <set>
-#include <string>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/Locale.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   CLASS NAME : TranslatedText
-  //
-  /** Class that represent a text and multiple translations.
-  */
-  class TranslatedText
-  {
-    friend std::ostream & operator<<( std::ostream & str, const TranslatedText & obj );
-
-  public:
-    /** Implementation  */
-    class Impl;
-
-  public:
-    /** Default ctor */
-    TranslatedText();
-    /** Ctor */
-    explicit
-    TranslatedText(const std::string &text, const Locale &lang = Locale());
-    /** Ctor. */
-    explicit
-    TranslatedText(const std::list<std::string> &text, const Locale &lang = Locale());
-    /** Dtor */
-    ~TranslatedText();
-
-    /** true if the text have no translations for any language */
-    bool empty() const ;
-    
-    /** static default empty translated text  */
-    static const TranslatedText notext;
-
-  public:
-
-    /** Synonym for \ref text */
-    std::string asString( const Locale &lang = Locale() ) const
-    { return text(lang); }
-
-    std::string text( const Locale &lang = Locale() ) const;
-    std::set<Locale> locales() const;
-
-    /** String representation. */
-    const char * c_str( const Locale &lang = Locale() ) const
-    { return text(lang).c_str(); }
-
-    void setText( const std::string &text, const Locale &lang = Locale());
-    void setText( const std::list<std::string> &text, const Locale &lang = Locale());
-
-    Locale detectLanguage() const;
-
-  private:
-    /** Pointer to implementation */
-    RWCOW_pointer<Impl> _pimpl;
-  };
-  ///////////////////////////////////////////////////////////////////
-
-  /** \relates TranslatedText Stream output */
-  inline std::ostream & operator<<( std::ostream & str, const TranslatedText & obj )
-  { return str << obj.asString(); }
-
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_TRANSLATEDTEXT_H
diff --git a/zypp/data/RecordId.cc b/zypp/data/RecordId.cc
deleted file mode 100644 (file)
index b986146..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-//#include "zypp/data/RecordId.h"
-
-
diff --git a/zypp/data/RecordId.h b/zypp/data/RecordId.h
deleted file mode 100644 (file)
index 0fee5b3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/data/RecordId.h
- *
-*/
-#ifndef ZYPP_DATA_RECORDID_H
-#define ZYPP_DATA_RECORDID_H
-
-#include "zypp/base/DefaultIntegral.h"
-
-namespace zypp
-{
-  namespace data
-  {
-    /** Cache store record id. */
-    typedef DefaultIntegral<long long, -1> RecordId;
-    /** The default RecordId is a value we don't use for records. */
-    static const RecordId noRecordId;
-  }
-}
-
-#endif
diff --git a/zypp/data/ResolvableData.cc b/zypp/data/ResolvableData.cc
deleted file mode 100644 (file)
index 22ba142..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-
-#include "zypp/data/ResolvableData.h"
-
-using namespace std;
-
-namespace zypp
-{
-#warning figure out all the obsolete stuff here
-namespace data
-{
-
-IMPL_PTR_TYPE(Resolvable);
-IMPL_PTR_TYPE(ResObject);
-IMPL_PTR_TYPE(Patch);
-IMPL_PTR_TYPE(Pattern);
-IMPL_PTR_TYPE(Product);
-IMPL_PTR_TYPE(Packagebase);
-IMPL_PTR_TYPE(Package);
-IMPL_PTR_TYPE(SrcPackage);
-
-IMPL_PTR_TYPE(DeltaRpm);
-IMPL_PTR_TYPE(BaseVersion);
-
-
-std::ostream & ResObject::dumpOn( std::ostream & str ) const
-{
-  str << "[ " << name << " " << edition << " " << arch << " ]";
-  return str;
-//       << "  provides: " << provides << endl
-//       << "  conflicts: " << conflicts << endl
-//       << "  obsoletes: " << obsoletes << endl
-//       << "  requires: " << requires << endl
-//       << "  recommends:" << endl << recommends << endl
-//       << "  suggests:" << endl << suggests << endl
-//       << "  supplements:" << endl << supplements << endl
-//       << "  enhances:" << endl << enhances << endl
-}
-
-
-std::ostream & RpmBase::dumpOn( std::ostream & str ) const
-{
-  str << "Patch/Delta[ " << name << " " << edition << " " << arch << " ]";
-  return str;
-}
-
-} // namespace cache
-} // namespace zypp
diff --git a/zypp/data/ResolvableData.h b/zypp/data/ResolvableData.h
deleted file mode 100644 (file)
index 0c3b957..0000000
+++ /dev/null
@@ -1,348 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/data/ResolvableData.h
- *
-*/
-#ifndef ZYPP_DATA_RESOLVABLEDATA_H
-#define ZYPP_DATA_RESOLVABLEDATA_H
-
-#include <iosfwd>
-#include <list>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/data/RecordId.h"
-#include "zypp/Pathname.h"
-#include "zypp/Resolvable.h"
-#include "zypp/Edition.h"
-#include "zypp/ByteCount.h"
-#include "zypp/Arch.h"
-#include "zypp/CheckSum.h"
-#include "zypp/Changelog.h"
-#include "zypp/Url.h"
-#include "zypp/Date.h"
-#include "zypp/TranslatedText.h"
-#include "zypp/OnMediaLocation.h"
-#include "zypp/DiskUsage.h"
-
-namespace zypp
-{
-namespace data
-{
-  typedef CapabilitySet                             DependencyList;
-  typedef std::map<zypp::Dep, DependencyList>       Dependencies;
-
-  typedef DefaultIntegral<unsigned,0u>              MediaNr;
-
-  /** List of files contained in a package (info for UI) */
-  typedef std::list<std::string>                    Filenames;
-
-  ///////////////////////////////////////////////////////////////////
-
-  DEFINE_PTR_TYPE(Resolvable);
-
-  /** Mandatory resolvable data. */
-  class Resolvable : public base::ReferenceCounted, private base::NonCopyable
-  {
-    public:
-      Resolvable()
-      {};
-
-      /** Kind */
-      ResKind     kind;
-      /** Name */
-      std::string name;
-      /** Edition */
-      Edition     edition;
-      /** Architecture */
-      Arch        arch;
-      /** Dependencies */
-      Dependencies deps;
-  };
-
-  ///////////////////////////////////////////////////////////////////
-
-  DEFINE_PTR_TYPE(ResObject);
-
-  /** Common resolvable data. */
-  class ResObject : public Resolvable
-  {
-    public:
-      ResObject()
-      {}
-
-      /** Raw data to determine \ref shareDataWith */
-      std::string sharedDataTag;
-      /** Share some data with another resolvable.*/
-      RecordId shareDataWith;
-
-      // Common attributes:
-      /** Vendor */
-      std::string vendor;
-      /** Installed size (UI hint). */
-      ByteCount installedSize;
-      /** Bildtime. */
-      Date buildTime;
-
-      // Flags:
-      /** 'rpm -i' mode. */
-      DefaultIntegral<bool,false> installOnly;
-
-      // Translated texts:
-      /** One line summary. */
-      TranslatedText summary;
-      /** Multiline description. */
-      TranslatedText description;
-      /** License to confirm. */
-      TranslatedText licenseToConfirm;
-      /** UI notification text if selected to install. */
-      TranslatedText insnotify;
-      /** UI notification text if selected to delete. */
-      TranslatedText delnotify;
-
-      // Repository related:
-      /** Repository providing this resolvable. */
-      RecordId  repository;
-    protected:
-      /** Overload to realize std::ostream & operator\<\<. */
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-  };
-
-  ///////////////////////////////////////////////////////////////////
-
-  DEFINE_PTR_TYPE(Patch);
-
-  /* Data Object for Patch resolvable. */
-  class Patch : public ResObject
-  {
-    public:
-      Patch()
-      {};
-
-      /** Patch ID */
-      std::string id;
-      /** Patch time stamp */
-      Date timestamp;
-      /** Patch category (recommended, security,...) */
-      std::string category;
-
-      // Flags:
-      /** Does the system need to reboot to finish the update process? */
-      DefaultIntegral<bool,false> rebootNeeded;
-      /** Does the patch affect the package manager itself? */
-      DefaultIntegral<bool,false> affectsPkgManager;
-
-      /** TODO Don't know what this is, but it's defined in patch.rnc */
-      std::string updateScript;
-
-      /**
-       * The set of all atoms building the patch. These can be either
-       * \ref PackageAtom, \ref Message or \ref Script.
-       */
-      std::set<ResObject_Ptr> atoms;
-  };
-
-  ///////////////////////////////////////////////////////////////////
-
-  DEFINE_PTR_TYPE(Pattern);
-
-  /* Data Object for Pattern resolvable. */
-  class Pattern : public ResObject
-  {
-    public:
-      Pattern()
-      {}
-
-      // Flags
-      /** Should the pattern be installed by default? */
-      DefaultIntegral<bool,false> isDefault;
-      /** Visible or hidden at the UI. */
-      DefaultIntegral<bool,false> userVisible;
-
-      /** Category */
-      TranslatedText category;
-
-      /** Icon path relative to repository URL. */
-      std::string icon;
-      /** UI order string */
-      std::string order;
-      /** ? */
-      std::string script;
-
-      /** Included patterns. */
-      DependencyList includes;
-      /** Extended patterns. */
-      DependencyList extends;
-  };
-
-  ///////////////////////////////////////////////////////////////////
-
-  DEFINE_PTR_TYPE(Product);
-
-  /* Data Object for Product resolvable. */
-  class Product : public ResObject
-  {
-    public:
-      Product()
-      {};
-
-      /** The product type (base, add-on) */
-      std::string type;
-
-      /** Abbreviation like \c SLES10 */
-      TranslatedText shortName;
-      /** More verbose Name like <tt>Suse Linux Enterprise Server 10</tt>*/
-      TranslatedText longName;
-
-      /** The product flags.
-       * \todo What is it?
-      */
-      std::list<std::string> flags;
-
-      /** Releasenotes url. */
-      Url releasenotesUrl;
-      /** Update repositories for the product. */
-      std::list<Url> updateUrls;
-      /** Additional software for the product.  */
-      std::list<Url> extraUrls;
-      /** Optional software for the product. */
-      std::list<Url> optionalUrls;
-
-      /** Vendor specific distribution id. */
-      std::string distributionName;
-      /** Vendor specific distribution version. */
-      Edition distributionEdition;
-  };
-
-  ///////////////////////////////////////////////////////////////////
-
-  DEFINE_PTR_TYPE(Packagebase);
-
-  /**
-   * Common Data Object for Package and Sourcepackage.
-   *
-   * We treat them as differend kind of Resolvable, but they have
-   * almost identical data.
-   */
-  class Packagebase : public ResObject
-  {
-    public:
-      enum PackageType { BIN, SRC, ATOM };
-      virtual PackageType packageType() const = 0;
-
-    public:
-      /** Rpm group.*/
-      std::string group;
-      /** PackageDb keywors (tags). */
-      std::set<std::string> keywords;
-
-      /** Changelog. */
-      Changelog changelog;
-      /** Author list. */
-      std::list<std::string> authors;
-
-
-      /** Buildhost. */
-      std::string buildhost;
-      /** Distribution. */
-      std::string distribution;
-      /** Licensetype. Not the text you have to confirm. */
-      std::string license;
-      /** Packager. */
-      std::string packager;
-      /** Upstream home page URL.*/
-      std::string url;
-
-      /** operating system **/
-      std::string operatingSystem;
-
-      /** Pre install script. */
-      std::string prein;
-      /** Post install script. */
-      std::string postin;
-      /** Pre uninstall script. */
-      std::string preun;
-      /** Post uninstall script. */
-      std::string postun;
-
-      OnMediaLocation repositoryLocation;
-      DiskUsage       diskusage;
-  };
-
-  DEFINE_PTR_TYPE(Package);
-  /**
-   * Data Object for Package resolvable
-   */
-  struct Package : public Packagebase
-  {
-    virtual PackageType packageType() const { return BIN; }
-  };
-
-  DEFINE_PTR_TYPE(SrcPackage);
-  /**
-   * Data Object for SrcPackage resolvable
-   */
-  struct SrcPackage : public Packagebase
-  {
-    virtual PackageType packageType() const { return SRC; }
-  };
-
-  // --- ---------------------------------------------------------------------
-  // --- the following are the data structures for storing YUM package atom
-  // --- metadata (part of patch support). This is probably subject to change
-  // --- in near future.
-  // --- ---------------------------------------------------------------------
-
-  DEFINE_PTR_TYPE(BaseVersion);
-  /** Patch RPM baseversion */
-  struct BaseVersion : public base::ReferenceCounted, private base::NonCopyable
-  {
-    Edition     edition;
-  };
-
-  /** Shared RPM attributes */
-  struct RpmBase : public base::ReferenceCounted, private base::NonCopyable
-  {
-    // Base <patchrpm>/<deltarpm> element attributes
-
-    std::string     name;     // target rpm name
-    Edition         edition;  // target rpm edition
-    Arch            arch;     // target rpm architecture
-    OnMediaLocation location;
-    Date            buildTime;
-    Date            fileTime;
-    ByteCount       archiveSize; // ??
-    protected:
-      /** Overload to realize std::ostream & operator\<\<. */
-      virtual std::ostream & dumpOn( std::ostream & str ) const;
-  };
-
-  DEFINE_PTR_TYPE(DeltaRpm);
-  /** Delta RPM data object */
-  struct DeltaRpm : RpmBase
-  {
-    struct DeltaBaseVersion : BaseVersion
-    {
-      Date        buildTime;
-      CheckSum    checkSum;
-      std::string sequenceInfo;
-    };
-
-    DeltaBaseVersion baseVersion;
-  };
-
-  // --- ----------END--YUM-package-atom-metadata-----------------------------
-
-  ///////////////////////////////////////////////////////////////////
-
-} // namespace data
-} // namespace zypp
-#endif // ZYPP_DATA_RESOLVABLEDATA_H
diff --git a/zypp/data/ResolvableDataConsumer.cc b/zypp/data/ResolvableDataConsumer.cc
deleted file mode 100644 (file)
index 89b2311..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-
-#include "zypp/data/ResolvableDataConsumer.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-namespace data
-{ /////////////////////////////////////////////////////////////////
-
-    ResolvableDataConsumer::ResolvableDataConsumer()
-    {}
-    
-    ResolvableDataConsumer::~ResolvableDataConsumer()
-    {}
-
-} // namespace parser
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
diff --git a/zypp/data/ResolvableDataConsumer.h b/zypp/data/ResolvableDataConsumer.h
deleted file mode 100644 (file)
index 70427d0..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-
-#ifndef ZYPP_ResolvableDataConsumer_H
-#define ZYPP_ResolvableDataConsumer_H
-
-
-#include "zypp/DiskUsage.h"
-#include "zypp/data/RecordId.h"
-#include "zypp/data/ResolvableData.h"
-
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-namespace data
-{ /////////////////////////////////////////////////////////////////
-
-  class ResolvableDataConsumer
-  {
-    public:
-
-    ResolvableDataConsumer();
-    virtual ~ResolvableDataConsumer();
-
-    virtual data::RecordId consumePackage      ( const data::Package_Ptr & ) = 0;
-    virtual data::RecordId consumeSourcePackage( const data::SrcPackage_Ptr & ) = 0;
-    virtual data::RecordId consumeProduct      ( const data::Product_Ptr & ) = 0;
-    virtual data::RecordId consumePatch        ( const data::Patch_Ptr & ) = 0;
-    virtual data::RecordId consumePattern      ( const data::Pattern_Ptr & ) = 0;
-
-    virtual data::RecordId consumeChangelog    ( const data::RecordId & resolvable_id, const Changelog & ) = 0;
-    virtual data::RecordId consumeFilelist     ( const data::RecordId & resolvable_id, const data::Filenames & ) = 0;
-    virtual void consumeDiskUsage              ( const data::RecordId &resolvable_id, const DiskUsage &disk ) = 0;
-
-    virtual void updatePackageLang( const data::RecordId & resolvable_id, const data::Packagebase_Ptr & data_r ) = 0;
-
-  };
-
-} // namespace parser
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_ResolvableDataConsumer_H
diff --git a/zypp/parser/LibXMLHelper.cc b/zypp/parser/LibXMLHelper.cc
deleted file mode 100644 (file)
index 085e83e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/LibXMLHelper.cc
- *
-*/
-#include <zypp/parser/LibXMLHelper.h>
-#include <libxml/tree.h>
-#include <libxml/xmlstring.h>
-#include "zypp/parser/xml_parser_assert.h"
-#include <sstream>
-
-namespace zypp {
-
-  namespace parser {
-
-    using namespace std;
-
-    LibXMLHelper::LibXMLHelper()
-    { }
-
-    LibXMLHelper::~LibXMLHelper()
-    { }
-
-    std::string LibXMLHelper::attribute(xmlNode * nodePtr,
-                                        const std::string &name,
-                                        const std::string &defaultValue) const
-    {
-      xml_assert(nodePtr);
-      xmlChar *xmlRes = xmlGetProp(nodePtr, BAD_CAST(name.c_str()));
-      if (xmlRes == 0)
-        return defaultValue;
-      else {
-        string res((const char *)xmlRes);
-        xmlFree(xmlRes);
-        return res;
-      }
-    }
-
-
-    std::string LibXMLHelper::content(xmlNode * nodePtr) const
-    {
-      xml_assert(nodePtr);
-      xmlChar *xmlRes = xmlNodeGetContent(nodePtr);
-      if (xmlRes == 0)
-        return string();
-      else {
-        string res((const char*) xmlRes);
-        xmlFree(xmlRes);
-        return res;
-      }
-    }
-
-    std::string LibXMLHelper::name(const xmlNode * nodePtr) const
-    {
-      xml_assert(nodePtr);
-      return string((const char*) nodePtr->name);
-    }
-
-
-    bool LibXMLHelper::isElement(const xmlNode * nodePtr) const
-    {
-      return nodePtr->type == XML_ELEMENT_NODE;
-    }
-
-    std::string LibXMLHelper::positionInfo(const xmlNode * nodePtr) const
-    {
-      stringstream strm;
-      strm << nodePtr->line;
-      return string("at line ") + strm.str();
-    }
-  }
-}
diff --git a/zypp/parser/LibXMLHelper.h b/zypp/parser/LibXMLHelper.h
deleted file mode 100644 (file)
index 524c25b..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/LibXMLHelper.h
- *
-*/
-#ifndef LibXMLHelper_h
-#define LibXMLHelper_h
-#include <string>
-
-extern "C" {
-  struct _xmlNode;
-  typedef _xmlNode xmlNode;
-}
-
- namespace zypp {
-
-  namespace parser {
-
-    /**
-     * @short Easy access to xmlNodes for C++
-     */
-    
-    class LibXMLHelper {
-    public:
-      /**
-       * The default constructor will return an object that does not
-       * look into the namespace properties of the nodes. Later, another
-       * constructor will be added that takes a list of namespaces as parameters
-       * (and maybe also character encoding information), and all nodes of different
-       * namespaces will be ignored (i.e., attributes will not be used, and for elements
-       * in different namespaces isElement() will return false).
-       */
-      LibXMLHelper();
-    
-      /**
-       * Destructor
-       */
-      virtual ~LibXMLHelper();
-    
-      /**
-       * Fetch an attribute
-       * @param node the xmlNode
-       * @param name name of the attribute
-       * @param defaultValue the value to return if this attribute does not exist
-       * @return the value of the attribute
-       */
-      std::string attribute(xmlNode * node, 
-                            const std::string &name, 
-                            const std::string &defaultValue = std::string()) const;
-    
-      /**
-       * @short The TEXT content of the node and all child nodes
-       * Read the value of a node, this can be either the text carried directly by this node if
-       * it's a TEXT node or the aggregate string of the values carried by this node child's
-       * (TEXT and ENTITY_REF). Entity references are substituted.
-       * @param nodePtr the xmlNode
-       * @return the content
-       */
-      std::string content(xmlNode * nodePtr) const;
-    
-      /**
-       * The name of the node
-       * @param nodePtr the xmlNode
-       * @return the name
-       */
-      std::string name(const xmlNode * nodePtr) const;
-    
-      /**
-       * returns whether this is an element node (and not, e.g., a attribute or namespace node)
-       * @param nodePtr the xmlNode
-       * @return true if it is an element node
-       */
-      bool isElement(const xmlNode * nodePtr) const;
-    
-      /**
-       * returns a string that identifies the position of an element nodes
-       * e.g. for error messages
-       * @param nodePtr the xmlNode
-       * @return the position information
-       */
-      std::string positionInfo(const xmlNode * nodePtr) const;
-    };
-  }
-}
-
-#endif
diff --git a/zypp/parser/TagParser.cc b/zypp/parser/TagParser.cc
deleted file mode 100644 (file)
index 4019160..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file      zypp/parser/TagParser.cc
- *
-*/
-#include <iostream>
-#include <sstream>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/String.h"
-#include "zypp/base/IOStream.h"
-#include "zypp/base/UserRequestException.h"
-#include "zypp/parser/ParseException.h"
-
-#include "zypp/parser/TagParser.h"
-#include "zypp/ProgressData.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace parser
-  { /////////////////////////////////////////////////////////////////
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // CLASS NAME : TagParser::Tag
-    //
-    ///////////////////////////////////////////////////////////////////
-
-    std::string TagParser::Tag::asString() const
-    {
-      std::string ret( name );
-      if ( ! modifier.empty() )
-       ret += modifier;
-      return ret += ":";
-    }
-
-    std::ostream & operator<<( std::ostream & str, const TagParser::Tag & obj )
-    {
-      str << "@" << obj.lineNo << "{" << obj.name;
-      if ( ! obj.modifier.empty() )
-       str << '.' << obj.modifier;
-      return str << ":}(" << obj.dataStart << "|" << obj.dataLength << ")";
-    }
-
-    std::ostream & operator<<( std::ostream & str, const TagParser::SingleTag & obj )
-    {
-      str << "=" << static_cast<const TagParser::Tag &>( obj );
-      return str << "\"" << obj.value << "\"";
-    }
-
-    std::ostream & operator<<( std::ostream & str, const TagParser::MultiTag & obj )
-    {
-      str << "+" << static_cast<const TagParser::Tag &>( obj );
-      return str << "[" << obj.value.size() << "]";
-    }
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // CLASS NAME : TagParser
-    //
-    ///////////////////////////////////////////////////////////////////
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : TagParser::TagParser
-    // METHOD TYPE : Ctor
-    //
-    TagParser::TagParser()
-    {}
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : TagParser::~TagParser
-    // METHOD TYPE : Dtor
-    //
-    TagParser::~TagParser()
-    {}
-
-    void TagParser::beginParse()
-    {}
-    void TagParser::consume( const SingleTagPtr & tag_r )
-    {}
-    void TagParser::consume( const MultiTagPtr & tag_r )
-    {}
-    void TagParser::endParse()
-    {}
-
-    void TagParser::userRequestedAbort( unsigned lineNo_r )
-    { ZYPP_THROW( AbortRequestException( errPrefix( lineNo_r ) ) ); }
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : TagParser::errPrefix
-    // METHOD TYPE : std::string
-    //
-    std::string TagParser::errPrefix( unsigned lineNo_r,
-                                     const std::string & msg_r ) const
-    {
-      return str::form( "%s:%u:- | %s",
-                       _inputname.c_str(),
-                       lineNo_r,
-                       msg_r.c_str() );
-    }
-
-    std::string TagParser::errPrefix( const SingleTagPtr & tag_r,
-                                     const std::string & msg_r ) const
-    {
-      return str::form( "%s:%u:=%s %s | %s",
-                       _inputname.c_str(),
-                       tag_r->lineNo,
-                       tag_r->asString().c_str(),
-                       tag_r->value.c_str(),
-                       msg_r.c_str() );
-    }
-
-    std::string TagParser::errPrefix( const MultiTagPtr & tag_r,
-                                     const std::string & msg_r ) const
-    {
-      return str::form( "%s:%u:+%s (@%zd) | %s",
-                       _inputname.c_str(),
-                       tag_r->lineNo,
-                       tag_r->asString().c_str(),
-                       tag_r->value.size(),
-                       msg_r.c_str() );
-    }
-
-    ///////////////////////////////////////////////////////////////////
-    namespace
-    { /////////////////////////////////////////////////////////////////
-
-      /** Parse a tag <tt>NAME[.EXT]:</tt>from \a begin_r.
-       * If a tag was found, update \a tag_r and advance
-       * \a begin_r to point behind the \c :.
-       */
-      inline bool helperParseStartTag( TagParser::Tag & tag_r, const char *& begin_r )
-      {
-       const char * tsep = 0;  // find ':'
-       const char * esep = 0;  // remember last '.'
-       for ( const char * ch = begin_r; *ch; ++ch )
-       {
-         switch ( *ch )
-         {
-           case '.':
-             esep = ch; // remember
-             break;
-           case ':':
-             tsep = ch;
-             ch = 0;    // done: found ':'
-             break;
-           case ' ':
-           case '\t':
-           case '\n':
-           case '\r':
-             ch = 0; // fail: no whitespace allowed in tag
-             break;
-         }
-         if ( ! ch )
-           break;
-       }
-
-       if ( ! tsep )
-         return false; // no tag found
-
-       // Update name and modifier
-       if ( esep )
-       {
-         std::string( begin_r, esep-begin_r ).swap( tag_r.name );
-         ++esep;
-         std::string( esep, tsep-esep ).swap( tag_r.modifier );
-       }
-       else
-       {
-         std::string( begin_r, tsep-begin_r ).swap( tag_r.name );
-       }
-
-       begin_r = tsep+1; // behind ':'
-       return true;
-      }
-
-      /////////////////////////////////////////////////////////////////
-    } // namespace
-    ///////////////////////////////////////////////////////////////////
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : TagParser::parse
-    // METHOD TYPE : void
-    //
-    void TagParser::parse( const InputStream & input_r, const ProgressData::ReceiverFnc & fnc_r )
-    {
-      MIL << "Start parsing " << input_r << endl;
-      if ( ! input_r.stream() )
-      {
-       std::ostringstream s;
-       s << "Can't read bad stream: " << input_r;
-       ZYPP_THROW( ParseException( s.str() ) );
-      }
-      _inputname = input_r.name();
-      beginParse();
-
-      ProgressData ticks( makeProgressData( input_r ) );
-      ticks.sendTo( fnc_r );
-      if ( ! ticks.toMin() )
-       userRequestedAbort( 0 );
-
-      iostr::EachLine line( input_r );
-      for( ; line; line.next() )
-      {
-       const char * cp = (*line).c_str();
-       switch ( *cp )
-       {
-         ///////////////////////////////////////////////////////////////////
-         case '=': // get single line data
-         {
-           SingleTagPtr tagP( new SingleTag( line.lineNo(), line.lineStart() ) );
-           SingleTag & tag( *tagP.get() );
-
-           const char * cp = (*line).c_str() + 1;
-           if ( helperParseStartTag( tag, cp ) )
-           {
-             while ( *cp == ' ' || *cp == '\t' )
-               ++cp;
-
-             tag.dataStart = tag.tagStart + cp - (*line).c_str();
-
-             if ( *cp ) // not at string end
-             {
-               const char * ep = (*line).c_str() + (*line).size();
-               do {
-                 --ep;
-               } while ( *ep == ' ' || *ep == '\t' );
-               tag.dataLength = ep+1-cp;
-               std::string( cp, tag.dataLength ).swap( tag.value );
-             }
-
-             consume( tagP );
-           }
-           else
-           {
-             ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Orphan data: " + (*line) ) ) );
-           }
-         }
-         break;
-
-         ///////////////////////////////////////////////////////////////////
-         case '+': // get mulit line data
-         {
-           MultiTagPtr tagP( new MultiTag(line.lineNo(), line.lineStart() ) );
-           MultiTag & tag( *tagP.get() );
-
-           const char * cp = (*line).c_str() + 1;
-           if ( helperParseStartTag( tag, cp ) )
-           {
-             std::string endTag( "-" );
-             endTag += tag.name;
-             if ( ! tag.modifier.empty() )
-             {
-               endTag += ".";
-               endTag += tag.modifier;
-             }
-             endTag += ":";
-
-             line.next();
-             tag.dataStart = line.lineStart();
-
-             for( ; line; line.next() )
-             {
-               if ( str::hasPrefix( *line, endTag ) )
-               {
-                 tag.dataLength = line.lineStart() - tag.dataStart;
-                 break;
-               }
-               else
-               {
-                 tag.value.push_back( *line );
-               }
-             }
-
-             if ( ! line )
-             {
-               ZYPP_THROW( ParseException( errPrefix( tagP, "Reached EOF while looking for end tag") ) );
-             }
-
-             consume( tagP );
-           }
-           else
-           {
-             ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Orphan data: " + (*line) ) ) );
-           }
-         }
-         break;
-
-         ///////////////////////////////////////////////////////////////////
-         default: // empty or comment
-         {
-           for ( const char * cp = (*line).c_str(); *cp; ++cp )
-           {
-             switch( *cp )
-             {
-               case ' ':
-               case '\t':
-               case '\r':
-               case '\n':
-                 break;
-
-               default:
-                 if ( *cp != '#' )
-                 {
-                   ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Orphan data: " + (*line) ) ) );
-                 }
-                 cp = 0;
-                 break;
-             }
-
-             if ( ! cp )
-             {
-               break;
-             }
-           }
-         }
-         break;
-       }
-
-       if ( ! ticks.set( input_r.stream().tellg() ) )
-         userRequestedAbort( line.lineNo() );
-      }
-
-      if ( ! ticks.toMax() )
-       userRequestedAbort( line.lineNo() );
-
-      endParse();
-      _inputname.clear();
-      MIL << "Done parsing " << input_r << endl;
-    }
-
-    /////////////////////////////////////////////////////////////////
-  } // namespace parser
-  ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
diff --git a/zypp/parser/TagParser.h b/zypp/parser/TagParser.h
deleted file mode 100644 (file)
index d44e274..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file      zypp/parser/TagParser.h
- *
-*/
-#ifndef ZYPP_PARSER_TAGPARSER_H
-#define ZYPP_PARSER_TAGPARSER_H
-
-#include <iosfwd>
-#include <string>
-#include <list>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/NonCopyable.h"
-#include "zypp/base/InputStream.h"
-
-#include "zypp/ProgressData.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace parser
-  { /////////////////////////////////////////////////////////////////
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // CLASS NAME : TagParser
-    //
-    /** Basic SUSEtags parser.
-     * Will replace parser/tagfile/ and  parser/taggedfile/ stuff.
-    */
-    class TagParser : private base::NonCopyable
-    {
-    public:
-
-      struct Tag
-      {
-       Tag( unsigned lineNo_r = 0, std::streamoff tagStart_r = -1 )
-         : lineNo( lineNo_r ), tagStart( tagStart_r ), dataStart( -1 ), dataLength( 0 )
-       {}
-       /** String <tt>"NAME[.MODIFIER]:"</tt>. */
-       std::string asString() const;
-
-       unsigned       lineNo;
-       std::streamoff tagStart;
-       std::streamoff dataStart;
-       std::streamoff dataLength;
-
-       std::string    name;
-       std::string    modifier;
-      };
-
-      struct SingleTag : Tag
-      {
-       SingleTag( unsigned lineNo_r = 0, std::streamoff tagStart_r = -1 )
-         : Tag( lineNo_r, tagStart_r )
-       {}
-       std::string value;
-      };
-
-      struct MultiTag : Tag
-      {
-       MultiTag( unsigned lineNo_r = 0, std::streamoff tagStart_r = -1 )
-         : Tag( lineNo_r, tagStart_r )
-       {}
-       std::list<std::string> value;
-      };
-
-      typedef shared_ptr<SingleTag> SingleTagPtr;
-      typedef shared_ptr<MultiTag> MultiTagPtr;
-
-    public:
-      /** Default ctor */
-      TagParser();
-      /** Dtor */
-      virtual ~TagParser();
-      /** Parse the stream.
-       * \throw ParseException on errors.
-       * \throws AbortRequestException on user request.
-       * Invokes \ref consume for each tag. \ref consume might throw
-       * other exceptions as well.
-      */
-      virtual void parse( const InputStream & input_r,
-                         const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
-
-    protected:
-      /** Called when start parsing. */
-      virtual void beginParse();
-      /** Called when a single-tag is found. */
-      virtual void consume( const SingleTagPtr & tag_r );
-      /** Called when a multi-tag is found. */
-      virtual void consume( const MultiTagPtr & tag_r );
-      /** Called when the parse is done. */
-      virtual void endParse();
-
-    protected:
-      /** Called when user(callback) request to abort.
-       * \throws AbortRequestException unless overloaded.
-      */
-      virtual void userRequestedAbort( unsigned lineNo_r );
-
-    protected:
-      /** Prefix exception message with line and tag information. */
-      std::string errPrefix( unsigned lineNo_r,
-                            const std::string & msg_r = std::string() ) const;
-      /** Prefix exception message with line and tag information. */
-      std::string errPrefix( const SingleTagPtr & tag_r,
-                            const std::string & msg_r = std::string() ) const;
-      /** Prefix exception message with line and tag information. */
-      std::string errPrefix( const MultiTagPtr & tag_r,
-                            const std::string & msg_r = std::string() ) const;
-      /** Name of the current InputStream. */
-      const std::string & inputname() const
-      { return _inputname; }
-
-    private:
-      std::string _inputname;
-    };
-    ///////////////////////////////////////////////////////////////////
-
-    /** \relates TagParser::Tag Stream output. */
-    std::ostream & operator<<( std::ostream & str, const TagParser::Tag & obj );
-
-    /** \relates TagParser::SingleTag Stream output. */
-    std::ostream & operator<<( std::ostream & str, const TagParser::SingleTag & obj );
-
-    /** \relates TagParser::MultiTag Stream output. */
-    std::ostream & operator<<( std::ostream & str, const TagParser::MultiTag & obj );
-
-    /////////////////////////////////////////////////////////////////
-  } // namespace parser
-  ///////////////////////////////////////////////////////////////////
-  /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_PARSER_TAGPARSER_H
diff --git a/zypp/parser/XMLNodeIterator.cc b/zypp/parser/XMLNodeIterator.cc
deleted file mode 100644 (file)
index a059ebd..0000000
+++ /dev/null
@@ -1,328 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/XMLNodeIterator.cc
- *
-*/
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sstream>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/base/Logger.h>
-#include <libxml2/libxml/xmlreader.h>
-#include <libxml2/libxml/xmlerror.h>
-
-namespace zypp {
-
-  namespace parser {
-
-    using namespace std;
-
-    namespace{
-      /**
-       * Internal function to read from the input stream.
-       * This feeds the xmlTextReader used in the XMLNodeIterator.
-       * @param context points to the istream to read from
-       * @param buffer is to be filled with what's been read
-       * @param bufferLen max memory bytes to read
-       * @return
-       */
-      int ioread(void *context,
-                char *buffer,
-                int bufferLen)
-      {
-        xml_assert(buffer);
-        std::istream *streamPtr = (std::istream *) context;
-        xml_assert(streamPtr);
-        streamPtr->read(buffer,bufferLen);
-        return streamPtr->gcount();
-      }
-
-      /**
-       * Internal function to finish reading.
-       * This is required by the xmlTextReader API, but
-       * not needed since the stream will be created when
-       * the istream object vanishes.
-       * @param context points to the istream to read from
-       * @return 0 on success.
-       */
-      int ioclose(void * context)
-      {
-        /* don't close. destructor will take care. */
-        return 0;
-      }
-    }
-
-    XMLParserError::XMLParserError(const char *msg,
-                                       int severity,
-                                       xmlTextReaderLocatorPtr locator,
-                                       int docLine,
-                                       int docColumn)
-    throw()
-    : _msg(msg), _severity(severity), _locator(locator),
-    _docLine(docLine), _docColumn(docColumn)
-    { }
-
-    XMLParserError::~XMLParserError() throw()
-    { }
-
-    std::string XMLParserError::msg() const throw()
-    {
-      return _msg;
-    }
-
-    int XMLParserError::severity() const throw()
-    {
-      return _severity;
-    }
-
-    xmlTextReaderLocatorPtr XMLParserError::locator() const throw()
-    {
-      return _locator;
-    }
-
-    int XMLParserError::docLine() const throw()
-    {
-      return _docLine;
-    }
-
-    int XMLParserError::docColumn() const throw()
-    {
-      return _docColumn;
-    }
-
-    std::string XMLParserError::position() const throw()
-    {
-      if (_docLine!=-1 && _docLine!=-1) {
-        std::stringstream strm;
-        strm << "at line " << _docLine
-          <<", column " << _docColumn;
-        return strm.str();
-      }
-      else
-        return "";
-    }
-
-    std::ostream& operator<<(std::ostream &out, const XMLParserError& error)
-    {
-      const char *errOrWarn = (error.severity() & XML_PARSER_SEVERITY_ERROR) ? "error" : "warning";
-    out << "XML syntax " << errOrWarn << ": " << error.msg();
-      if (error.docLine()!=-1) {
-        out  << "at line " << error.docLine()
-          << ", column " << error.docColumn();
-      }
-      out << std::endl;
-      return out;
-    }
-
-    XMLNodeIteratorBase::XMLNodeIteratorBase( const Pathname xml_file_path,
-                                             const std::string &baseUrl,
-                                             const char *validationPath, parser::ParserProgress::Ptr progress)
-      : _error(0), _file(0), _baseUrl(baseUrl), _progress(progress), _stream_size(0), _bytes_consumed(0)
-    {
-     
-      int fd = open( xml_file_path.asString().c_str(), O_RDONLY );
-      if ( fd < 0 )
-        ZYPP_THROW(Exception("Cant't open " + xml_file_path.asString()));
-      
-      _reader = xmlReaderForFd( fd, baseUrl.c_str(), "utf-8", XML_PARSE_PEDANTIC)
-          ;
-      xmlTextReaderSetErrorHandler(_reader, (xmlTextReaderErrorFunc) errorHandler, this);
-      if (_reader )
-      {
-        if ( validationPath )
-        {
-          if (xmlTextReaderRelaxNGValidate(_reader,validationPath)==-1)
-            WAR << "Could not enable validation of document using " << validationPath << std::endl;
-        }
-        // otherwise validation is disabled.
-      }
-        /* Derived classes must call fetchNext() in their constructors themselves,
-      XMLNodeIterator has no access to their virtual functions during
-      construction */
-    }
-
-    XMLNodeIteratorBase::XMLNodeIteratorBase(std::istream &input,
-                                             const std::string &baseUrl,
-                                             const char *validationPath, parser::ParserProgress::Ptr progress)
-      : _error(0),
-      _input(& input),
-      _reader(xmlReaderForIO(ioread, ioclose, _input, baseUrl.c_str(), "utf-8",
-                             XML_PARSE_PEDANTIC)),
-      _baseUrl(baseUrl), _progress(progress), _stream_size(0), _bytes_consumed(0)
-    {
-      xmlTextReaderSetErrorHandler(_reader, (xmlTextReaderErrorFunc) errorHandler, this);
-      // xmlTextReaderSetStructuredErrorHandler(_reader, structuredErrorHandler, this);
-      if (_reader )
-      {
-        if ( validationPath )
-        {
-            if (xmlTextReaderRelaxNGValidate(_reader,validationPath)==-1)
-              WAR << "Could not enable validation of document using " << validationPath << std::endl;
-        }
-        // otherwise validation is disabled.
-      }
-        /* Derived classes must call fetchNext() in their constructors themselves,
-           XMLNodeIterator has no access to their virtual functions during
-           construction */
-    }
-
-    XMLNodeIteratorBase::XMLNodeIteratorBase()
-      : _error(0), _input(0), _reader(0)
-    { }
-
-
-
-    XMLNodeIteratorBase::~XMLNodeIteratorBase()
-    {
-      if (_reader != 0)
-        xmlFreeTextReader(_reader);
-    }
-
-
-    bool
-    XMLNodeIteratorBase::atEnd() const
-    {
-      if ( _error.get() != 0 || getCurrent() == 0 )
-      {
-        if ( _progress )
-          _progress->finish();
-        return true;
-      }
-      return false;
-    }
-
-
-    bool
-    XMLNodeIteratorBase::operator==(const XMLNodeIteratorBase &other) const
-    {
-      if (atEnd())
-        return other.atEnd();
-      else
-        return this == & other;
-    }
-
-
-    const XMLParserError *
-    XMLNodeIteratorBase::errorStatus() const
-    {
-      return _error.get();
-    }
-
-
-    void XMLNodeIteratorBase::fetchNext()
-    {
-      xml_assert(_reader);
-      
-      if ( _progress )
-      {
-        long int consumed = xmlTextReaderByteConsumed (_reader);
-        //MIL <<  consumed << " bytes consumed." << endl;
-        // only report every 4k or more
-        if ( ( consumed - _bytes_consumed > 4096 ) )
-        {
-          _progress->progress(consumed);
-          _bytes_consumed = consumed;
-        }
-      }
-      
-      int status;
-      /* throw away the old entry */
-      setCurrent(0);
-
-      if (_reader == 0) {
-          /* this is a trivial iterator over (max) only one element,
-             and we reach the end now. */
-        ;
-      }
-      else {
-          /* repeat as long as we successfully read nodes
-             breaks out when an interesting node has been found */
-        while ((status = xmlTextReaderRead(_reader))==1)
-        { 
-          xmlNodePtr node = xmlTextReaderCurrentNode(_reader);
-          
-          if (isInterested(node))
-          {
-              // xmlDebugDumpNode(stdout,node,5);
-            _process(_reader);
-              // _currentDataPtr.reset(new ENTRYTYPE(process(_reader)));
-            status = xmlTextReaderNext(_reader);
-            break;
-          }
-        }
-        if (status == -1) {  // error occured
-          if (_error.get() == 0) {
-            errorHandler(this, "Unknown error while parsing xml file\n",
-                         XML_PARSER_SEVERITY_ERROR, 0);
-          }
-        }
-      }
-    }
-
-
-    void
-    XMLNodeIteratorBase::errorHandler(void * arg,
-                                      const char * msg,
-                                      int severity,
-                                      xmlTextReaderLocatorPtr locator)
-    {
-      XMLNodeIteratorBase *obj;
-      obj = (XMLNodeIteratorBase*) arg;
-      xml_assert(obj);
-      xmlTextReaderPtr reader = obj->_reader;
-      if (strcmp("%s",msg) == 0) {
-          /* This works around a buglet in libxml2, you often get "%s" as message
-             and the message is in "severity". Does this work for other
-             architectures??? FIXME */
-        WAR << "libxml2 error reporting defect, got '%s' as message" << endl;
-        msg = (char *) severity;
-        severity = XML_PARSER_SEVERITY_WARNING;
-      }
-      const char *errOrWarn = (severity & XML_PARSER_SEVERITY_ERROR) ? "error" : "warning";
-
-#if 0
-      std::ostream& out = (severity & XML_PARSER_SEVERITY_ERROR) ? ERR : WAR;
-
-        /* Log it */
-    out << "XML syntax " << errOrWarn << ": " << msg;
-      if (obj->_error.get()) {
-        out << "(encountered during error recovery!)" << std::endl;
-      }
-      if (reader && msg[0] != 0) {
-        out  << "at ";
-        if (! obj->_baseUrl.empty())
-          out << obj->_baseUrl << ", ";
-        out << "line " << xmlTextReaderGetParserLineNumber(reader)
-        << ", column " << xmlTextReaderGetParserColumnNumber(reader);
-      }
-      out << std::endl;
-#endif
-        /* save it */
-      if ((severity & XML_PARSER_SEVERITY_ERROR)
-          && ! obj->_error.get()) {
-            if (reader)
-              obj->_error.reset(new XMLParserError
-                                (msg, severity,locator,
-                                 xmlTextReaderLocatorLineNumber(locator),
-                                 xmlTextReaderGetParserColumnNumber(reader)));
-            else
-              obj->_error.reset(new XMLParserError
-                                (msg, severity, locator,
-                                 -1, -1));
-          }
-    }
-
-  }
-}
diff --git a/zypp/parser/XMLNodeIterator.h b/zypp/parser/XMLNodeIterator.h
deleted file mode 100644 (file)
index 85e38ef..0000000
+++ /dev/null
@@ -1,517 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/XMLNodeIterator.h
- *
-*/
-
-#ifndef XMLNodeIterator_h
-#define XMLNodeIterator_h
-
-#include <zypp/parser/LibXMLHelper.h>
-#include <iosfwd>
-//#include <ostream>
-//#include <sstream>
-#include "zypp/parser/xml_parser_assert.h"
-#include "zypp/Pathname.h"
-#include "zypp/parser/ParserProgress.h"
-#include <iterator>
-
-extern "C" {
-  typedef void * xmlTextReaderLocatorPtr;
-  struct _xmlNode;
-  typedef struct _xmlNode xmlNode;
-  typedef xmlNode *xmlNodePtr;
-
-  struct _xmlTextReader;
-  typedef _xmlTextReader xmlTextReader;
-  typedef xmlTextReader *xmlTextReaderPtr;
-
-  struct _xmlError;
-  typedef _xmlError xmlError;
-  typedef xmlError *xmlErrorPtr;
-}
-
-namespace zypp {
-
-  namespace parser {
-
-
-    /**
-     * @short class for reporting syntax errors in XMLNodeIterator.
-     */
-    class XMLParserError {
-    public:
-      /**
-       * Constructor
-       */
-      XMLParserError(const char *msg,
-                     int severity,
-                     xmlTextReaderLocatorPtr locator,
-                     int docLine,
-                     int docColumn) throw();
-
-      ~XMLParserError() throw();
-
-      /**
-       * The message of the errors
-       */
-      std::string msg() const throw();
-
-      /**
-       * The severity of this error
-       */
-      int severity() const throw();
-
-      /**
-       * See libxml2 documentation
-       */
-      xmlTextReaderLocatorPtr locator() const throw();
-
-      /**
-       * The line number in the xml document where the error occurred.
-       */
-      int docLine() const throw();
-
-      /**
-       * The column number in the xml document where the error occurred.
-       */
-      int docColumn() const throw();
-
-      /**
-       * Gives a string describing the position in the xml document.
-       * (either empty, or "at line ..., column ...")
-       **/
-      std::string position() const throw();
-
-    private:
-
-      std::string _msg;
-      int _severity;
-      xmlTextReaderLocatorPtr _locator;
-      int _docLine;
-      int _docColumn;
-    };
-
-
-    std::ostream& operator<<(std::ostream &out, const XMLParserError& error);
-
-
-
-    /**
-     *
-     * @short Abstract class to iterate over an xml stream
-     *
-     * Derive from XMLNodeIterator<ENTRYTYPE> to get an iterator
-     * that returns ENTRYTYPE objects. A derived class must provide
-     * isInterested() and process(). It should also provide a
-     * Constructor Derived(std::stream,std::string baseUrl) which
-     * must call fetchNext().
-     *
-     * The derived iterator class should be compatible with an stl
-     * input iterator. Use like this:
-     *
-     * for (Iterator iter(anIstream, baseUrl),
-     *      iter != Iterator.end(),     // or: iter() != 0, or ! iter.atEnd()
-     *      ++iter) {
-     *    doSomething(*iter)
-     * }
-     *
-     * The iterator owns the pointer (i.e., caller must not delete it)
-     * until the next ++ operator is called. At this time, it will be
-     * destroyed (and a new ENTRYTYPE is created.)
-     *
-     * If the input is fundamentally flawed so that it makes no sense to
-     * continue parsing, XMLNodeIterator will log it and consider the input as finished.
-     * You can query the exit status with errorStatus().
-     */
-
-
-    class XMLNodeIteratorBase {
-    public:
-      /**
-       * Constructor. Derived classes must call fetchNext() here.
-       * @param input is the input stream (contains the xml stuff)
-       * @param baseUrl is the base URL of the xml document
-       * FIXME: use XMLParserError::operator<< instead of doing it on my own.
-       */
-      XMLNodeIteratorBase(std::istream &input,
-                          const std::string &baseUrl,
-                          const char *validationPath, parser::ParserProgress::Ptr progress );
-
-      /**
-       * Constructor. Derived classes must call fetchNext() here.
-       * @param xml_file_path is the xml file
-       * @param baseUrl is the base URL of the xml document
-       * FIXME: use XMLParserError::operator<< instead of doing it on my own.
-       */
-      
-      XMLNodeIteratorBase( const Pathname xml_file_path,
-          const std::string &baseUrl,
-          const char *validationPath, parser::ParserProgress::Ptr progress);
-      
-      /**
-       * Constructor for an empty iterator.
-       * An empty iterator is already at its end.
-       * This is what end() returns ...
-       */
-      XMLNodeIteratorBase();
-
-      /**
-       * Destructor
-       */
-      virtual ~XMLNodeIteratorBase();
-
-      /**
-       * Have we reached the end?
-       * A parser error also means "end reached"
-       * @return whether the end has been reached.
-       */
-      bool atEnd() const;
-
-      /**
-       * Two iterators are equal if both are at the end
-       * or if they are identical.
-       * Since you cannot copy an XMLNodeIterator, everything
-       * else is not equal.
-       * @param other the other iterator
-       * @return true if equal
-       */
-      bool
-      operator==(const XMLNodeIteratorBase &other) const;
-
-      /**
-       * Opposit of operator==
-       * @param other the other iterator
-       * @return true if not equal
-       */
-      bool
-      operator!=(const XMLNodeIteratorBase &otherNode) const
-      {
-        return ! operator==(otherNode);
-      }
-
-      /**
-       * returns the error status or 0 if no error
-       * the returned pointer is not-owning,
-       * it will be deleted upon destruction of the XMLNodeIterator.
-       * @return pointer to error status (if exists)
-       */
-      const XMLParserError *
-      errorStatus() const;
-
-    protected:
-
-      /**
-       * filter for the xml nodes
-       * The derived class decides which xml nodes it is actually interested in.
-       * For each that is selected, process() will be called an the resulting ENTRYTYPE
-       * object used as the next value for the iterator.
-       * Documentation for the node structure can be found in the libxml2 documentation.
-       * Have a look at LibXMLHelper to access node attributes and contents.
-       * @param nodePtr points to the xml node in question. Only the node is available, not the subtree.
-       *                See libxml2 documentation.
-       * @return true if interested
-       */
-      virtual bool
-      isInterested(const xmlNodePtr nodePtr) = 0;
-
-      /**
-       * process an xml node and set it as next element
-       * The derived class has to produce the ENTRYTYPE object here.
-       * Details about the xml reader is in the libxml2 documentation.
-       * You'll most probably want to use xmlTextReaderExpand(reader) to
-       * request the full subtree, and then use the links in the resulting
-       * node structure to traverse, and class LibXMLHelper to access the
-       * attributes and element contents.
-       * fetchNext() cannot throw an error since it will be called in the constructor.
-       * Instead, in case of a fundamental syntax error the error is saved
-       * and will be thrown with the next checkError().
-       * @param readerPtr points to the xmlTextReader that reads the xml stream.
-       */
-      virtual void
-      _process(const xmlTextReaderPtr readerPtr) = 0;
-
-      /**
-       * Fetch the next element and save it as next element
-       */
-      void fetchNext();
-
-      /**
-       * Internal function to set the _error variable
-       * in case of a parser error. It logs the message
-       * and saves errors in _error, so that they will
-       * be thrown by checkError().
-       * @param arg set to this with xmlReaderSetErrorHandler()
-       * @param msg the error message
-       * @param severity the severity
-       * @param locator as defined by libxml2
-       */
-      static void
-      errorHandler(void * arg,
-                   const char * msg,
-                   int severity,
-                   xmlTextReaderLocatorPtr locator);
-
-
-      virtual void setCurrent(const void *data) = 0;
-      virtual void* getCurrent() const = 0;
-
-    private:
-
-      /**
-       * assignment is forbidden.
-       * Reason: We can't copy an xmlTextReader
-       */
-      XMLNodeIteratorBase & operator=(const XMLNodeIteratorBase& otherNode);
-
-      /**
-       * copy constructor is forbidden.
-       * Reason: We can't copy an xmlTextReader
-       * FIXME: This prevents implementing the end() method for derived classes.
-       *
-       * @param otherNode
-       * @return
-       */
-      XMLNodeIteratorBase(const XMLNodeIteratorBase& otherNode);
-
-      /**
-       * if an error occured, this contains the error.
-       */
-      std::auto_ptr<XMLParserError> _error;
-
-      /**
-       * contains the istream to read the xml file from.
-       * Can be 0 if at end or if the current element is the only element left.
-       **/
-      std::istream* _input;
-      
-      /**
-       * contains the file to read the xml file from.
-       * Can be 0 if at end or if the current element is the only element left.
-       **/
-      FILE* _file;
-      
-
-      /**
-       * contains the xmlTextReader used to parse the xml file.
-       **/
-      xmlTextReaderPtr _reader;
-
-      /**
-       * contains the base URL of the xml documentation
-       */
-      std::string _baseUrl;
-      
-      /**
-       * last progress information
-       */
-      parser::ParserProgress::Ptr _progress;
-      
-      /**
-       * size of the stream to parse
-       */
-      long int _stream_size;
-      /**
-       * bytes consumed in last report
-       */
-      long int _bytes_consumed;
-    }; /* end class XMLNodeIteratorBase */
-
-
-
-    /* --------------------------------------------------------------------------- */
-
-    template <class ENTRYTYPE>
-    class XMLNodeIterator : public XMLNodeIteratorBase,
-                            public std::iterator<std::input_iterator_tag, ENTRYTYPE>  {
-    public:
-      /**
-       * Constructor. Derived classes must call fetchNext() here.
-       * @param input is the input stream (contains the xml stuff)
-       * @param baseUrl is the base URL of the xml document
-       * FIXME: use XMLParserError::operator<< instead of doing it on my own.
-       */
-      XMLNodeIterator(std::istream &input,
-                      const std::string &baseUrl,
-                      const char *validationPath = 0,
-                      parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() )
-        : XMLNodeIteratorBase(input, baseUrl, validationPath, progress), _current(0)
-      {
-        /* Derived classes must call fetchNext() in their constructors themselves,
-           XMLNodeIterator has no access to their virtual functions during
-           construction */
-      }
-
-      /**
-       * Constructor. Derived classes must call fetchNext() here.
-       * @param xml_file_path is  the xml file
-       * @param baseUrl is the base URL of the xml document
-       * FIXME: use XMLParserError::operator<< instead of doing it on my own.
-       */
-      XMLNodeIterator( const Pathname xml_file_path, const std::string &baseUrl
-                      , const char *validationPath, parser::ParserProgress::Ptr progress)
-          : XMLNodeIteratorBase( xml_file_path, baseUrl, validationPath, progress), _current(0)
-      {
-      }
-      
-      /**
-       * Constructor for a trivial iterator.
-       * A trivial iterator contains only one element.
-       * This is at least needed internally for the
-       * postinc (iter++) operator
-       * @param entry is the one and only element of this iterator.
-       */
-      XMLNodeIterator(ENTRYTYPE &entry)
-        : XMLNodeIteratorBase()
-      {
-        setCurrent((void *)& entry);
-      }
-
-      /**
-       * Constructor for an empty iterator.
-       * An empty iterator is already at its end.
-       * This is what end() returns ...
-       */
-      XMLNodeIterator()
-        : XMLNodeIteratorBase(), _current(0)
-      { }
-
-      /**
-       * Destructor
-       */
-      virtual ~XMLNodeIterator()
-      { }
-
-      /**
-       * Fetch a pointer to the current element
-       * @return pointer to the current element.
-       */
-      ENTRYTYPE &
-        operator*() const
-      {
-        assert (! atEnd());
-        return * (ENTRYTYPE *) getCurrent();
-      }
-
-      /**
-       * Fetch the current element
-       * @return the current element
-       */
-      ENTRYTYPE *
-        operator()() const
-      {
-        if (_error)
-          return 0;
-        else
-          return getCurrent();
-      }
-
-      /**
-       * Go to the next element and return it
-       * @return the next element
-       */
-      XMLNodeIterator<ENTRYTYPE> &  /* ++iter */
-      operator++() {
-        fetchNext();
-        return *this;
-      }
-
-      /**
-       * remember the current element, go to next and return remembered one.
-       * avoid this, usually you need the preinc operator (++iter)
-       * This function may throw ParserError if something is fundamentally wrong
-       * with the input.
-       * @return the current element
-       */
-      XMLNodeIterator operator++(int)   /* iter++ */
-      {
-        assert (!atEnd());
-        XMLNodeIterator<ENTRYTYPE> tmp(operator()());
-        fetchNext();
-        return tmp;
-      }
-
-      /**
-       * similar to operator*, allows direct member access
-       * @return pointer to current element
-       */
-      const ENTRYTYPE *
-        operator->()
-      {
-        xml_assert(! atEnd());
-        return getCurrent();
-      }
-
-    protected:
-
-      /**
-       * filter for the xml nodes
-       * The derived class decides which xml nodes it is actually interested in.
-       * For each that is selected, process() will be called an the resulting ENTRYTYPE
-       * object used as the next value for the iterator.
-       * Documentation for the node structure can be found in the libxml2 documentation.
-       * Have a look at LibXMLHelper to access node attributes and contents.
-       * @param nodePtr points to the xml node in question. Only the node is available, not the subtree.
-       *                See libxml2 documentation.
-       * @return true if interested
-       */
-      virtual bool
-        isInterested(const xmlNodePtr nodePtr) = 0;
-
-      /**
-       * process an xml node
-       * The derived class has to produce the ENTRYTYPE object here.
-       * Details about the xml reader is in the libxml2 documentation.
-       * You'll most probably want to use xmlTextReaderExpand(reader) to
-       * request the full subtree, and then use the links in the resulting
-       * node structure to traverse, and class LibXMLHelper to access the
-       * attributes and element contents.
-       * fetchNext() cannot throw an error since it will be called in the constructor.
-       * Instead, in case of a fundamental syntax error the error is saved
-       * and will be thrown with the next checkError().
-       * @param readerPtr points to the xmlTextReader that reads the xml stream.
-       * @return
-       */
-      virtual ENTRYTYPE
-      process(const xmlTextReaderPtr readerPtr) = 0;
-
-      void
-      _process(const xmlTextReaderPtr readerPtr)
-      {
-        _current.reset( new ENTRYTYPE(process(readerPtr)));
-      }
-
-    private:
-
-      void setCurrent(const void *data)
-      {
-        if (data)
-          _current.reset(new ENTRYTYPE(* (ENTRYTYPE *) data));
-        else
-          _current.reset(0);
-      }
-
-      void *getCurrent() const
-      {
-        return _current.get();
-      }
-
-      /**
-       * contains the current element of the iterator.
-       * a pointer is used to be able to handle non-assigneable ENTRYTYPEs.
-       * The iterator owns the element until the next ++ operation.
-       * It can be 0 when the end has been reached.
-       **/
-      std::auto_ptr<ENTRYTYPE> _current;
-    }; /* end class XMLNodeIterator */
-
-  }
-}
-
-#endif
index f1702ee..1c11cd7 100644 (file)
@@ -8,22 +8,14 @@
 \---------------------------------------------------------------------*/
 
 #include <iostream>
-#include "zypp/base/Easy.h"
 #include "zypp/base/Logger.h"
-#include "zypp/base/Iterator.h"
 #include "zypp/base/String.h"
-#include "zypp/base/Regex.h"
 
-#include <zypp/target/rpm/RpmHeader.h>
-#include <zypp/target/rpm/RpmDb.h>
+#include "zypp/PathInfo.h"
 
 #include "zypp/parser/plaindir/RepoParser.h"
-#include "zypp/parser/ParseException.h"
-#include "zypp/PathInfo.h"
-#include "zypp/ZConfig.h"
 
-using namespace std;
-using namespace zypp::target::rpm;
+using std::endl;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -69,163 +61,6 @@ RepoStatus dirStatus( const Pathname &dir )
   return status;
 }
 
-/** RepoParser implementation.
- * \todo Clean data on exeption.
- */
-class RepoParser::Impl
-{
-  public:
-    Impl( const std::string & repositoryId_r,
-          data::ResolvableDataConsumer & consumer_r,
-          const ProgressData::ReceiverFnc & fnc_r )
-    : _repositoryId( repositoryId_r )
-    , _consumer( consumer_r )
-    , _sysarch( ZConfig::instance().systemArchitecture() )
-    {
-      _ticks.sendTo( fnc_r );
-    }
-#if 0
-    int extract_packages_from_directory( const Pathname & rootpath,
-                                         const Pathname & subdir,
-                                         bool recursive);
-#endif
-    /** Main entry to parser. */
-    void parse( const Pathname & reporoot_r );
-  public:
-
-  private:
-    std::string                 _repositoryId;
-    data::ResolvableDataConsumer & _consumer;
-    ProgressData                   _ticks;
-    Arch                          _sysarch;
-
-  private: // these (and _ticks) are actually scoped per parse() run.
-};
-//////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-//     METHOD NAME : RepoParser::Impl::parse
-//     METHOD TYPE : void
-//
-void RepoParser::Impl::parse( const Pathname & reporoot_r )
-{
-  //extract_packages_from_directory( reporoot_r, Pathname(), true );
-/*if ( ! _ticks.incr() )
-      ZYPP_THROW( AbortRequestException() );*/
-  // Done
-  if ( ! _ticks.toMax() )
-    ZYPP_THROW( AbortRequestException() );
-}
-
-#if 0
-int RepoParser::Impl::extract_packages_from_directory( const Pathname & rootpath,
-                                                       const Pathname & subdir, 
-                                                       bool recursive)
-{
-  using target::rpm::RpmHeader;
-  Pathname path = rootpath / subdir;
-  Pathname filename;
-  PathInfo magic;
-  bool distro_magic, pkginfo_magic;
-
-//   DBG << "extract_packages_from_directory(.., " << path << ", " << repo.info().alias() << ", " << recursive << ")" << endl;
-
-    /*
-      Check for magic files that indicate how to treat the
-      directory.  The files aren't read -- it is sufficient that
-      they exist.
-    */
-
-  magic = PathInfo( path + "/RC_SKIP" );
-  if (magic.isExist()) {
-    return 0;
-  }
-
-  magic = PathInfo( path + "/RC_RECURSIVE" );
-  if (magic.isExist())
-    recursive = true;
-
-  magic = PathInfo( path + "/RC_BY_DISTRO" );
-  distro_magic = magic.isExist();
-
-  pkginfo_magic = true;
-  magic = PathInfo( path + "/RC_IGNORE_PKGINFO" );
-  if (magic.isExist())
-    pkginfo_magic = false;
-
-
-  std::list<std::string> dircontent;
-  if (filesystem::readdir( dircontent, path, false) != 0) {           // dont look for dot files
-    ERR << "readdir " << path << " failed" << endl;
-    return -1;
-  }
-
-  for (std::list<std::string>::const_iterator it = dircontent.begin(); it != dircontent.end(); ++it) {
-    Pathname file_path = path + *it;
-    PathInfo file_info( file_path );
-    if (recursive && file_info.isDir())
-    {
-      extract_packages_from_directory( rootpath, subdir / *it, recursive );
-    }
-    else if (file_info.isFile() && file_path.extension() == ".rpm" )
-    {
-      RpmHeader::constPtr header = RpmHeader::readPackage( file_path, RpmHeader::NOSIGNATURE );
-#warning FIX creation of Package from src.rpm header
-      // make up proper location relative to rootpath (bnc #368218)
-      data::Package_Ptr package = makePackageDataFromHeader( header, NULL, subdir / *it, _repositoryId );
-      if (package != NULL) {
-       if (Arch(package->arch).compatibleWith(_sysarch))
-       {
-         DBG << "Adding package " << *package << endl;
-         _consumer.consumePackage( package );
-       }
-       else
-       {
-         DBG << "Ignoring package " << *package << endl;
-       }
-      }
-    }
-  }
-  return 0;
-}
-#endif
-
-///////////////////////////////////////////////////////////////////
-//
-//     CLASS NAME : RepoParser
-//
-///////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-//     METHOD NAME : RepoParser::RepoParser
-//     METHOD TYPE : Ctor
-//
-RepoParser::RepoParser( const std::string & repositoryId_r,
-                        data::ResolvableDataConsumer & consumer_r,
-                        const ProgressData::ReceiverFnc & fnc_r )
-: _pimpl( new Impl( repositoryId_r, consumer_r, fnc_r ) )
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-//     METHOD NAME : RepoParser::~RepoParser
-//     METHOD TYPE : Dtor
-//
-RepoParser::~RepoParser()
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-//     METHOD NAME : RepoParser::parse
-//     METHOD TYPE : void
-//
-void RepoParser::parse( const Pathname & reporoot_r )
-{
-  _pimpl->parse( reporoot_r );
-}
-
 /////////////////////////////////////////////////////////////////
 } // namespace plaindir
 ///////////////////////////////////////////////////////////////////
index 26db6cc..0481569 100644 (file)
 #ifndef ZYPP_PARSER_PLAINDIR_REPOPARSER_H
 #define ZYPP_PARSER_PLAINDIR_REPOPARSER_H
 
-#include <iosfwd>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/data/RecordId.h"
-#include "zypp/data/ResolvableDataConsumer.h"
-
-#include "zypp/ProgressData.h"
 #include "zypp/RepoStatus.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -35,37 +26,6 @@ namespace zypp
        * \short Gives a cookie for a dir
        */
       RepoStatus dirStatus( const Pathname &dir );
-      
-      /** Plaindir metadata parser. */
-       
-      class RepoParser : private base::NonCopyable
-      {
-      public:
-       /** Ctor.
-        *
-        * \param repositoryId_r repository identifier
-        * \param consumer_r consumer of parsed data
-        * \param fnc_r progress reporting function
-       */
-       RepoParser( const std::string & repositoryId_r,
-                   data::ResolvableDataConsumer & consumer_r,
-                   const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
-        /** Dtor */
-        ~RepoParser();
-
-       /** Parse a local repository located at \a reporoot_r.
-        *
-        * \param reporoot_r The local repositories root directory.
-       * \throw Exception on errors.
-       */
-       void parse( const Pathname & reporoot_r );
-
-       public:
-         class Impl;
-       private:
-         RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
-      };
-      ///////////////////////////////////////////////////////////////////
 
       /////////////////////////////////////////////////////////////////
     } // namespace plaindir
@@ -76,4 +36,4 @@ namespace zypp
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
-#endif // ZYPP2_PARSER_SUSETAGS_REPOPARSER_H
+#endif // ZYPP_PARSER_PLAINDIR_REPOPARSER_H
index c17108b..fcbdf22 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "zypp/parser/susetags/ContentFileReader.h"
 #include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/data/ResolvableData.h"
 
 #include "zypp/ZConfig.h"
 
@@ -50,13 +49,6 @@ namespace zypp
          : _parent( parent_r )
          {}
 
-         data::Product & product()
-         {
-           if ( !_product )
-             _product = new data::Product;
-           return *_product;
-         }
-
          RepoIndex & repoindex()
          {
            if ( !_repoindex )
@@ -64,20 +56,9 @@ namespace zypp
            return *_repoindex;
          }
 
-         bool hasProduct() const
-         { return _product; }
-
          bool hasRepoIndex() const
          { return _repoindex; }
 
-         data::Product_Ptr handoutProduct()
-         {
-           data::Product_Ptr ret;
-           ret.swap( _product );
-           _product = 0;
-           return ret;
-         }
-
          RepoIndex_Ptr handoutRepoIndex()
          {
            RepoIndex_Ptr ret;
@@ -87,71 +68,6 @@ namespace zypp
          }
 
        public:
-         bool isRel( const std::string & rel_r ) const
-         {
-           try
-           {
-             Rel( rel_r );
-             return true;
-           }
-           catch (...)
-           {}
-           return false;
-         }
-
-         bool setUrlList( std::list<Url> & list_r, const std::string & value ) const
-         {
-           bool errors = false;
-           std::list<std::string> urls;
-           if ( str::split( value, std::back_inserter(urls) ) )
-           {
-             for ( std::list<std::string>::const_iterator it = urls.begin();
-                   it != urls.end(); ++it )
-             {
-               try
-               {
-                 list_r.push_back( *it );
-               }
-               catch( const Exception & excpt_r )
-               {
-                 WAR << *it << ": " << excpt_r << endl;
-                 errors = true;
-               }
-             }
-           }
-           return errors;
-         }
-
-         void setDependencies( data::DependencyList & deplist_r, const std::string & value ) const
-         {
-           std::list<std::string> words;
-           str::split( value, std::back_inserter( words ) );
-
-           for ( std::list<std::string>::const_iterator it = words.begin();
-                 it != words.end(); ++it )
-           {
-              std::string name( *it );
-
-              // check for '[op edition]':
-              std::list<std::string>::const_iterator next = it;
-              if ( ++next != words.end()
-                   && (*next).find_first_of( "<>=" ) != std::string::npos )
-              {
-                std::string op = *next;
-                if ( ++next != words.end() )
-                {
-                  // Add the 'name op edition' dependency
-                  deplist_r.insert( Capability( name, op, *next ) );
-                  it = next;
-                  continue;
-                }
-              }
-
-             // Add the 'name' dependency
-             deplist_r.insert( Capability( name, Capability::PARSED ) );
-           }
-         }
-
          bool setFileCheckSum( std::map<std::string, CheckSum> & map_r, const std::string & value ) const
          {
            bool error = false;
@@ -172,7 +88,6 @@ namespace zypp
 
        private:
          const ContentFileReader & _parent;
-         data::Product_Ptr  _product;
          RepoIndex_Ptr      _repoindex;
       };
       ///////////////////////////////////////////////////////////////////
@@ -217,11 +132,6 @@ namespace zypp
       void ContentFileReader::endParse()
       {
        // consume oldData
-       if ( _pimpl->hasProduct() )
-       {
-         if ( _productConsumer )
-           _productConsumer( _pimpl->handoutProduct() );
-       }
        if ( _pimpl->hasRepoIndex() )
        {
          if ( _repoIndexConsumer )
@@ -305,128 +215,6 @@ namespace zypp
          }
 
          //
-         // Product related data:
-         //
-         if ( key == "PRODUCT" )
-         {
-           std::replace( value.begin(), value.end(), ' ', '_' );
-           _pimpl->product().name = value;
-         }
-         else if ( key == "VERSION" )
-         {
-           _pimpl->product().edition = Edition( value );
-         }
-         else if ( key == "ARCH" )
-         {
-           // Default product arch is noarch. We update, if the
-           // ARCH.xxx tag is better than the current product arch
-           // and still compatible with the sysarch.
-           Arch carch( modifier );
-           if ( Arch::compare( Arch(_pimpl->product().arch), carch ) < 0
-                &&  carch.compatibleWith( sysarch ) )
-           {
-             _pimpl->product().arch = Arch( modifier );
-           }
-         }
-         else if ( key == "DISTPRODUCT" )
-         {
-           _pimpl->product().distributionName = value;
-         }
-         else if ( key == "DISTVERSION" )
-         {
-           _pimpl->product().distributionEdition = Edition( value );
-         }
-         else if ( key == "VENDOR" )
-         {
-           _pimpl->product().vendor = value;
-         }
-         else if ( key == "LABEL" )
-         {
-           _pimpl->product().summary.setText( value, Locale(modifier) );
-         }
-         else if ( key == "SHORTLABEL" )
-         {
-           _pimpl->product().shortName.setText( value, Locale(modifier) );
-         }
-         else if ( key == "TYPE" )
-         {
-           _pimpl->product().type = value;
-         }
-         else if ( key == "RELNOTESURL" )
-         {
-           for( std::string::size_type pos = value.find("%a");
-                pos != std::string::npos;
-                pos = value.find("%a") )
-           {
-             value.replace( pos, 2, sysarch.asString() );
-           }
-           try
-           {
-             _pimpl->product().releasenotesUrl = value;
-           }
-           catch( const Exception & excpt_r )
-           {
-             WAR << errPrefix( line.lineNo(), excpt_r.asString(), *line ) << endl;
-           }
-         }
-         else if ( key == "UPDATEURLS" )
-         {
-           if ( _pimpl->setUrlList( _pimpl->product().updateUrls, value ) )
-           {
-             WAR << errPrefix( line.lineNo(), "Ignored malformed URL(s)", *line ) << endl;
-           }
-         }
-         else if ( key == "EXTRAURLS" )
-         {
-           if ( _pimpl->setUrlList( _pimpl->product().extraUrls, value ) )
-           {
-             WAR << errPrefix( line.lineNo(), "Ignored malformed URL(s)", *line ) << endl;
-           }
-         }
-         else if ( key == "OPTIONALURLS" )
-         {
-           if ( _pimpl->setUrlList( _pimpl->product().optionalUrls, value ) )
-           {
-             WAR << errPrefix( line.lineNo(), "Ignored malformed URL(s)", *line ) << endl;
-           }
-         }
-         else if ( key == "PREREQUIRES" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::PREREQUIRES], value );
-         }
-         else if ( key == "REQUIRES" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::REQUIRES], value );
-         }
-         else if ( key == "PROVIDES" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::PROVIDES], value );
-         }
-         else if ( key == "CONFLICTS" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::CONFLICTS], value );
-         }
-         else if ( key == "OBSOLETES" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::OBSOLETES], value );
-         }
-         else if ( key == "RECOMMENDS" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::RECOMMENDS], value );
-         }
-         else if ( key == "SUGGESTS" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::SUGGESTS], value );
-         }
-         else if ( key == "SUPPLEMENTS" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::SUPPLEMENTS], value );
-         }
-         else if ( key == "ENHANCES" )
-         {
-           _pimpl->setDependencies( _pimpl->product().deps[Dep::ENHANCES], value );
-         }
-         //
          // ReppoIndex related data:
          //
          else if ( key == "DEFAULTBASE" )
@@ -494,18 +282,6 @@ namespace zypp
        //
        // post processing
        //
-       if ( _pimpl->hasProduct() )
-       {
-         // Insert a "Provides" _dist_name" == _dist_version"
-         if ( ! _pimpl->product().distributionName.empty() )
-         {
-           _pimpl->product().deps[Dep::PROVIDES].insert(
-               Capability( _pimpl->product().distributionName,
-                            Rel::EQ,
-                            _pimpl->product().distributionEdition,
-                            ResKind::product ) );
-         }
-       }
        if ( ! ticks.toMax() )
          userRequestedAbort( line.lineNo() );
 
index b7e0430..addf838 100644 (file)
@@ -26,15 +26,6 @@ namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
-  namespace data
-  { /////////////////////////////////////////////////////////////////
-    class Product;
-    DEFINE_PTR_TYPE(Product);
-    /////////////////////////////////////////////////////////////////
-  } // namespace data
-  ///////////////////////////////////////////////////////////////////
-
-  ///////////////////////////////////////////////////////////////////
   namespace parser
   { /////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////
@@ -48,11 +39,12 @@ namespace zypp
       //
       //       CLASS NAME : ContentFileReader
       //
-      /** */
+      /** Parse repoindex part from a \c content file.
+       * This is all the downloader needs.
+      */
       class ContentFileReader : private base::NonCopyable
       {
        public:
-         typedef function<void(const data::Product_Ptr &)> ProductConsumer;
          typedef function<void(const RepoIndex_Ptr &)> RepoIndexConsumer;
 
        public:
@@ -70,10 +62,6 @@ namespace zypp
                              const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
 
        public:
-         /** Consumer to call when product data were parsed. */
-         void setProductConsumer( const ProductConsumer & fnc_r )
-         { _productConsumer = fnc_r; }
-
          /** Consumer to call when repo index was parsed. */
          void setRepoIndexConsumer( const RepoIndexConsumer & fnc_r )
          { _repoIndexConsumer = fnc_r; }
@@ -99,7 +87,6 @@ namespace zypp
        private:
          class Impl;
          RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
-         ProductConsumer _productConsumer;
          RepoIndexConsumer _repoIndexConsumer;
       };
       ///////////////////////////////////////////////////////////////////
diff --git a/zypp/parser/xml/XmlEscape.h b/zypp/parser/xml/XmlEscape.h
new file mode 100644 (file)
index 0000000..e1adda3
--- /dev/null
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/xml/XmlEscape.h
+ *
+*/
+#ifndef ZYPP_PARSER_XML_XMLESCAPE_H
+#define ZYPP_PARSER_XML_XMLESCAPE_H
+
+// from IoBind Library:
+#include <zypp/parser/xml/xml_escape_parser.hpp>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace xml
+  { /////////////////////////////////////////////////////////////////
+
+    /** Escape xml special charaters (<tt>& -> &amp;</tt>; from IoBind library). */
+    inline std::string escape( const std::string & in_r )
+    { return iobind::parser::xml_escape_parser().escape( in_r ); }
+
+    /** Unescape xml special charaters (<tt>&amp; -> &</tt>; from IoBind library) */
+    inline std::string unescape( const std::string & in_r )
+    { return iobind::parser::xml_escape_parser().unescape( in_r ); }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace xml
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PARSER_XML_XMLESCAPE_H
index 1b31614..28a7abd 100644 (file)
@@ -18,6 +18,7 @@
 #include "zypp/base/PtrTypes.h"
 
 #include "zypp/parser/xml/libxmlfwd.h"
+#include "zypp/parser/xml/XmlEscape.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
diff --git a/zypp/parser/xml/xml_escape_parser.hpp b/zypp/parser/xml/xml_escape_parser.hpp
new file mode 100644 (file)
index 0000000..205d2a7
--- /dev/null
@@ -0,0 +1,37 @@
+/*\r
+IoBind Library License:\r
+--------------------------\r
+\r
+The zlib/libpng License Copyright (c) 2003 Jonathan de Halleux\r
+\r
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.\r
+\r
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:\r
+\r
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.\r
+\r
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\r
+\r
+3. This notice may not be removed or altered from any source distribution\r
+*/\r
+\r
+\r
+#ifndef IOBIND_XML_ESCAPE_PARSER_HPP\r
+#define IOBIND_XML_ESCAPE_PARSER_HPP\r
+\r
+#include<string>\r
+\r
+namespace iobind{\r
+namespace parser{\r
+\r
+       struct xml_escape_parser\r
+       {\r
+               std::string escape( std::string const&) const;\r
+               std::string unescape( std::string const&) const;\r
+       };\r
+};\r
+};//iobind\r
+\r
+#endif\r
+\r
+\r
index 205d2a7..dc21ef1 100644 (file)
@@ -1,37 +1,6 @@
-/*\r
-IoBind Library License:\r
---------------------------\r
-\r
-The zlib/libpng License Copyright (c) 2003 Jonathan de Halleux\r
-\r
-This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.\r
-\r
-Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:\r
-\r
-1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.\r
-\r
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\r
-\r
-3. This notice may not be removed or altered from any source distribution\r
-*/\r
-\r
-\r
-#ifndef IOBIND_XML_ESCAPE_PARSER_HPP\r
-#define IOBIND_XML_ESCAPE_PARSER_HPP\r
-\r
-#include<string>\r
-\r
-namespace iobind{\r
-namespace parser{\r
-\r
-       struct xml_escape_parser\r
-       {\r
-               std::string escape( std::string const&) const;\r
-               std::string unescape( std::string const&) const;\r
-       };\r
-};\r
-};//iobind\r
-\r
-#endif\r
-\r
-\r
+
+#warning DEPRECATED INCLUDE: include zypp/parser/xml/XmlEscape.h instead
+#warning ....................Consider using zypp::xml::escape instead of
+#warning ....................iobind::parser::xml_escape_parser to become
+#warning ....................implementation independent.
+#include <zypp/parser/xml/XmlEscape.h>
diff --git a/zypp/parser/xml_parser_assert.h b/zypp/parser/xml_parser_assert.h
deleted file mode 100644 (file)
index 646d9fa..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*---------------------------------------------------------------------\
-|                          ____ _   __ __ ___                          |
-|                         |__  / \ / / . \ . \                         |
-|                           / / \ V /|  _/  _/                         |
-|                          / /__ | | | | | |                           |
-|                         /_____||_| |_| |_|                           |
-|                                                                      |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/xml_parser_assert.h
- *
-*/
-
-
-#ifndef xml_parser_assert_h
-#define xml_parser_assert_h
-
-#include "zypp/base/Exception.h"
-
-#define xml_assert(ptr)                        \
-  if (! ptr)                           \
-    ZYPP_THROW(Exception("XML parser error: null pointer check failed"))
-
-
-#endif