libzypp  11.13.5
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 
20 namespace zypp
21 {
22 
24  //
25  // CLASS NAME : InstanceId
26  //
46  class InstanceId
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