libzypp 17.37.10

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 //
47 class ZYPP_API InstanceId
48 {
49 public:
51 InstanceId()
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
99 void unsetNamespace()
100 { _namespace.clear(); }
101
102 private:
103 std::string _namespace;
104 };
105
106
108} // namespace zypp
110#endif // ZYPP_INSTANCEID_H
PoolItem.h
zypp::InstanceId::getIdFor
std::string getIdFor(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition InstanceId.cc:25
zypp::InstanceId::findPoolItem
PoolItem findPoolItem(const std::string &str_r) const
InstanceId string to PoolItem.
Definition InstanceId.cc:49
zypp::InstanceId::operator()
std::string operator()(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition InstanceId.h:78
zypp::InstanceId::getNamespace
const std::string & getNamespace() const
The namespace in use.
Definition InstanceId.h:91
zypp::InstanceId::InstanceId
InstanceId()
Default ctor empty empty namespace.
Definition InstanceId.h:51
zypp::InstanceId::_namespace
std::string _namespace
Definition InstanceId.h:103
zypp::InstanceId::getIdFor
std::string getIdFor(const PoolItem &pi_r) const
PoolItem to InstanceId string.
Definition InstanceId.h:63
zypp::InstanceId::findSolvable
sat::Solvable findSolvable(const std::string &str_r) const
InstanceId string to Solvable.
Definition InstanceId.h:67
zypp::InstanceId::operator()
std::string operator()(sat::Solvable slv_r) const
Solvable to InstanceId string.
Definition InstanceId.h:74
zypp::InstanceId::InstanceId
InstanceId(std::string namespace_r)
Ctor taking namespace.
Definition InstanceId.h:55
zypp::InstanceId::unsetNamespace
void unsetNamespace()
Set no (empty) namespace.
Definition InstanceId.h:99
zypp::InstanceId::operator()
PoolItem operator()(const std::string &str_r) const
InstanceId string to PoolItem.
Definition InstanceId.h:82
zypp::InstanceId::setNamespace
void setNamespace(const std::string &namespace_r)
Set a new namespace.
Definition InstanceId.h:95
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
std
Definition Arch.h:364
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::sat::SolvableType::satSolvable
Solvable satSolvable() const
Return the corresponding sat::Solvable.
Definition SolvableType.h:57