- Changed class Dependency to behave as map<Dep,CapSet>
authorMichael Andres <ma@suse.de>
Wed, 25 Jan 2006 00:00:21 +0000 (00:00 +0000)
committerMichael Andres <ma@suse.de>
Wed, 25 Jan 2006 00:00:21 +0000 (00:00 +0000)
- Changed class Resolvable: Acess to dependency CapSets now via
const CapSet & Resolvable::dep( Dep which_r ) const;
- adapted everything below zypp/ to the changes above.

15 files changed:
devel/devel.ma/Main.cc
zypp/Dep.cc
zypp/Dep.h
zypp/Dependencies.cc
zypp/Dependencies.h
zypp/Resolvable.cc
zypp/Resolvable.h
zypp/detail/ResolvableImpl.h
zypp/solver/temporary/Package.cc
zypp/solver/temporary/ResItem.h
zypp/solver/temporary/XmlParser.cc
zypp/source/susetags/PackagesParser.cc
zypp/source/yum/YUMSourceImpl.cc
zypp/target/rpm/RpmDb.cc
zypp/target/store/serialize.cc

index 6c2341f4d815ab9bc57f8d3799933079cf66cec4..a63484981d80770208b0d1f9827a9de9189510df 100644 (file)
@@ -10,6 +10,7 @@
 #include <zypp/base/Exception.h>
 #include <zypp/base/PtrTypes.h>
 #include <zypp/base/Iterator.h>
+#include <zypp/base/Algorithm.h>
 
 #include <zypp/PathInfo.h>
 #include <zypp/SourceFactory.h>
@@ -193,8 +194,8 @@ namespace zypp
 
       bool operator()( ResObject::constPtr p ) const
       {
-        return(    make_filter_begin( ByIndex(_index), p->provides() )
-                != make_filter_end( ByIndex(_index), p->provides() ) );
+        return(    make_filter_begin( ByIndex(_index), p->dep( Dep::PROVIDES ) )
+                != make_filter_end( ByIndex(_index), p->dep( Dep::PROVIDES ) ) );
       }
 
       std::string _index;
@@ -209,8 +210,8 @@ namespace zypp
 
       bool operator()( ResObject::constPtr p ) const
       {
-        return(    make_filter_begin( ByIndex(_index), p->requires() )
-                != make_filter_end( ByIndex(_index), p->requires() ) );
+        return(    make_filter_begin( ByIndex(_index), p->dep( Dep::REQUIRES ) )
+                != make_filter_end( ByIndex(_index), p->dep( Dep::REQUIRES ) ) );
       }
 
       std::string _index;
index 44c9ef5aae0309421b2cd747bdbce22f57a898c1..53989ea9bc0c8a50bbe5bd6e36a9d8b252421456 100644 (file)
@@ -30,18 +30,18 @@ namespace zypp
       if ( _table.empty() )
         {
           // initialize it
-          _table["PROVIDES"]    = Dep::PROVIDES_e;
-          _table["PREREQUIRES"] = Dep::PREREQUIRES_e;
-          _table["REQUIRES"]    = Dep::REQUIRES_e;
-          _table["CONFLICTS"]   = Dep::CONFLICTS_e;
-          _table["OBSOLETES"]   = Dep::OBSOLETES_e;
-          _table["RECOMMENDS"]  = Dep::RECOMMENDS_e;
-          _table["SUGGESTS"]    = Dep::SUGGESTS_e;
-          _table["FRESHENS"]    = Dep::FRESHENS_e;
+          _table["provides"]    = Dep::PROVIDES_e;
+          _table["prerequires"] = Dep::PREREQUIRES_e;
+          _table["requires"]    = Dep::REQUIRES_e;
+          _table["conflicts"]   = Dep::CONFLICTS_e;
+          _table["obsoletes"]   = Dep::OBSOLETES_e;
+          _table["recommends"]  = Dep::RECOMMENDS_e;
+          _table["suggests"]    = Dep::SUGGESTS_e;
+          _table["freshens"]    = Dep::FRESHENS_e;
         }
 
       std::map<std::string,Dep::for_use_in_switch>::const_iterator it
