backup
authorMichael Andres <ma@suse.de>
Thu, 17 Apr 2008 07:48:55 +0000 (07:48 +0000)
committerMichael Andres <ma@suse.de>
Thu, 17 Apr 2008 07:48:55 +0000 (07:48 +0000)
zypp/Capability.cc
zypp/Capability.h

index 99c7836..5662bab 100644 (file)
@@ -17,6 +17,7 @@
 #include "zypp/base/Gettext.h"
 #include "zypp/base/Exception.h"
 
+#include "zypp/Arch.h"
 #include "zypp/Rel.h"
 #include "zypp/Edition.h"
 #include "zypp/Capability.h"
@@ -32,11 +33,19 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace
   { /////////////////////////////////////////////////////////////////
-
     sat::detail::IdType relFromStr( ::_Pool * pool_r,
+                                    const Arch & arch_r,
                                     const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & kind_r )
     {
       sat::detail::IdType nid( sat::detail::noId );
+      return nid;
+    }
+
+    sat::detail::IdType relFromStr( ::_Pool * pool_r,
+                                    const std::string & name_r, Rel op_r, const Edition & ed_r,
+                                    const ResKind & kind_r )
+    {
+      sat::detail::IdType nid( sat::detail::noId );
       if ( ! kind_r || kind_r == ResKind::package )
       {
         nid = IdString( name_r ).id();
@@ -58,7 +67,8 @@ namespace zypp
     }
 
     sat::detail::IdType relFromStr( ::_Pool * pool_r,
-                                      const std::string & str_r, const ResKind & kind_r, Capability::CtorFlag flag_r )
+                                      const std::string & str_r, const ResKind & kind_r,
+                                      Capability::CtorFlag flag_r )
     {
       // strval_r has at least two words which could make 'op edition'?
       // improve regex!
@@ -130,6 +140,15 @@ namespace zypp
   : _id( relFromStr( myPool().getPool(), name_r, op_r, ed_r, prefix_r ) )
   {}
 
+#if 0
+  Capability::Capability( const std::string & arch_r, const std::string & name_r, const std::string & op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+  Capability::Capability( const std::string & arch_r, const std::string & name_r, Rel op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+  Capability::Capability( const std::string & arch_r, const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & prefix_r = ResKind() );
+  Capability::Capability( const Arch & arch_r, const std::string & name_r, const std::string & op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+  Capability::Capability( const Arch & arch_r, const std::string & name_r, Rel op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+  Capability::Capability( const Arch & arch_r, const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & prefix_r = ResKind() );
+#endif
+
   const char * Capability::c_str() const
   { return( _id ? ::dep2str( myPool().getPool(), _id ) : "" ); }
 
index 99d4349..a4f0b70 100644 (file)
@@ -41,8 +41,12 @@ namespace zypp
   //
   /** A sat capability.
    *
+   * A Capability: <tt>"name[.arch] [op edition]"</tt>
+   *
    * If a certain \ref ResKind is specified upon construction, the
-   * capabilities name part is prefixed accordingly:
+   * capabilities name part is prefixed accordingly. If no \ref ResKind
+   * is specified, it's assumed you refer to a package or the name is
+   * already prefixed:
    * \code
    * Capability( "foo" )                   ==> 'foo'
    * Capability( "foo", ResKind::package ) ==> 'foo'
@@ -65,9 +69,13 @@ namespace zypp
       /** Ctor from id. */
       explicit Capability( sat::detail::IdType id_r ) : _id( id_r ) {}
 
+      /** \name Ctors parsing a Capability: <tt>"name[.arch] [op edition]"</tt>
+      */
+      //@{
       /** Ctor from string.
        * \a str_r is parsed to check whether it contains an <tt>[op edition]</tt> part,
-       * unless the \ref PARSED flag is passed to the ctor.
+       * unless the \ref PARSED flag is passed to the ctor. In that case <tt>"name[.arch]"</tt>
+       * is assumed.
       */
       explicit Capability( const char * str_r, const ResKind & prefix_r = ResKind(), CtorFlag flag_r = UNPARSED );
       /** \overload */
@@ -76,13 +84,37 @@ namespace zypp
       Capability( const char * str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() );
       /** \overload */
       Capability( const std::string & str_r, CtorFlag flag_r, const ResKind & prefix_r = ResKind() );
+      //@}
 
-      /** Ctor from <tt>name op edition</tt>. */
+      /** \name Ctors parsing a broken down Capability: <tt>( "name[.arch]", op, edition )</tt>
+      */
+      //@{
+      /** Ctor from <tt>name[.arch] op edition</tt>. */
       Capability( const std::string & name_r, const std::string & op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
       /** \overload */
       Capability( const std::string & name_r, Rel op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
       /** \overload */
       Capability( const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & prefix_r = ResKind() );
+      //@}
+
+#if 0
+      /** \name Ctors taking a broken down Capability: <tt>( arch, name, op, edition )</tt>
+      */
+      //@{
+      /** Ctor from <tt>arch name op edition</tt>. */
+      Capability( const std::string & arch_r, const std::string & name_r, const std::string & op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+      /** \overload */
+      Capability( const std::string & arch_r, const std::string & name_r, Rel op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+      /** \overload */
+      Capability( const std::string & arch_r, const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & prefix_r = ResKind() );
+      /** \overload */
+      Capability( const Arch & arch_r, const std::string & name_r, const std::string & op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+      /** \overload */
+      Capability( const Arch & arch_r, const std::string & name_r, Rel op_r, const std::string & ed_r, const ResKind & prefix_r = ResKind() );
+      /** \overload */
+      Capability( const Arch & arch_r, const std::string & name_r, Rel op_r, const Edition & ed_r, const ResKind & prefix_r = ResKind() );
+      //@}
+#endif
 
     public:
       /** No or Null \ref Capability ( Id \c 0 ). */