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

libzypp 17.38.6

capabilities.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include "capabilities.h"
14
15#include <iostream>
16#include <zypp-core/base/LogTools.h>
17
18using std::endl;
19
20namespace zyppng::sat
21{
22 Capabilities:: Capabilities( const sat::detail::IdType * base_r, sat::detail::IdType skip_r )
23 : _begin( base_r )
24 {
25 if ( ! _begin )
26 return;
27
28 if ( skip_r )
29 {
30 for ( const sat::detail::IdType * end = _begin; *end; ++end )
31 {
32 if ( *end == skip_r )
33 {
34 _begin = end+1;
35 return;
36 }
37 }
38 }
39 // skipp all ==> empty
40 _begin = 0;
41 }
42
43
44 Capabilities::size_type Capabilities::size() const
45 {
46 if ( ! _begin )
47 return 0;
48
49 // jump over libsolvs internal ids.
50 Capabilities::size_type ret = 0;
51 for ( const sat::detail::IdType * end = _begin; *end; ++end )
52 {
53 if ( ! sat::detail::isDepMarkerId( *end ) )
54 ++ret;
55 }
56 return ret;
57 }
58} // namespace zyppng::sat
59
LogTools.h
zypp::Capabilities::size
size_type size() const
Number of capabilities inside.
Definition Capabilities.cc:45
zypp::Capabilities::Capabilities
Capabilities()
Default ctor.
Definition Capabilities.h:44
zyppng::sat::Capabilities::end
const_iterator end() const
Iterator pointing behind the last Capability.
Definition capabilities.h:164
zyppng::sat::Capabilities::size_type
unsigned size_type
Definition capabilities.h:34
zyppng::sat::Capabilities::_begin
const sat::detail::IdType * _begin
Definition capabilities.h:83
zyppng::sat::detail::isDepMarkerId
bool isDepMarkerId(IdType id_r)
Test for internal ids satlib includes in dependencies.
Definition PoolDefines.h:57
zyppng::sat::detail::IdType
zypp::sat::detail::IdType IdType
Definition poolconstants.h:43
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
capabilities.h