libzypp  17.38.7
stringpool.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 
10 #include "stringpool.h"
11 
13 #include <zypp-core/base/Gettext.h>
15 
16 namespace zyppng::sat {
17 
19  {
20  static StringPool p;
21  return p;
22  }
23 
25  {
26  ::pool_free( _pool );
27  }
28 
29  StringPool::StringPool() : _pool( ::pool_create() )
30  {
31  MIL << "Creating sat-pool." << std::endl;
32  if ( ! _pool )
33  {
34  ZYPP_THROW( zypp::Exception( _("Can not create sat-pool.") ) );
35  }
36  // libzypp#726: If the disttype is unset, ::pool_evrcmp_str uses
37  // the default flavor set at compiletime. But even on DEBIAN we
38  // handle rpm packages, so their rules must be applied.
39  ::pool_setdisttype( _pool, DISTTYPE_RPM );
40  }
41 
42 }
#define MIL
Definition: Logger.h:103
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:459
detail::CPool * _pool
Internal pointer to the libsolv pool structure (CPool).
Definition: stringpool.h:79
~StringPool()
Destructor.
Definition: stringpool.cc:24
static StringPool & instance()
Access the global StringPool instance.
Definition: stringpool.cc:18
Singleton manager for the underlying libsolv string pool.
Definition: stringpool.h:35
This file contains private API, this might break at any time between releases.
Definition: capabilities.h:22
#define _(MSG)
Definition: Gettext.h:39
Base class for Exception.
Definition: Exception.h:152