libzypp 17.37.10

zypp::InstanceId Class Reference

Build string to identify/retrieve a specific Solvable. More...

`#include <zypp/InstanceId.h>`

## Public Member Functions
| InstanceId ()
| Default ctor empty empty namespace.
| InstanceId (std::string namespace_r)
| Ctor taking namespace.
std::string | getIdFor (sat::Solvable slv_r) const
| Solvable to InstanceId string.
std::string | getIdFor (const PoolItem &pi_r) const
| PoolItem to InstanceId string.
sat::Solvable | findSolvable (const std::string &str_r) const
| InstanceId string to Solvable.
PoolItem | findPoolItem (const std::string &str_r) const
| InstanceId string to PoolItem.
std::string | operator() (sat::Solvable slv_r) const
| Solvable to InstanceId string.
std::string | operator() (const PoolItem &pi_r) const
| PoolItem to InstanceId string.
PoolItem | operator() (const std::string &str_r) const
| InstanceId string to PoolItem.
bool | isSystemId (const std::string &str_r) const
| Quick test whether the InstanceId string would refer to a system (installed) Solvable.
const std::string & | getNamespace () const
| The namespace in use.
void | setNamespace (const std::string &namespace_r)
| Set a new namespace.
void | unsetNamespace ()
| Set no (empty) namespace.

## Private Attributes
std::string | _namespace

## Detailed Description

Build string to identify/retrieve a specific Solvable.

"[<namespace>:]<name>-<version>-<release>.<arch>@<repoalias>"

Any namespace that prepends the InstanceIds must be passed to the ctor. Conversion to/from instanceId can be done via function call `operator()`.

InstanceId instanceId( "SUSE:" ); // using a namespace
ResPool pool( ResPool::instance() );
for_( it, pool.begin(), pool.end() )
{
std::cout << instanceId(*it) << endl;
}
zypp::InstanceId::InstanceId
InstanceId()
Default ctor empty empty namespace.
Definition InstanceId.h:51
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::ResPool::instance
static ResPool instance()
Singleton ctor.
Definition ResPool.cc:38
zypp::pool
Definition ByIdent.h:24
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27

Definition at line 47 of file InstanceId.h.

## Constructor & Destructor Documentation

## ◆ InstanceId() [1/2]

zypp::InstanceId::InstanceId | ( |  | ) |
| inline

Default ctor empty empty namespace.

Definition at line 51 of file InstanceId.h.

## ◆ InstanceId() [2/2]

zypp::InstanceId::InstanceId | ( | std::string | namespace_r | ) |
| inline

Ctor taking namespace.

Definition at line 55 of file InstanceId.h.

## Member Function Documentation

## ◆ getIdFor() [1/2]

std::string zypp::InstanceId::getIdFor | ( | sat::Solvable | slv_r | ) | const

Solvable to InstanceId string.

Definition at line 25 of file InstanceId.cc.

## ◆ getIdFor() [2/2]

std::string zypp::InstanceId::getIdFor | ( | const PoolItem & | pi_r | ) | const
| inline

PoolItem to InstanceId string.

Definition at line 63 of file InstanceId.h.

## ◆ findSolvable()

sat::Solvable zypp::InstanceId::findSolvable | ( | const std::string & | str_r | ) | const
| inline

InstanceId string to Solvable.

Definition at line 67 of file InstanceId.h.

## ◆ findPoolItem()

PoolItem zypp::InstanceId::findPoolItem | ( | const std::string & | str_r | ) | const

InstanceId string to PoolItem.

Definition at line 49 of file InstanceId.cc.

## ◆ operator()() [1/3]

std::string zypp::InstanceId::operator() | ( | sat::Solvable | slv_r | ) | const
| inline

Solvable to InstanceId string.

Definition at line 74 of file InstanceId.h.

## ◆ operator()() [2/3]

std::string zypp::InstanceId::operator() | ( | const PoolItem & | pi_r | ) | const
| inline

PoolItem to InstanceId string.

Definition at line 78 of file InstanceId.h.

## ◆ operator()() [3/3]

PoolItem zypp::InstanceId::operator() | ( | const std::string & | str_r | ) | const
| inline

InstanceId string to PoolItem.

Definition at line 82 of file InstanceId.h.

## ◆ isSystemId()

bool zypp::InstanceId::isSystemId | ( | const std::string & | str_r | ) | const

Quick test whether the InstanceId string would refer to a system (installed) Solvable.

Definition at line 109 of file InstanceId.cc.

## ◆ getNamespace()

const std::string & zypp::InstanceId::getNamespace | ( |  | ) | const
| inline

The namespace in use.

Definition at line 91 of file InstanceId.h.

## ◆ setNamespace()

void zypp::InstanceId::setNamespace | ( | const std::string & | namespace_r | ) |
| inline

Set a new namespace.

Definition at line 95 of file InstanceId.h.

## ◆ unsetNamespace()

void zypp::InstanceId::unsetNamespace | ( |  | ) |
| inline

Set no (empty) namespace.

Definition at line 99 of file InstanceId.h.

## Member Data Documentation

## ◆ _namespace

std::string zypp::InstanceId::_namespace
| private

Definition at line 103 of file InstanceId.h.

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

- zypp/InstanceId.h
- zypp/InstanceId.cc