-      = _table.find( str::toUpper( strval_r ) );
+      = _table.find( str::toLower( strval_r ) );
       if ( it == _table.end() )
         {
           ZYPP_THROW( Exception("Dep parse: illegal string value '"+strval_r+"'") );
@@ -81,14 +81,14 @@ namespace zypp
     if ( _table.empty() )
       {
         // initialize it
-        _table[PROVIDES_e]    = "PROVIDES";
-        _table[PREREQUIRES_e] = "PREREQUIRES";
-        _table[REQUIRES_e]    = "REQUIRES";
-        _table[CONFLICTS_e]   = "CONFLICTS";
-        _table[OBSOLETES_e]   = "OBSOLETES";
-        _table[RECOMMENDS_e]  = "RECOMMENDS";
-        _table[SUGGESTS_e]    = "SUGGESTS";
-        _table[FRESHENS_e]    = "FRESHENS";
+        _table[PROVIDES_e]    = "provides";
+        _table[PREREQUIRES_e] = "prerequires";
+        _table[REQUIRES_e]    = "requires";
+        _table[CONFLICTS_e]   = "conflicts";
+        _table[OBSOLETES_e]   = "obsoletes";
+        _table[RECOMMENDS_e]  = "recommends";
+        _table[SUGGESTS_e]    = "suggests";
+        _table[FRESHENS_e]    = "freshens";
       }
     return _table[_type];
   }
