libzypp 17.37.17
InstanceId.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_INSTANCEID_H
13#define ZYPP_INSTANCEID_H
14
15#include <string>
16#include <utility>
17
18#include <zypp/PoolItem.h>
19
21namespace zypp
22{
23
25 //
26 // CLASS NAME : InstanceId
27 //
48 {
49 public:
52 {}
53
55 InstanceId( std::string namespace_r )
56 : _namespace(std::move( namespace_r ))
57 {}
58
59 public:
61 std::string getIdFor( sat::Solvable slv_r ) const;
63 std::string getIdFor( const PoolItem & pi_r ) const
64 { return getIdFor( pi_r.satSolvable() ); }
65
67 sat::Solvable findSolvable( const std::string &str_r ) const
68 { return findPoolItem( str_r ).satSolvable(); }
69
70 PoolItem findPoolItem( const std::string& str_r ) const;
71
72 public:
74 std::string operator()( sat::Solvable slv_r ) const
75 { return getIdFor( slv_r ); }
76
78 std::string operator()( const PoolItem & pi_r ) const
79 { return getIdFor( pi_r ); }
80
82 PoolItem operator()( const std::string &str_r ) const
83 { return findPoolItem( str_r ); }
84
87 bool isSystemId( const std::string& str_r ) const;
88
89 public:
91 const std::string & getNamespace() const
92 { return _namespace; }
93
95 void setNamespace( const std::string & namespace_r )
96 { _namespace = namespace_r; }
97
100 { _namespace.clear(); }
101
102 private:
103 std::string _namespace;
104 };
105
106
108} // namespace zypp
110#endif // ZYPP_INSTANCEID_H
std::string getIdFor(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition InstanceId.cc:25
PoolItem findPoolItem(const std::string &str_r) const
InstanceId string to PoolItem.
Definition InstanceId.cc:49
std::string operator()(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition InstanceId.h:78
const std::string & getNamespace() const
The namespace in use.
Definition InstanceId.h:91
InstanceId()
Default ctor empty empty namespace.
Definition InstanceId.h:51
std::string _namespace
Definition InstanceId.h:103
std::string getIdFor(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition InstanceId.h:63
sat::Solvable findSolvable(const std::string &str_r) const
InstanceId string to Solvable.
Definition InstanceId.h:67
std::string operator()(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition InstanceId.h:74
InstanceId(std::string namespace_r)
Ctor taking namespace.
Definition InstanceId.h:55
void unsetNamespace()
Set no (empty) namespace.
Definition InstanceId.h:99
PoolItem operator()(const std::string &str_r) const
InstanceId string to PoolItem.
Definition InstanceId.h:82
void setNamespace(const std::string &namespace_r)
Set a new namespace.
Definition InstanceId.h:95
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
A Solvable object within the sat Pool.
Definition Solvable.h:54
Definition Arch.h:364
Easy-to use interface to the ZYPP dependency resolver.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
Solvable satSolvable() const
Return the corresponding sat::Solvable.