39 std::optional<std::size_t>
indexOf(std::string_view columnName)
const;
53 static Catalog load(
const std::filesystem::path& dataDir);
constexpr std::string_view kCatalogTable
Name of the catalogue table: it describes every table, itself included, and is its own data file.
All table definitions, read from the SYSTEM_TABLE file (one 80-character line per column).
std::filesystem::path dataFile(const TableSchema &table) const
The file holding a table's rows.
std::filesystem::path dataDir_
Where the files are.
const std::vector< TableSchema > & tables() const
All tables, in the order they appear in SYSTEM_TABLE.
const TableSchema & table(std::string_view name) const
Finds a table by name.
std::vector< TableSchema > tables_
Every table, in file order.
static Catalog load(const std::filesystem::path &dataDir)
Reads SYSTEM_TABLE from a data directory.
One column of a table: the characters it occupies in every fixed-width row.
std::size_t width() const
Number of characters the column occupies.
std::size_t to
Last character of the column, inclusive.
std::size_t from
First character of the column in a row, counted from 0.
std::string name
Column name, e.g. NOME.
std::string type
N1 or S1: recorded in SYSTEM_TABLE, not enforced.
The definition of one table: its name, its columns, and the length of a row.
std::string name
Table name, e.g. EMPLOY.
std::size_t recordLength
Length of a full row, in characters.
std::optional< std::size_t > indexOf(std::string_view columnName) const
Finds a column by name.
bool hasAutoId() const
Tells whether rows are numbered automatically.
std::vector< Column > columns
Columns in file order.