This file is indexed.

/usr/include/bobcat/cmdfinder is in libbobcat-dev 4.01.03-2ubuntu1.

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
#ifndef INCLUDED_BOBCAT_CMDFINDER_
#define INCLUDED_BOBCAT_CMDFINDER_

#include <algorithm>
#include <string>

#include <bobcat/cmdfinderbase>
#include <bobcat/fswap>

namespace FBB
{

template <typename FP>
class CmdFinder: public CmdFinderBase
{
    friend class MatchKey;

    size_t d_count;

    protected:
        typedef FP FunctionPtr;                 // define template type 
                                                // as a named type

                                                // elements of the array
                                                // of keys/f-ptrs
        typedef std::pair<char const *, FP> Entry;

    private:
        Entry const *d_begin;
        Entry const *d_end;

    protected:
        CmdFinder(Entry const *begin, Entry const *end,                 // 1
                                                    size_t mode = 0);   
        CmdFinder(CmdFinder &&tmp);                                     // 2

        CmdFinder &operator=(CmdFinder const &rhs)  = default;
        CmdFinder &operator=(CmdFinder &&tmp);                  // opis1

        FP findCmd(std::string const &cmd);
        size_t count() const;

    private:
        class MatchKey
        {
            FP *d_fp;
            CmdFinder<FP> *d_cmdFinder;

            public:
                MatchKey(FunctionPtr *fp, CmdFinder<FP> *cmdFinder);    // 1
                bool operator()(CmdFinder::Entry const &entry);     // opfun
        };

        bool match(std::string const &key) const;
};

template <typename FP>
CmdFinder<FP>::CmdFinder(Entry const *begin, Entry const *end, size_t mode)
:
    CmdFinderBase(mode),
    d_count(0),
    d_begin(begin),
    d_end(end)
{}
template <typename FP>
CmdFinder<FP>::CmdFinder(CmdFinder &&tmp)
:
    CmdFinderBase(move(tmp)),
    d_count(tmp.d_count),
    d_begin(tmp.d_begin),
    d_end(tmp.d_end)
{}
template <typename FP>
inline size_t CmdFinder<FP>::count() const
{
    return d_count;
}
template <typename FP>
FP CmdFinder<FP>::findCmd(std::string const &cmd)
{
    (this->*d_useCmd)(cmd);     // store the cmd to use

    FunctionPtr fp;
    MatchKey matchKey(&fp, this);   // create an object matching 
                                    // a cmd with a key

                                // count the number of occurrences
    d_count = std::count_if(d_begin, d_end, matchKey);

                         
    return d_count == 1 ?   
                fp              // return fp if cmd found
            :                   // otherwise return the last fptr
                (d_end - 1)->second;
}
template <typename FP>
inline CmdFinder<FP> &CmdFinder<FP>::operator=(CmdFinder &&tmp)
{
    FBB::fswap(*this, tmp);
    return *this;
}

template <typename FP>
inline bool CmdFinder<FP>::match(std::string const &key) const
{
    return (this->*d_match)(key);
}
template <typename FP>
CmdFinder<FP>::MatchKey::MatchKey(FunctionPtr *fp, CmdFinder<FP> *cmdFinder)
:
    d_fp(fp),
    d_cmdFinder(cmdFinder)
{}
template <typename FP>
bool CmdFinder<FP>::MatchKey::operator()(CmdFinder::Entry const &entry)
{
    if (!d_cmdFinder->match(entry.first))
        return false;

    *d_fp = entry.second;
    return true;
}

} // FBB
        
#endif