/usr/include/bobcat/tablebase is in libbobcat-dev 4.08.02-2build1.
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 | #ifndef INCLUDED_BOBCAT_TABLEBASE_
#define INCLUDED_BOBCAT_TABLEBASE_
#include <ostream>
#include <string>
#include <vector>
#include <bobcat/align>
#include <bobcat/tablesupport>
namespace FBB
{
class TableBase
{
friend std::ostream &operator<<(std::ostream &str, TableBase &table);
public:
enum FillDirection
{
ROWWISE,
COLUMNWISE
};
enum WidthType
{
COLUMNWIDTH,
EQUALWIDTH,
};
void clear(); // clear the table-elements .f
size_t nRows() const; // Number of rows currently .f
// in the table (following def)
protected:
struct Element
{
std::string d_text;
std::ios_base &(*d_manip)(std::ios_base &);
Element(std::string text = "", // .f
std::ios_base &(*manip)(std::ios_base &) = 0);
size_t length() const; // .f
};
bool d_tabulated;
size_t d_nRows;
size_t d_nColumns;
WidthType d_widthType;
std::vector<Align> d_align;
std::vector<Element> d_string; // table contents
TableSupport *d_ptr;
TableSupport &d_tableSupport;
Element &(TableBase::*d_indexFun)(size_t row,
size_t col);
TableBase(size_t nColumns, FillDirection direction,
WidthType widthType);
TableBase(TableSupport &tableSupport, // 1
size_t nColumns, FillDirection direction, WidthType widthType);
~TableBase();
void setAlign(Align const &align); // set an alignment
void def(); // fillup an incomplete table
// automatically called at
// insertions into ostreams
size_t columnWidth(size_t col) const; // .f
Manipulator columnManip(size_t col) const; // .f
Element &hIndex(size_t row, size_t col); // .f
Element &vIndex(size_t row, size_t col); // .f
private:
std::ostream &insert(std::ostream &ostr);
// returns element at particular location
Element &elementAt(size_t row, size_t col); // .f
};
inline void TableBase::clear()
{
d_tabulated = false;
d_string.clear();
}
inline Manipulator TableBase::columnManip(size_t col) const
{
Manipulator manip = d_align[col].manip();
return manip ? manip : std::right;
}
inline size_t TableBase::columnWidth(size_t col) const
{
return d_align[col];
}
inline TableBase::Element &TableBase::hIndex(size_t row, size_t col)
{
return d_string[row * d_nColumns + col];
}
inline size_t TableBase::nRows() const
{
return d_nRows;
}
inline TableBase::Element &TableBase::vIndex(size_t row, size_t col)
{
return d_string[col * d_nRows + row];
}
// Element members
inline TableBase::Element::Element(std::string text,
std::ios_base &(*manip)(std::ios_base &))
:
d_text(text),
d_manip(manip)
{}
inline size_t TableBase::Element::length() const
{
return d_text.length();
}
// Free Functions
// display the table
inline std::ostream &operator<<(std::ostream &str, TableBase &table)
{
return table.insert(str);
}
} // FBB
#endif
|