TwoDA

2da file

Constructors

this
this(string filepath)

Read a 2da file

this
this(ubyte[] rawData, string name)

Parse raw data

Members

Functions

columnIndex
size_t columnIndex(string colName)

Get the index of a column by its name, for faster access

get
auto ref get(size_t colIndex, size_t line)

Get a value in the 2da, converted to T.

get
T get(string colName, size_t line, T defaultValue)

Get a value in the 2da, converted to T.

get
auto ref get(string colName, size_t line)

ditto

opBinaryRight
const(size_t*) opBinaryRight(string colName)

Check if a column exists in the 2da, and returns a pointer to its index

opIndex
inout(string) opIndex(size_t column, size_t row)
inout(string) opIndex(string column, size_t row)

Get a specific cell value Note: column 0 is the first named column (not the index column)

opIndex
const(string[]) opIndex(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndexAssign
void opIndexAssign(string[] value, size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
serialize
ubyte[] serialize()

Outputs 2da text content

Properties

columns
size_t columns [@property getter]

Number of named columns in the 2da (i.e. without the index column)

fileType
string fileType [@property getter]
string fileType [@property setter]

File type (should always be "2DA") Max width: 4 chars

fileVersion
string fileVersion [@property getter]
string fileVersion [@property setter]

File version (should always be "V2.0") Max width: 4 chars

rows
size_t rows [@property getter]

Number of rows in the 2da

rows
size_t rows [@property setter]

Resize the 2da table

Static functions

extractRowData
string[] extractRowData(string line)

Parse a 2DA row

recover
auto recover(string filepath)
auto recover(ubyte[] rawData, string name)

Recover a damaged 2DA file

Variables

fileName
string fileName;

Optional 2DA file name set during construction

Meta