index c5c55809c9aa70c0f9c690b96b0c1fdc54a9f6eb..0eb055aa926bdf03562cbef8f72afb42d919468e 100644 (file)
@@ -30,6 +30,8 @@ namespace zypp
   {
     friend bool operator==( const Dep & lhs, const Dep & rhs );
     friend bool operator!=( const Dep & lhs, const Dep & rhs );
+    /** Arbitrary order to allow Dep as key in std::container. */
+    friend bool operator<( const Dep & lhs, const Dep & rhs );
 
     /** \name Dependency types
      * These are the \em real dependency type contants to
@@ -71,8 +73,8 @@ namespace zypp
     explicit
     Dep( const std::string & strval_r );
 
-    /** String representation of dependency type operator.
-     * \return The constants names.
+    /** String representation of dependency type.
+     * \return The constants names lowercased.
     */
     const std::string & asString() const;
 
@@ -104,6 +106,10 @@ namespace zypp
   inline bool operator!=( const Dep & lhs, const Dep & rhs )
   { return lhs._type != rhs._type; }
 
+  /** \relates Dep */
+  inline bool operator<( const Dep & lhs, const Dep & rhs )
+  { return lhs._type < rhs._type; }
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index 806be8008fe12b10684886c01921db2d7f9dc819..6f5a7b9333edbf15f73efb45e789b5cf61e6890f 100644 (file)
@@ -28,22 +28,22 @@ namespace zypp
   std::ostream & operator<<( std::ostream & str, const Dependencies & obj )
   {
     str << "Dependencies: [" << endl;
-    if ( ! obj.provides.empty() )
-      str << "PROVIDES:" << endl << obj.provides;
-    if ( ! obj.prerequires.empty() )
-      str << "PREREQUIRES:" << endl << obj.prerequires;
-    if ( ! obj.requires.empty() )
-      str << "REQUIRES:" << endl << obj.requires;
-    if ( ! obj.conflicts.empty() )
-      str << "CONFLICTS:" << endl << obj.conflicts;
-    if ( ! obj.obsoletes.empty() )
-      str << "OBSOLETES:" << endl << obj.obsoletes;
-    if ( ! obj.recommends.empty() )
-      str << "RECOMMENDS:" << endl << obj.recommends;
-    if ( ! obj.suggests.empty() )
-      str << "SUGGESTS:" << endl << obj.suggests;
-    if ( ! obj.freshens.empty() )
-      str << "FRESHENS:" << endl << obj.freshens;
+    if ( ! obj[Dep::PROVIDES].empty() )
+      str << "PROVIDES:" << endl << obj[Dep::PROVIDES];
+    if ( ! obj[Dep::PREREQUIRES].empty() )
+      str << "PREREQUIRES:" << endl << obj[Dep::PREREQUIRES];
+    if ( ! obj[Dep::REQUIRES].empty() )
+      str << "REQUIRES:" << endl << obj[Dep::REQUIRES];
+    if ( ! obj[Dep::CONFLICTS].empty() )
+      str << "CONFLICTS:" << endl << obj[Dep::CONFLICTS];
+    if ( ! obj[Dep::OBSOLETES].empty() )
+      str << "OBSOLETES:" << endl << obj[Dep::OBSOLETES];
+    if ( ! obj[Dep::RECOMMENDS].empty() )
+      str << "RECOMMENDS:" << endl << obj[Dep::RECOMMENDS];
+    if ( ! obj[Dep::SUGGESTS].empty() )
+      str << "SUGGESTS:" << endl << obj[Dep::SUGGESTS];
+    if ( ! obj[Dep::FRESHENS].empty() )
+      str << "FRESHENS:" << endl << obj[Dep::FRESHENS];
     return str << "]";
   }
 
index c85f4569989c384787c1c2006361d518f8e8487e..118ae52db8cffee2da9d95528c2e17b5b50b94da 100644 (file)
@@ -13,9 +13,9 @@
 #define ZYPP_DEPENDENCIES_H
 
 #include <iosfwd>
+#include <map>
 
 #include "zypp/Dep.h"
-#include "zypp/CapSetFwd.h"
 #include "zypp/CapSet.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -30,22 +30,14 @@ namespace zypp
   */
   struct Dependencies
   {
-    /**  */
-    CapSet provides;
-    /**  */
-    CapSet prerequires;
-    /**  */
-    CapSet requires;
-    /**  */
-    CapSet conflicts;
-    /**  */
-    CapSet obsoletes;
-    /**  */
-    CapSet recommends;
-    /**  */
-    CapSet suggests;
-    /**  */
-    CapSet freshens;
+    CapSet & operator[]( Dep idx_r )
+    { return _capsets[idx_r]; }
+
+    const CapSet & operator[]( Dep idx_r ) const
+    { return const_cast<std::map<Dep,CapSet>&>(_capsets)[idx_r]; }
+
+  private:
+    std::map<Dep,CapSet> _capsets;
   };
   ///////////////////////////////////////////////////////////////////
 
index 60904fddaca93045eea7a8d838c7f27fa133e839..22f5c36ccb4a300139a0dc5d368a8fda6c500a3b 100644 (file)
@@ -67,29 +67,8 @@ namespace zypp
   const Arch & Resolvable::arch() const
   { return _pimpl->arch(); }
 
-  const CapSet & Resolvable::provides() const
-  { return _pimpl->deps().provides; }
-
-  const CapSet & Resolvable::prerequires() const
-  { return _pimpl->deps().prerequires; }
-
-  const CapSet & Resolvable::requires() const
-  { return _pimpl->deps().requires; }
-
-  const CapSet & Resolvable::conflicts() const
-  { return _pimpl->deps().conflicts; }
-
-  const CapSet & Resolvable::obsoletes() const
-  { return _pimpl->deps().obsoletes; }
-
-  const CapSet & Resolvable::recommends() const
-  { return _pimpl->deps().recommends; }
-
-  const CapSet & Resolvable::suggests() const
-  { return _pimpl->deps().suggests; }
-
-  const CapSet & Resolvable::freshens() const
-  { return _pimpl->deps().freshens; }
+  const CapSet & Resolvable::dep( Dep which_r ) const
+  { return _pimpl->deps()[which_r]; }
 
   const Dependencies & Resolvable::deps() const
   { return _pimpl->deps(); }
index bb4046c3bedbd85edbea7d8df94f06680b9c6a32..45045c6ce8469eee239479073d1fa187b75385b1 100644 (file)
@@ -23,6 +23,7 @@
 #include "zypp/Edition.h"
 #include "zypp/Arch.h"
 #include "zypp/CapSetFwd.h"
+#include "zypp/Dep.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -60,14 +61,8 @@ namespace zypp
 
     /** \name Dependencies. */
     //@{
-    const CapSet & provides() const;
-    const CapSet & prerequires() const;
-    const CapSet & requires() const;
-    const CapSet & conflicts() const;
-    const CapSet & obsoletes() const;
-    const CapSet & recommends() const;
-    const CapSet & suggests() const;
-    const CapSet & freshens() const;
+    /** Select by Dep. */
+    const CapSet & dep( Dep which_r ) const;
     /** All dependencies. */
     const Dependencies & deps() const;
     //@}
index c9ed1fea3aab63b24404e85136f4c9f9f55bb612..f507e6d5fb5ff0521b37fa0480ebb95b230ee7f4 100644 (file)
@@ -40,11 +40,11 @@ namespace zypp
     , _deps( nvrad_r )
     {
       // assert self provides
-      _deps.provides.insert( CapFactory()
+      _deps[Dep::PROVIDES].insert( CapFactory()
                              .parse( _kind, _name, Rel::EQ, _edition ) );
       // assert all prerequires are in requires too
-      _deps.requires.insert( _deps.prerequires.begin(),
-                             _deps.prerequires.end() );
+      _deps[Dep::REQUIRES].insert( _deps[Dep::PREREQUIRES].begin(),
+                                   _deps[Dep::PREREQUIRES].end() );
     }
 
   public:
@@ -70,16 +70,16 @@ namespace zypp
     {
       _deps = val_r;
       // assert self provides
-      _deps.provides.insert( CapFactory()
+      _deps[Dep::PROVIDES].insert( CapFactory()
                              .parse( _kind, _name, Rel::EQ, _edition ) );
       // assert all prerequires are in requires too
-      _deps.requires.insert( _deps.prerequires.begin(),
-                             _deps.prerequires.end() );
+      _deps[Dep::REQUIRES].insert( _deps[Dep::PREREQUIRES].begin(),
+                                   _deps[Dep::PREREQUIRES].end() );
     }
     void injectProvides( const Capability & cap_r )
-    { _deps.provides.insert( cap_r ); }
+    { _deps[Dep::PROVIDES].insert( cap_r ); }
     void injectRequires( const Capability & cap_r )
-    { _deps.requires.insert( cap_r ); }
+    { _deps[Dep::REQUIRES].insert( cap_r ); }
     //@}
 
   private:
index cbb9b1e33532a7efa236c9c167a63f39e285c7da..31af4a7ec7d120f7acd1f76d5a3aac2aa0e6d08f 100644 (file)
@@ -433,12 +433,12 @@ Package::Package (XmlNode_constPtr node, Channel_constPtr channel, const Resolva
     }
 
     Dependencies deps;
-    deps.requires          = dep_table.requires;
-    deps.provides          = dep_table.provides;
-    deps.conflicts         = dep_table.conflicts;
-    deps.obsoletes         = dep_table.obsoletes;
-    deps.suggests          = dep_table.suggests;
-    deps.recommends        = dep_table.recommends;
+    deps[Dep::REQUIRES]          = dep_table.requires;
+    deps[Dep::PROVIDES]          = dep_table.provides;
+    deps[Dep::CONFLICTS]         = dep_table.conflicts;
+    deps[Dep::OBSOLETES]         = dep_table.obsoletes;
+    deps[Dep::SUGGESTS]          = dep_table.suggests;
+    deps[Dep::RECOMMENDS]        = dep_table.recommends;
     deprecatedSetDependencies (deps);
 
     if (!_history.empty()) {
@@ -462,7 +462,7 @@ Package::Package (XmlNode_constPtr node, Channel_constPtr channel, const Resolva
             for (CapSet::const_iterator iter = provides().begin(); iter != provides().end(); iter++) {
                std::string capString = (*iter).asString();
                std::string cmpString = name + " == ";
-               string::size_type ret = capString.find (cmpString);             
+               string::size_type ret = capString.find (cmpString);
                if (ret != string::npos)
                {
                    Edition edition = Edition(capString.substr (cmpString.length()));
index babff214535ea3e4678e31cf59e8e8e8b2b1b858..14ca69aabcd9d2f11eb264fb61649ba09d597ac0 100644 (file)
@@ -129,14 +129,14 @@ class ResItem : public base::ReferenceCounted, private base::NonCopyable {
     size_t installedSize() const { return _installed_size; }
     void setInstalledSize (size_t installed_size) { _installed_size = installed_size; }
 
-    const CapSet & requires() const { return _resObject->requires(); }
-    const CapSet & prerequires() const { return _resObject->prerequires(); }
-    const CapSet & provides() const { return _resObject->provides(); }
-    const CapSet & conflicts() const { return _resObject->conflicts(); }
-    const CapSet & obsoletes() const { return _resObject->obsoletes(); }
-    const CapSet & suggests() const { return _resObject->suggests(); }
-    const CapSet & recommends() const { return _resObject->recommends(); }
-    const CapSet & freshens() const { return _resObject->freshens(); }
+    const CapSet & requires() const { return _resObject->dep( Dep::REQUIRES ); }
+    const CapSet & prerequires() const { return _resObject->dep( Dep::PREREQUIRES ); }
+    const CapSet & provides() const { return _resObject->dep( Dep::PROVIDES ); }
+    const CapSet & conflicts() const { return _resObject->dep( Dep::CONFLICTS ); }
+    const CapSet & obsoletes() const { return _resObject->dep( Dep::OBSOLETES ); }
+    const CapSet & suggests() const { return _resObject->dep( Dep::SUGGESTS ); }
+    const CapSet & recommends() const { return _resObject->dep( Dep::RECOMMENDS ); }
+    const CapSet & freshens() const { return _resObject->dep( Dep::FRESHENS ); }
 
     void deprecatedSetDependencies (const Dependencies & dependencies) { _resObject->deprecatedSetDeps(dependencies); }
 
index 9d0d198189431bc9e125753d930fe007b509726d..7de551f61cb78c035227dd1af880d13a5f747601 100644 (file)
@@ -621,7 +621,7 @@ XmlParser::resolvableEnd (const std::string & name)
                else
                {
                    if (update->edition() < (*iter)->edition())
-                       update = *iter;                 
+                       update = *iter;
                }
            }
        }
@@ -632,13 +632,13 @@ XmlParser::resolvableEnd (const std::string & name)
            _current_resitem_edition = update->edition();
            _current_resitem_fileSize = update->packageSize();
            _current_resitem_installedSize = update->installedSize();
-           _current_resitem_arch = update->arch();      
+           _current_resitem_arch = update->arch();
        }
        else {
            for (CapSet::const_iterator iter = _current_provides.begin(); iter != _current_provides.end(); iter++) {
                std::string capString = (*iter).asString();
                std::string cmpString = _current_resitem_name + " == ";
-               string::size_type ret = capString.find (cmpString);             
+               string::size_type ret = capString.find (cmpString);
                if (ret != string::npos)
                {
                    string editionStr = capString.substr (cmpString.length());
@@ -679,13 +679,13 @@ XmlParser::resolvableEnd (const std::string & name)
            package->setInstalled (true);
 
        Dependencies deps;
-       deps.requires           = _current_requires;
-       deps.provides           = _current_provides;
-       deps.conflicts          = _current_conflicts;
-       deps.obsoletes          = _current_obsoletes;
-       deps.suggests           = _current_suggests;
-       deps.recommends         = _current_recommends;
-       deps.freshens           = _current_freshens;
+       deps[Dep::REQUIRES]             = _current_requires;
+       deps[Dep::PROVIDES]             = _current_provides;
+       deps[Dep::CONFLICTS]            = _current_conflicts;
+       deps[Dep::OBSOLETES]            = _current_obsoletes;
+       deps[Dep::SUGGESTS]             = _current_suggests;
+       deps[Dep::RECOMMENDS]           = _current_recommends;
+       deps[Dep::FRESHENS]             = _current_freshens;
        package->deprecatedSetDependencies  (deps);
        package->setPrettyName    (_current_resitem_prettyName);
        package->setSummary       (_current_resitem_summary);
index a09b7fcdc300c08e42513032ef4446f08f64a74f..61e8899ee9c7650d7b091775fe5444194f8d2770 100644 (file)
@@ -92,23 +92,23 @@ namespace zypp
 
           if ( mtag_r.stag.isPlain( "Prv" ) )
             {
-              collectDeps( mtag_r.value, nvrad.provides );
+              collectDeps( mtag_r.value, nvrad[Dep::PROVIDES] );
             }
           else if ( mtag_r.stag.isPlain( "Prq" ) )
             {
-              collectDeps( mtag_r.value, nvrad.prerequires );
+              collectDeps( mtag_r.value, nvrad[Dep::PREREQUIRES] );
             }
           else if ( mtag_r.stag.isPlain( "Req" ) )
             {
-              collectDeps( mtag_r.value, nvrad.requires );
+              collectDeps( mtag_r.value, nvrad[Dep::REQUIRES] );
             }
           else if ( mtag_r.stag.isPlain( "Con" ) )
             {
-              collectDeps( mtag_r.value, nvrad.conflicts );
+              collectDeps( mtag_r.value, nvrad[Dep::CONFLICTS] );
             }
           else if ( mtag_r.stag.isPlain( "Obs" ) )
             {
-              collectDeps( mtag_r.value, nvrad.obsoletes );
+              collectDeps( mtag_r.value, nvrad[Dep::OBSOLETES] );
             }
         }
 
index b55347619769d275791c29e844d5868e1daaf9b8..a554fc1fd723e0810b91f7a97e2638acbf2d8abf 100644 (file)
@@ -547,28 +547,28 @@ namespace zypp
               it != parsed.provides.end();
               it++)
          {
-           _deps.provides.insert(createCapability(*it, my_kind));
+           _deps[Dep::PROVIDES].insert(createCapability(*it, my_kind));
          }
 
          for (std::list<YUMDependency>::const_iterator it = parsed.conflicts.begin();
               it != parsed.conflicts.end();
               it++)
          {
-           _deps.conflicts.insert(createCapability(*it, my_kind));
+           _deps[Dep::CONFLICTS].insert(createCapability(*it, my_kind));
          }
 
          for (std::list<YUMDependency>::const_iterator it = parsed.obsoletes.begin();
               it != parsed.obsoletes.end();
               it++)
          {
-           _deps.obsoletes.insert(createCapability(*it, my_kind));
+           _deps[Dep::OBSOLETES].insert(createCapability(*it, my_kind));
          }
 
          for (std::list<YUMDependency>::const_iterator it = parsed.freshen.begin();
               it != parsed.freshen.end();
               it++)
          {
-           _deps.freshens.insert(createCapability(*it, my_kind));
+           _deps[Dep::FRESHENS].insert(createCapability(*it, my_kind));
          }
 
          for (std::list<YUMDependency>::const_iterator it = parsed.requires.begin();
@@ -576,9 +576,9 @@ namespace zypp
               it++)
          {
            if (it->pre == "1")
-             _deps.prerequires.insert(createCapability(*it, my_kind));
+             _deps[Dep::PREREQUIRES].insert(createCapability(*it, my_kind));
            else
-             _deps.requires.insert(createCapability(*it, my_kind));
+             _deps[Dep::REQUIRES].insert(createCapability(*it, my_kind));
          }
 
          return _deps;
@@ -596,7 +596,7 @@ namespace zypp
          {
            if (it->type == "mandatory" || it->type == "")
            {
-             _deps.requires.insert(createCapability(YUMDependency(
+             _deps[Dep::REQUIRES].insert(createCapability(YUMDependency(
                  "",
                  it->name,
                  "EQ",
@@ -614,7 +614,7 @@ namespace zypp
          {
            if (it->type == "mandatory" || it->type == "")
            {
-             _deps.requires.insert(createCapability(YUMDependency(
+             _deps[Dep::REQUIRES].insert(createCapability(YUMDependency(
                  "",
                  it->name,
                  "",
@@ -641,7 +641,7 @@ namespace zypp
          {
            if (it->type == "mandatory" || it->type == "")
            {
-             _deps.requires.insert(createCapability(YUMDependency(
+             _deps[Dep::REQUIRES].insert(createCapability(YUMDependency(
                  "",
                  it->name,
                  "EQ",
@@ -659,7 +659,7 @@ namespace zypp
          {
            if (it->type == "mandatory" || it->type == "")
            {
-             _deps.requires.insert(createCapability(YUMDependency(
+             _deps[Dep::REQUIRES].insert(createCapability(YUMDependency(
                  "",
                  it->name,
                  "",
@@ -680,7 +680,7 @@ namespace zypp
          CapFactory _f;
          Resolvable::Kind _kind = dep.kind == "" ? my_kind : Resolvable::Kind(dep.kind);
          Capability cap;
-    if ( ! dep.isEncoded() ) 
+    if ( ! dep.isEncoded() )
     {
       cap = _f.parse(
            _kind,
index 5ea9df277040ab79fe5f641e31f13c2b4ce97fb2..73194c95276591038068d0838a622e05b9738dc8 100644 (file)
@@ -1077,7 +1077,7 @@ This prevented from having packages multiple times
                        arch );
 
     list<string> filenames = impl->filenames();
-    dataCollect.provides = iter->tag_provides ( & _filerequires );
+    dataCollect[Dep::PROVIDES] = iter->tag_provides ( & _filerequires );
     for (list<string>::const_iterator filename = filenames.begin();
          filename != filenames.end();
          filename++)
@@ -1093,7 +1093,7 @@ This prevented from having packages multiple times
         || filename->find("/opt/gnome/games"))
       {
        try {
-         dataCollect.provides.insert(_f.parse(ResTraits<Package>::kind, *filename));
+         dataCollect[Dep::PROVIDES].insert(_f.parse(ResTraits<Package>::kind, *filename));
        }
        catch (Exception & excpt_r)
        {
@@ -1103,10 +1103,10 @@ This prevented from having packages multiple times
       }
     }
 
-    dataCollect.requires    = iter->tag_requires ( &_filerequires );
-    dataCollect.prerequires = iter->tag_prerequires ( &_filerequires );
-    dataCollect.conflicts   = iter->tag_conflicts( &_filerequires );
-    dataCollect.obsoletes   = iter->tag_obsoletes( &_filerequires );
+    dataCollect[Dep::REQUIRES]    = iter->tag_requires ( &_filerequires );
+    dataCollect[Dep::PREREQUIRES] = iter->tag_prerequires ( &_filerequires );
+    dataCollect[Dep::CONFLICTS]   = iter->tag_conflicts( &_filerequires );
+    dataCollect[Dep::OBSOLETES]   = iter->tag_obsoletes( &_filerequires );
 
     // create package from dataprovider
     Package::Ptr nptr = detail::makeResolvableFromImpl( dataCollect, impl );
index da698e265ca64a547955148df5b37d7d4b19fa7e..ed04b90e48b74b5e85c246b2ee615f3f1e0f4961 100644 (file)
@@ -38,7 +38,7 @@ std::string xml_tag_enclose( const std::string &text, const std::string &tag, bo
 {
   std::string result;
   result += "<" + tag + ">";
-  
+
   if ( escape)
    result += xml_escape(text);
   else
@@ -73,7 +73,7 @@ std::string toXML( const Capability &cap )
 {
   stringstream out;
   CapFactory factory;
-  
+
   out << "<entry kind=\"" << cap.refers() << "\" >" <<  xml_escape(factory.encode(cap)) << "</entry>";
   return out.str();
 }
@@ -87,39 +87,39 @@ std::string toXML( const CapSet &caps )
   {
     out << toXML((*it));
   }
-  return out.str(); 
+  return out.str();
 }
 
 template<> // or constPtr?
 std::string toXML( const Dependencies &dep )
 {
   stringstream out;
-  if ( dep.provides.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.provides), "provides") << std::endl;
-  if ( dep.prerequires.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.prerequires), "prerequires") << std::endl;
-  if ( dep.requires.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.requires), "requires") << std::endl;
-  if ( dep.conflicts.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.conflicts), "conflicts") << std::endl;
-   if ( dep.obsoletes.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.obsoletes), "obsoletes") << std::endl;
+  if ( dep[Dep::PROVIDES].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::PROVIDES]), "provides") << std::endl;
+  if ( dep[Dep::PREREQUIRES].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::PREREQUIRES]), "prerequires") << std::endl;
+  if ( dep[Dep::REQUIRES].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::REQUIRES]), "requires") << std::endl;
+  if ( dep[Dep::CONFLICTS].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::CONFLICTS]), "conflicts") << std::endl;
+   if ( dep[Dep::OBSOLETES].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::OBSOLETES]), "obsoletes") << std::endl;
   // why the YUM tag is freshen without s????
-   if ( dep.freshens.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.freshens), "freshen") << std::endl;
-   if ( dep.suggests.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.suggests), "suggests") << std::endl;
-   if ( dep.recommends.size() > 0 )
-    out << "    " << xml_tag_enclose(toXML(dep.recommends), "recommends") << std::endl;
+   if ( dep[Dep::FRESHENS].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::FRESHENS]), "freshen") << std::endl;
+   if ( dep[Dep::SUGGESTS].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::SUGGESTS]), "suggests") << std::endl;
+   if ( dep[Dep::RECOMMENDS].size() > 0 )
+    out << "    " << xml_tag_enclose(toXML(dep[Dep::RECOMMENDS]), "recommends") << std::endl;
   return out.str();
-  
+
 }
 
 template<> // or constPtr?
 std::string toXML( const Resolvable::constPtr &obj )
 {
   stringstream out;
-  
+
   out << "  <name>" << obj->name() << "</name>" << std::endl;
   // is this shared? uh
   out << "  " << toXML(obj->edition()) << std::endl;