This file is indexed.

/usr/include/x86_64-linux-gnu/zypp/PoolItemBest.h is in libzypp-dev 15.3.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*---------------------------------------------------------------------\
|                          ____ _   __ __ ___                          |
|                         |__  / \ / / . \ . \                         |
|                           / / \ V /|  _/  _/                         |
|                          / /__ | | | | | |                           |
|                         /_____||_| |_| |_|                           |
|                                                                      |
\---------------------------------------------------------------------*/
/** \file	zypp/PoolItemBest.h
 *
*/
#ifndef ZYPP_POOLITEMBEST_H
#define ZYPP_POOLITEMBEST_H

#include <iosfwd>

#include "zypp/base/PtrTypes.h"
#include "zypp/base/Function.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/Tr1hash.h"

#include "zypp/PoolItem.h"

///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////

  ///////////////////////////////////////////////////////////////////
  //
  //	CLASS NAME : PoolItemBest
  //
  /** Find the best candidates e.g. in a \ref PoolQuery result.
   *
   * The class basically maintains a \c map<IdString,PoolItem> and remembers
   * for each \c ident (\ref sat::Solvable::ident) the best \ref PoolItem that
   * was added.
   *
   * The default \ref Predicate to determine the best choice is the same that
   * sorts the \ref ui::Selectable list of available objects, thus follows the
   * same rules the \ref resolver will apply.
   *
   * \code
   *   PoolQuery q;
   *   q.addAttribute(sat::SolvAttr::name, "lib*");
   *   q.setMatchGlob();
   *
   *  // get the best matches and tag them for installation:
   *  PoolItemBest bestMatches( q.begin(), q.end() );
   *  if ( ! bestMatches.empty() )
   *  {
   *    for_( it, bestMatches.begin(), bestMatches.end() )
   *    {
   *      ui::asSelectable()( *it )->setOnSystem( *it, ResStatus::USER );
   *    }
   *  }
   * \endcode
   *
   * \todo Support arbitrary Predicates.
   */
  class PoolItemBest
  {
      typedef std::tr1::unordered_map<IdString,PoolItem> Container;
    public:
      /** Predicate returning \c True if \a lhs is a better choice. */
      typedef boost::function<bool ( const PoolItem & lhs, const PoolItem & rhs )> Predicate;

      typedef Container::size_type	size_type;
      typedef Container::value_type	value_type;
      typedef MapKVIteratorTraits<Container>::Value_const_iterator	iterator;
      typedef MapKVIteratorTraits<Container>::Key_const_iterator	ident_iterator;

    public:
      /** Default ctor. */
      PoolItemBest()
      {}

      /** Ctor feeding a \ref sat::Solvable. */
      PoolItemBest( sat::Solvable slv_r )
      { _ctor_init(); add( slv_r ); }

      /** Ctor feeding a \ref PoolItem. */
      PoolItemBest( const PoolItem & pi_r )
      { _ctor_init(); add( pi_r ); }

      /** Ctor feeding a range of  \ref sat::Solvable or \ref PoolItem. */
      template<class _Iterator>
      PoolItemBest( _Iterator begin_r, _Iterator end_r )
      { _ctor_init(); add( begin_r, end_r ); }

    public:
      /** Feed one \ref sat::Solvable. */
      void add( sat::Solvable slv_r )
      { add( PoolItem( slv_r ) ); }

      /** Feed one \ref PoolItem. */
      void add( const PoolItem & pi_r );

      /** Feed a range of  \ref sat::Solvable or \ref PoolItem. */
      template<class _Iterator>
      void add( _Iterator begin_r, _Iterator end_r )
      {
        for_( it, begin_r, end_r )
          add( *it );
      }

    public:
      /** \name Iterate the collected PoolItems. */
      //@{
      /** Whether PoolItems were collected. */
      bool empty() const	{ return container().empty(); }
      /** Number of PoolItems collected. */
      size_type size() const	{ return container().size(); }
      /** Pointer to the first PoolItem. */
      iterator begin() const	{ return make_map_value_begin( container() ); }
      /** Pointer behind the last PoolItem. */
      iterator end() const	{ return make_map_value_end( container() ); }

      /** Return the collected \ref PoolItem with \ref sat::Solvable::ident \a ident_r. */
      PoolItem find( IdString ident_r ) const;
      /** \overload Use Solvables ident string. */
      PoolItem find( sat::Solvable slv_r ) const	{ return find( slv_r.ident() ); }
      /** \overload Use PoolItems ident string. */
      PoolItem find( const PoolItem & pi_r ) const	{ return find( pi_r.satSolvable().ident() ); }
      //@}

      /** \name Iterate the collected PoolItems ident strings. */
      //@{
      /** Pointer to the first item. */
      ident_iterator identBegin() const	{ return make_map_key_begin( container() ); }
      /** Pointer behind the last item. */
      ident_iterator identEnd() const	{ return make_map_key_end( container() ); }
      //@}

    private:
      void _ctor_init();
      const Container & container() const;
    private:
      /** Implementation  */
      class Impl;
      /** Pointer to implementation */
      RWCOW_pointer<Impl> & pimpl()             { return *(reinterpret_cast<RWCOW_pointer<Impl>*>( _dont_use_this_use_pimpl.get() )); }
      /** Pointer to implementation */
      const RWCOW_pointer<Impl> & pimpl() const { return *(reinterpret_cast<RWCOW_pointer<Impl>*>( _dont_use_this_use_pimpl.get() )); }
      /** Avoid need to include Impl definition when inlined ctors (due to tepmlate) are provided. */
      shared_ptr<void> _dont_use_this_use_pimpl;
  };
  ///////////////////////////////////////////////////////////////////

  /** \relates PoolItemBest Stream output */
  std::ostream & operator<<( std::ostream & str, const PoolItemBest & obj );

  /////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_POOLITEMBEST_H