libzypp  17.3.1
zypp::InstanceId Class Reference

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

#include <InstanceId.h>

Public Member Functions

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

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;
}

Definition at line 46 of file InstanceId.h.

Constructor & Destructor Documentation

◆ InstanceId() [1/2]

zypp::InstanceId::InstanceId ( )
inline

Default ctor empty empty namespace.

Definition at line 50 of file InstanceId.h.

◆ InstanceId() [2/2]

zypp::InstanceId::InstanceId ( const std::string &  namespace_r)
inline

Ctor taking namespace.

Definition at line 54 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 62 of file InstanceId.h.

◆ findSolvable()

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

InstanceId string to Solvable.

Definition at line 66 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 73 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 77 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 81 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 90 of file InstanceId.h.

◆ setNamespace()

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

Set a new namespace.

Definition at line 94 of file InstanceId.h.

◆ unsetNamespace()

void zypp::InstanceId::unsetNamespace ( )
inline

Set no (empty) namespace.

Definition at line 98 of file InstanceId.h.

Member Data Documentation

◆ _namespace

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

Definition at line 102 of file InstanceId.h.


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