libzypp 17.38.15

zypp::Arch Class Reference

Architecture. More...

`#include <zypp/Arch.h>`

## Classes
struct | CompatEntry
| Holds an architecture ID and its compatible relation. More...

## Public Member Functions
| Arch ()
| Default ctor Arc_noarch.
| Arch (IdString::IdType id_r)
| Ctor taking Arch as string.
| Arch (const IdString &idstr_r)
| Arch (const std::string &str_r)
| Arch (const char *cstr_r)

## Static Public Member Functions
static Arch | detectSystemArchitecture ()
| Determine system architecture evaluating `uname` and `/proc/cpuinfo`.

## IdStringType like interface.
We can't use the complete IdStringType mixin until _doCompare can be redefined on any level, not just as char*.
using | CompatSet = std::set<Arch, CompareByGT<Arch>>
| Reversed arch order, best Arch first.
const CompatEntry * | _entry
IdString | idStr () const
| String representation of Arch.
const std::string & | asString () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const char * | c_str () const
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool | empty () const
| Test for an empty Arch (this is Arch_epmty, not Arch_noarch ).
unsigned | size () const
| Size of the string representation.
IdString::IdType | id () const
| Expert backdoor.
bool | isBuiltIn () const
| Whether this is a buitin (or known) architecture.
bool | compatibleWith (const Arch &targetArch_r) const
| Compatibility relation.
Arch | baseArch () const
int | compare (const Arch &rhs) const
| Arch comparison.
static Arch | baseArch (const Arch &targetArch_r)
static int | compare (const Arch &lhs, const Arch &rhs)
| Arch comparison (static version).
static CompatSet | compatSet (const Arch &targetArch_r)
| Return a set of all Arch's compatibleWith a targetArch_r.
static std::string | asString (const CompatSet &cset)
| Arch (const CompatEntry &)

## Detailed Description

Architecture.

Definition at line 36 of file Arch.h.

## Member Typedef Documentation

## ◆ CompatSet

using zypp::Arch::CompatSet = std::set<Arch, CompareByGT<Arch>>

Reversed arch order, best Arch first.

Definition at line 122 of file Arch.h.

## Constructor & Destructor Documentation

## ◆ Arch() [1/6]

zypp::Arch::Arch | ( |  | ) |

Default ctor Arc_noarch.

Definition at line 681 of file Arch.cc.

## ◆ Arch() [2/6]

zypp::Arch::Arch | ( | IdString::IdType | id_r | ) |
| explicit

Ctor taking Arch as string.

Definition at line 685 of file Arch.cc.

## ◆ Arch() [3/6]

zypp::Arch::Arch | ( | const IdString & | idstr_r | ) |
| explicit

Definition at line 689 of file Arch.cc.

## ◆ Arch() [4/6]

zypp::Arch::Arch | ( | const std::string & | str_r | ) |
| explicit

Definition at line 693 of file Arch.cc.

## ◆ Arch() [5/6]

zypp::Arch::Arch | ( | const char * | cstr_r | ) |
| explicit

Definition at line 697 of file Arch.cc.

## ◆ Arch() [6/6]

zypp::Arch::Arch | ( | const CompatEntry & | rhs | ) |
| private

Definition at line 707 of file Arch.cc.

## Member Function Documentation

## ◆ detectSystemArchitecture()

Arch zypp::Arch::detectSystemArchitecture | ( |  | ) |
| static

Determine system architecture evaluating `uname` and `/proc/cpuinfo`.

Definition at line 701 of file Arch.cc.

## ◆ idStr()

IdString zypp::Arch::idStr | ( |  | ) | const

String representation of Arch.

Definition at line 716 of file Arch.cc.

## ◆ asString() [1/2]

const std::string & zypp::Arch::asString | ( |  | ) | const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 724 of file Arch.cc.

## ◆ c_str()

const char * zypp::Arch::c_str | ( |  | ) | const
| inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 64 of file Arch.h.

## ◆ empty()

bool zypp::Arch::empty | ( |  | ) | const
| inline

Test for an empty Arch (this is Arch_epmty, not Arch_noarch ).

