This file is indexed.

/usr/include/bobcat/tablesupport 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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#ifndef INCLUDED_BOBCAT_TABLESUPPORT_
#define INCLUDED_BOBCAT_TABLESUPPORT_

#include <ostream>
#include <vector>
#include <unordered_map>
#include <numeric>

#include <bobcat/align>

namespace FBB
{

class TableSupport
{
    public:
        struct Field
        {
            size_t width;       // width of a field
            size_t type;        // handlingtype (ColumnType)
        };

        enum ColumnType
        {
            SKIP        = 0,
            USE         = 1 << 0,
            LEFT_FULL   = 1 << 1,
            RIGHT_FULL  = 1 << 2,
            LEFT_MID    = 1 << 3,
            RIGHT_MID   = 1 << 4
        };

                // define the columns to provide with a (partial) hline
        struct HLine
        {
            size_t d_row;
            size_t d_begin;
            size_t d_end;
            size_t d_type;  
        
            HLine(size_t row, size_t begin, size_t end);
            HLine(ColumnType margins, size_t row, size_t begin, size_t end);
        };

        class const_iterator: public std::iterator<std::input_iterator_tag, 
                                                                        Field>
        {
            TableSupport const &d_support;

                // iterators to vectors in d_elements. The elements of the 
                // vectors contain the types of the column (SKIP, USE, etc)
                // to determine the width of an element call 
                // separator.width(iterator)
            std::vector<size_t> const *d_vector;
            std::vector<size_t>::const_iterator d_iter;
            mutable Field d_field;

            static std::vector<size_t> s_empty;

            public:
                const_iterator(TableSupport const &support, size_t row, 
                                                            bool begin);

                const_iterator &operator++();                           // .f
                bool operator==(const_iterator const &other) const;     // .f
                bool operator!=(const_iterator const &other) const;     // .f

                Field const &operator*() const;                         // .f
                Field const *operator->() const;
        };

    private:
        std::ostream *d_streamPtr;
        size_t d_nRows;                     // # of rows (defined after def())
        size_t d_nColumns;                  // # of cols
        std::vector<Align> const *d_align;  // pointer to alignment info,
                                            // passed to this by setParam,
                                            // (used by Table/TableBuf)
        size_t d_tableWidth;                // total table width
        std::vector<std::string> d_sep;     // a vector of separators. 0:
                                            // before the leftmost col.

                                            // Element types per row per
                                            // column, wrt hlines
        typedef std::unordered_map<size_t, std::vector<size_t>> UMsizeVector;
        typedef  UMsizeVector::value_type UMValue;
        typedef  UMsizeVector::const_iterator UMIter;

        UMsizeVector d_elements;

    public:
        TableSupport();
        TableSupport(TableSupport &&tmp);

        TableSupport &operator=(TableSupport &&tmp);

        virtual ~TableSupport();            // empty

        void setParam(std::ostream &ostr, size_t rows, size_t nColumns,
                        std::vector<Align> const &align);

        void hline() const;         // called after the last data row      1.f

            // called by Table/TableBuf for each row (0: before 1st data row)
        void hline(size_t row) const;                                   // 2.f

            // same for columns
        void vline() const;                                             // 1.f
        void vline(size_t col) const;                                   // 2.f

        size_t width() const;               // total width of the table     .f

    protected:
                                            
        const_iterator begin(size_t row) const;                         // .f
        const_iterator end(size_t row) const;                           // .f

        size_t colWidth(size_t col) const;  // width of a column and:      .f
        size_t sepWidth(size_t col) const;  // of a separator              .f
                                            // (0: leftmost)

        size_t nColumns() const;            // number of columns           .f
        size_t nRows() const;               // number of rows              .f

        std::ostream &out() const;          // stream to insert into       .f
                                            // the table

                                            // col. alignmnts (not separators)
        std::vector<Align> const &align() const;                        // .f
        std::vector<std::string> const &sep() const;    // separators      .f

    private:
            // called for each row (0: before 1st data row)
        virtual void v_hline(size_t row) const;
        virtual void v_hline() const;         // called after the last data row

            // same for columns
        virtual void v_vline(size_t col) const;
        virtual void v_vline() const;


        size_t width(size_t idx) const;

            // return indices in d_elements of left separator element, etc.
        static size_t leftSeparator(size_t column);                     // .f
        static size_t element(size_t column);                           // .f
        static size_t rightSeparator(size_t column);                    // .f

        static void leftType(size_t *target, size_t type);              // .f
        static void rightType(size_t *target, size_t type);             // .f

        friend class const_iterator;
        friend TableSupport &operator<<(TableSupport &support, size_t);
        friend TableSupport &operator<<(TableSupport &support, 
                                                    std::string const &sep);
        friend TableSupport &operator<<(TableSupport &support, 
                                                    HLine const &hline);
};

inline std::vector<Align> const &TableSupport::align() const
{
    return *d_align;
}
inline TableSupport::const_iterator TableSupport::begin(size_t row) const
{
    const_iterator ret(*this, row, true);
    return ret;
}
inline size_t TableSupport::colWidth(size_t col) const
{
    return col < d_align->size() ? (*d_align)[col].col() : 0;
}
inline TableSupport::const_iterator TableSupport::end(size_t row) const
{
    const_iterator ret(*this, row, false);
    return ret;
}
inline void TableSupport::hline() const
{
    v_hline();
}
inline void TableSupport::hline(size_t row) const
{
    v_hline(row);
}
inline size_t TableSupport::nColumns() const
{
    return d_nColumns;
}
inline size_t TableSupport::nRows() const
{
    return d_nRows;
}
inline bool TableSupport::const_iterator::operator==(
        TableSupport::const_iterator const &other) const
{
    return d_iter == other.d_iter;
}
inline 
TableSupport::const_iterator &TableSupport::const_iterator::operator++()
{
    ++d_iter;
    return *this;
}
inline bool TableSupport::const_iterator::operator!=(
    TableSupport::const_iterator const &other) const
{
    return not (*this == other);
}
inline TableSupport::Field const
                            &TableSupport::const_iterator::operator*() const
{
    return *operator->();
}
inline std::ostream &TableSupport::out() const
{
    return *d_streamPtr;
}
inline std::vector<std::string> const &TableSupport::sep() const
{
    return d_sep;
}
inline size_t TableSupport::sepWidth(size_t col) const
{
    return col < d_sep.size() ? d_sep[col].length() : 0;
}
inline void TableSupport::vline() const
{
    v_vline();
}
inline void TableSupport::vline(size_t col) const
{
    v_vline(col);
}
inline size_t TableSupport::width() const
{
    return d_tableWidth;
}

    // Free Functions

inline TableSupport::ColumnType operator|(TableSupport::ColumnType lhs,
                                          TableSupport::ColumnType rhs)
{
    return static_cast<TableSupport::ColumnType>(
                    static_cast<int>(lhs) | static_cast<int>(rhs));
}

TableSupport &operator<<(TableSupport &support, size_t);
TableSupport &operator<<(TableSupport &support, std::string const &sep);
TableSupport &operator<<(TableSupport &support, 
                                        TableSupport::HLine const &hline);
} // FBB


#endif