libzypp 17.31.1
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
17#include <zypp/PoolItem.h>
18
20namespace zypp
21{
22
24 //
25 // CLASS NAME : InstanceId
26 //
47 {
48 public:
51 {}
52
54 InstanceId( const std::string & namespace_r )
55 : _namespace( namespace_r )
56 {}
57
58 public:
60 std::string getIdFor( sat::Solvable slv_r ) const;
62 std::string getIdFor( const PoolItem & pi_r ) const
63 { return getIdFor( pi_r.satSolvable() ); }
64
66 sat::Solvable findSolvable( const std::string str_r ) const
67 { return findPoolItem( str_r ).satSolvable(); }
69 PoolItem findPoolItem( const std::string str_r ) const;
70
71 public:
73 std::string operator()( sat::Solvable slv_r ) const
74 { return getIdFor( slv_r ); }
75
77 std::string operator()( const PoolItem & pi_r ) const
78 { return getIdFor( pi_r ); }
79
81 PoolItem operator()( const std::string str_r ) const
82 { return findPoolItem( str_r ); }
83
86 bool isSystemId( const std::string str_r ) const;
87
88 public:
90 const std::string & getNamespace() const
91 { return _namespace; }
92
94 void setNamespace( const std::string & namespace_r )
95 { _namespace = namespace_r; }
96
99 { _namespace.clear(); }
100
101 private:
102 std::string _namespace;
103 };
105
107} // namespace zypp
109#endif // ZYPP_INSTANCEID_H
Build string to identify/retrieve a specific Solvable.
Definition: InstanceId.h:47
std::string getIdFor(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition: InstanceId.cc:25
std::string operator()(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition: InstanceId.h:77
InstanceId(const std::string &namespace_r)
Ctor taking namespace.
Definition: InstanceId.h:54
const std::string & getNamespace() const
The namespace in use.
Definition: InstanceId.h:90
PoolItem operator()(const std::string str_r) const
InstanceId string to PoolItem.
Definition: InstanceId.h:81
InstanceId()
Default ctor empty empty namespace.
Definition: InstanceId.h:50
bool isSystemId(const std::string str_r) const
Quick test whether the InstanceId string would refer to a system (installed) Solvable.
Definition: InstanceId.cc:109
std::string _namespace
Definition: InstanceId.h:102
std::string getIdFor(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition: InstanceId.h:62
std::string operator()(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition: InstanceId.h:73
void unsetNamespace()
Set no (empty) namespace.
Definition: InstanceId.h:98
PoolItem findPoolItem(const std::string str_r) const
InstanceId string to PoolItem.
Definition: InstanceId.cc:49
sat::Solvable findSolvable(const std::string str_r) const
InstanceId string to Solvable.
Definition: InstanceId.h:66
void setNamespace(const std::string &namespace_r)
Set a new namespace.
Definition: InstanceId.h:94
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
A Solvable object within the sat Pool.
Definition: Solvable.h:54
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition: SolvableType.h:57