Definition at line 68 of file Arch.h.

## ◆ size()

unsigned zypp::Arch::size | ( |  | ) | const
| inline

Size of the string representation.

Definition at line 72 of file Arch.h.

## ◆ id()

IdString::IdType zypp::Arch::id | ( |  | ) | const
| inline

Expert backdoor.

Definition at line 76 of file Arch.h.

## ◆ isBuiltIn()

bool zypp::Arch::isBuiltIn | ( |  | ) | const

Whether this is a buitin (or known) architecture.

Used e.g. in Capability to determine whether some trailing `".string"` is part ot the name or restriction to an architecture.

Definition at line 732 of file Arch.cc.

## ◆ compatibleWith()

bool zypp::Arch::compatibleWith | ( | const Arch & | targetArch_r | ) | const

Compatibility relation.

Returns
  `True` iff `this` is compatible with targetArch_r.
  Arch_noarch.compatibleWith( ... ) ==> always true;
  Arch_i686.compatibleWith( Arch_x86_64 ) ==> true;
  Arch_x86_64.compatibleWith( Arch_i686 ) ==> false;

Definition at line 740 of file Arch.cc.

## ◆ baseArch() [1/2]

Arch zypp::Arch::baseArch | ( |  | ) | const

Returns
  the arch before noarch if it's not a multilib arch (e.g. x86_64,sparc64v,sparc64,ppc64,s390x).

Definition at line 748 of file Arch.cc.

## ◆ baseArch() [2/2]

Arch zypp::Arch::baseArch | ( | const Arch & | targetArch_r | ) |
| inline static

Definition at line 106 of file Arch.h.

## ◆ compare() [1/2]

int zypp::Arch::compare | ( | const Arch & | rhs | ) | const

Arch comparison.

Compatible architectures are treated as `less` (i.e. i686>i386>noarch). So `Arch_noarch` is the least Arch. Equivalent architectures (compatible in both directions) are ordered arbitrary.

Definition at line 785 of file Arch.cc.

## ◆ compare() [2/2]

int zypp::Arch::compare | ( | const Arch & | lhs,
|  | const Arch & | rhs )
| inline static

Arch comparison (static version).

Definition at line 117 of file Arch.h.

## ◆ compatSet()

Arch::CompatSet zypp::Arch::compatSet | ( | const Arch & | targetArch_r | ) |
| static

Return a set of all Arch's compatibleWith a targetArch_r.

Note
  The set is ordered according to compare, thus iterating will start at targetArch_r and end with `Arch_noarch`.
  Arch::CompatSet cset( Arch::compatSet( Arch_x86_64 ) );
  cout << str::join( make_transform_iterator( cset.begin(), std::mem_fn(&Arch::asString) ),
  make_transform_iterator( cset.end(), std::mem_fn(&Arch::asString) ) )
  << endl;
  // Prints: x86_64 athlon i686 i586 i486 i386 noarch
  zypp::Arch::compatSet
  static CompatSet compatSet(const Arch &targetArch_r)
  Return a set of all Arch's compatibleWith a targetArch_r.
  Definition Arch.cc:793
  zypp::Arch::asString
  const std::string & asString() const
  This is an overloaded member function, provided for convenience. It differs from the above function o...
  Definition Arch.cc:724
  zypp::Arch::CompatSet
  std::set< Arch, CompareByGT< Arch > > CompatSet
  Reversed arch order, best Arch first.
  Definition Arch.h:122
  zypp::str::join
  std::string join(TIterator begin, TIterator end, const C_Str &sep_r=" ")
  Join strings using separator sep_r (defaults to BLANK).
  Definition String.h:846

Definition at line 793 of file Arch.cc.

## ◆ asString() [2/2]

std::string zypp::Arch::asString | ( | const CompatSet & | cset | ) |
| inline static

Definition at line 140 of file Arch.h.

## Member Data Documentation

## ◆ _entry

const CompatEntry* zypp::Arch::_entry
| private

Definition at line 153 of file Arch.h.

The documentation for this class was generated from the following files:

- zypp/Arch.h
- zypp/Arch.cc