Imported Upstream version 15.0.0
[platform/upstream/libzypp.git] / zypp / Arch.h
index 8f7b76f..fb2a447 100644 (file)
@@ -36,26 +36,51 @@ namespace zypp
   class Arch
   {
   public:
-    /** Default ctor 'noarch' */
+    /** Default ctor \ref Arc_noarch. */
     Arch();
-    /** Ctor from string. */
-    explicit
-    Arch( const std::string & rhs );
+
+    /** Ctor taking Arch as string. */
+    explicit Arch( IdString::IdType id_r );
+    explicit Arch( const IdString & idstr_r );
+    explicit Arch( const std::string & str_r );
+    explicit Arch( const char * cstr_r );
 
   public:
+    /** \name IdStringType like interface.
+     * We can't use the complete \ref IdStringType mixin until
+     * _doCompare can be redefined on any level, not just as char*.
+    */
+    //@{
     /** String representation of Arch. */
-    IdString idStr() const
-    { return IdString( asString() ); }
-    /** \overload */
+    IdString idStr() const;
+     /** \overload */
     const std::string & asString() const;
     /** \overload */
     const char * c_str() const
     { return asString().c_str(); }
 
-    /** Test for an empty Arch (this is "", not Arch_noarch). */
+    /** Test for an empty Arch (this is \ref Arch_epmty, not \ref Arch_noarch ). */
     bool empty() const
     { return asString().empty(); }
 
+    /** Size of the string representation. */
+    unsigned size() const
+    { return asString().size(); }
+
+    /** Expert backdoor. */
+    IdString::IdType id() const
+    { return idStr().id(); }
+    //@}
+
+  public:
+    /** Whether this is a buitin (or known) architecture.
+     * Used e.g. in \ref Capability to determine whether
+     * some trailing \c ".string" is part ot the name or
+     * restriction to an architecture.
+    */
+    bool isBuiltIn() const;
+
+  public:
     /** Compatibility relation.
      * \return \c True iff \c this is compatible with \a targetArch_r.
      * \code
@@ -66,11 +91,21 @@ namespace zypp
     */
     bool compatibleWith( const Arch & targetArch_r ) const;
 
-    /** Arch comparison.
-     * Primary key is the number of compatible Archs, then
-     * the string representation. Thus Arch_noarch is the
-     * least Arch.
+    /**
+     * \return the arch before noarch if it's not a multilib arch
+     * (e.g. x86_64,sparc64v,sparc64,ppc64,s390x).
     */
+    Arch baseArch() const;
+
+    /** \overload static version. */
+    static Arch baseArch( const Arch & targetArch_r )
+    { return targetArch_r.baseArch(); }
+
+    /** Arch comparison.
+     * Compatible architectures are treated as \c less (i.e. <tt>i686>i386>noarch</tt>).
+     * So \c Arch_noarch is the least Arch. Equivalent architectures
+     * (compatible in both directions) are ordered arbitrary.
+     */
     int compare( const Arch & rhs ) const;
 
     /** Arch comparison (static version). */
@@ -118,10 +153,23 @@ namespace zypp
    * like \c Arch::i386.
   */
   //@{
+  /** \relates Arch
+   * This is an empty \ref Arch represented by an empty string.
+   * Sometimes used to indicate an any or an unknown Arch. Don't
+   * confuse this with \ref Arch_noarch, which is in fact an
+   * architecture.
+  */
+  extern const Arch Arch_empty;
+
   /** \relates Arch */
   extern const Arch Arch_noarch;
 
   /** \relates Arch */
+  extern const Arch Arch_pentium4;
+  /** \relates Arch */
+  extern const Arch Arch_pentium3;
+
+  /** \relates Arch */
   extern const Arch Arch_x86_64;
   /** \relates Arch */
   extern const Arch Arch_athlon;
@@ -140,12 +188,83 @@ namespace zypp
   extern const Arch Arch_s390;
 
   /** \relates Arch */
+  extern const Arch Arch_ppc64le;
+
+  /** \relates Arch */
+  extern const Arch Arch_ppc64p7;
+  /** \relates Arch */
   extern const Arch Arch_ppc64;
   /** \relates Arch */
   extern const Arch Arch_ppc;
 
   /** \relates Arch */
   extern const Arch Arch_ia64;
+
+  /** \relates Arch */
+  extern const Arch Arch_alphaev67;
+  /** \relates Arch */
+  extern const Arch Arch_alphaev6;
+  /** \relates Arch */
+  extern const Arch Arch_alphapca56;
+  /** \relates Arch */
+  extern const Arch Arch_alphaev56;
+  /** \relates Arch */
+  extern const Arch Arch_alphaev5;
+  /** \relates Arch */
+  extern const Arch Arch_alpha;
+
+   /** \relates Arch */
+  extern const Arch Arch_sparc64v;
+  /** \relates Arch */
+  extern const Arch Arch_sparc64;
+  /** \relates Arch */
+  extern const Arch Arch_sparcv9v;
+  /** \relates Arch */
+  extern const Arch Arch_sparcv9;
+  /** \relates Arch */
+  extern const Arch Arch_sparcv8;
+  /** \relates Arch */
+  extern const Arch Arch_sparc;
+
+  /** \relates Arch */
+  extern const Arch Arch_aarch64;
+  /** \relates Arch */
+  extern const Arch Arch_armv7tnhl;
+  /** \relates Arch */
+  extern const Arch Arch_armv7thl;
+  /** \relates Arch */
+  extern const Arch Arch_armv7nhl;
+  /** \relates Arch */
+  extern const Arch Arch_armv7hl;
+  /** \relates Arch */
+  extern const Arch Arch_armv7l;
+  /** \relates Arch */
+  extern const Arch Arch_armv6hl;
+  /** \relates Arch */
+  extern const Arch Arch_armv6l;
+  /** \relates Arch */
+  extern const Arch Arch_armv5tejl;
+  /** \relates Arch */
+  extern const Arch Arch_armv5tel;
+  /** \relates Arch */
+  extern const Arch Arch_armv5l;
+  /** \relates Arch */
+  extern const Arch Arch_armv4tl;
+  /** \relates Arch */
+  extern const Arch Arch_armv4l;
+  /** \relates Arch */
+  extern const Arch Arch_armv3l;
+
+   /** \relates Arch */
+  extern const Arch Arch_sh3;
+
+  /** \relates Arch */
+  extern const Arch Arch_sh4;
+  /** \relates Arch */
+  extern const Arch Arch_sh4a;
+
+  /** \relates Arch */
+  extern const Arch Arch_m68k;
   //@}
 
   ///////////////////////////////////////////////////////////////////
@@ -154,6 +273,10 @@ namespace zypp
   inline std::ostream & operator<<( std::ostream & str, const Arch & obj )
   { return str << obj.asString(); }
 
+  /** \relates Arch XML output. */
+  inline std::ostream & dumpAsXmlOn( std::ostream & str, const Arch & obj )
+  { return str << "<arch>" << obj <<  "</arch>"; }
+
   /** \name Equality based on string value. */
   //@{
   /** \relates Arch */