libzypp  17.1.1
Capabilities.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 #include "zypp/base/LogTools.h"
14 
15 #include "zypp/Capabilities.h"
16 
17 using std::endl;
18 
20 namespace zypp
21 {
22 
24  : _begin( base_r )
25  {
26  if ( ! _begin )
27  return;
28 
29  if ( skip_r )
30  {
31  for ( const sat::detail::IdType * end = _begin; *end; ++end )
32  {
33  if ( *end == skip_r )
34  {
35  _begin = end+1;
36  return;
37  }
38  }
39  }
40  // skipp all ==> empty
41  _begin = 0;
42  }
43 
44 
46  {
47  if ( ! _begin )
48  return 0;
49 
50  // jump over libsolvs internal ids.
52  for ( const sat::detail::IdType * end = _begin; *end; ++end )
53  {
54  if ( ! sat::detail::isDepMarkerId( *end ) )
55  ++ret;
56  }
57  return ret;
58  }
59 
60  /******************************************************************
61  **
62  ** FUNCTION NAME : operator<<
63  ** FUNCTION TYPE : std::ostream &
64  */
65  std::ostream & operator<<( std::ostream & str, const Capabilities & obj )
66  {
67  return dumpRange( str << "(" << obj.size() << ")", obj.begin(), obj.end() );
68  }
69 
71 } // namespace zypp
int IdType
Generic Id type.
Definition: PoolMember.h:104
Container of Capability (currently read only).
Definition: Capabilities.h:35
const_iterator end() const
Iterator pointing behind the last Capability.
Definition: Capabilities.h:169
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\ ", const std::string &sep="\ ", const std::string &sfx="\, const std::string &extro="}")
Print range defined by iterators (multiline style).
Definition: LogTools.h:91
String related utilities and Regular expression matching.
size_type size() const
Number of capabilities inside.
Definition: Capabilities.cc:45
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:166
Capabilities()
Default ctor.
Definition: Capabilities.h:45
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
Definition: Capabilities.cc:65
bool isDepMarkerId(IdType id_r)
Test for internal ids satlib includes in dependencies.
Definition: PoolMember.h:119
const sat::detail::IdType * _begin
Definition: Capabilities.h:82
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1