libzypp  17.36.7
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 
21 namespace 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(); }
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  };
106 
108 } // namespace zypp
110 #endif // ZYPP_INSTANCEID_H
Build string to identify/retrieve a specific Solvable.
Definition: InstanceId.h:47
std::string getIdFor(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition: InstanceId.h:63
A Solvable object within the sat Pool.
Definition: Solvable.h:53
InstanceId()
Default ctor empty empty namespace.
Definition: InstanceId.h:51
const std::string & getNamespace() const
The namespace in use.
Definition: InstanceId.h:91
Definition: Arch.h:363
std::string operator()(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition: InstanceId.h:78
sat::Solvable findSolvable(const std::string &str_r) const
InstanceId string to Solvable.
Definition: InstanceId.h:67
InstanceId(std::string namespace_r)
Ctor taking namespace.
Definition: InstanceId.h:55
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
void setNamespace(const std::string &namespace_r)
Set a new namespace.
Definition: InstanceId.h:95
void unsetNamespace()
Set no (empty) namespace.
Definition: InstanceId.h:99
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
std::string _namespace
Definition: InstanceId.h:103
PoolItem operator()(const std::string &str_r) const
InstanceId string to PoolItem.
Definition: InstanceId.h:82
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57
std::string operator()(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition: InstanceId.h:74