libzypp: zypp/ng/sat/stringpool.cc Source File

libzypp 17.38.14

stringpool.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
10#include "stringpool.h"
11
12#include <zypp-core/base/Exception.h>
13#include <zypp-core/base/Gettext.h>
14#include <zypp-core/base/LogTools.h>
15
16namespace zyppng::sat {
17
18 StringPool &StringPool::instance()
19 {
20 static StringPool p;
21 return p;
22 }
23
24 StringPool::~StringPool()
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}
Exception.h
ZYPP_THROW
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition Exception.h:459
Gettext.h
_
#define _(MSG)
Definition Gettext.h:39
LogTools.h
MIL
#define MIL
Definition Logger.h:103
zypp::Exception
Base class for Exception.
Definition Exception.h:153
zypp::StringPool::StringPool
StringPool()
Definition stringpool.cc:29
zypp::StringPool::instance
static StringPool & instance()
Access the global StringPool instance.
Definition stringpool.cc:18
zypp::StringPool::~StringPool
~StringPool()
Destructor.
Definition stringpool.cc:24
zyppng::sat::StringPool::StringPool
StringPool(const StringPool &)=delete
zyppng::sat::StringPool::_pool
detail::CPool * _pool
Internal pointer to the libsolv pool structure (CPool).
Definition stringpool.h:79
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
stringpool.h