81 for (ptrdiff_t i =
_rowStarts.size() - 1; i >= 0; i--) {
85 if (row >=
_rows[i]->size())
88 return (*
_rows[i])[row];
103 for (
size_t i = 0, j = 0; i <
_rowCount; i++, j++) {
104 if (j >=
_rows[gff4]->size()) {
105 if (++gff4 >=
_rows.size())
111 if ((*
_rows[gff4])[j] && ((*
_rows[gff4])[j]->getUint(idColumn) == id))
134 for (
size_t i = 0; i <
_columns->size(); i++) {
171 return gdaRow->
getString(gdaColumn, def);
181 return gdaRow->
getString(gdaColumn, def);
190 return gdaRow->
getSint(gdaColumn, def);
199 return gdaRow->
getSint(gdaColumn, def);
208 return gdaRow->
getDouble(gdaColumn, def);
217 return gdaRow->
getDouble(gdaColumn, def);
221 if (!columns || (column >= columns->size()) || !(*columns)[column])
243 if (!rows || rows->empty() || !(*rows)[0])
291 for (
size_t i = 0; i <
_columns->size(); i++) {
301 e.
add(
"Failed reading GDA file");
322 if (columns->size() !=
_columns->size())
326 for (
size_t i = 0; i < columns->size(); i++) {
333 if ((hash1 != hash2) || (type1 != type2))
335 hash1, (
int)type1, hash2, (
int)type2);
339 e.
add(
"Failed adding GDA file");
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void add(const char *s,...) GCC_PRINTF(2
Handling BioWare's GDAs (2DAs, two-dimensional array, within V4.0 GFFs).
int32 getInt(size_t row, uint32 columnHash, int32 def=0) const
Common::UString getString(uint32 field, Common::Encoding encoding, const Common::UString &def="") const
Return a field string, read from the given encoding.
A class holding an UTF-8 string.
static const uint32 kVersion02
float getFloat(size_t row, uint32 columnHash, float def=0.0f) const
int64 getSint(uint32 field, int64 def=0) const
static const uint32 kVersion01
UTF-16 LE (little endian).
size_t findRow(uint32 id) const
Find a row by its ID value.
A GFF (generic file format) V4.0/V4.1 file, found in Dragon Age: Origins, Dragon Age 2 and Sonic Chro...
Utility templates and functions for working with strings and streams.
ColumnNameMap _columnNameMap
Exception that provides a stack of explanations.
void load(Common::SeekableReadStream *gda)
Handling version V4.0/V4.1 of BioWare's GFFs (generic file format).
Basic exceptions to throw.
void add(Common::SeekableReadStream *gda)
Add another GDA with the same column structure to the bottom of this GDA.
ASCII string, found in Sonic.
double getDouble(uint32 field, double def=0.0) const
const GFF4Struct * getRowColumn(size_t row, uint32 hash, size_t &column) const
static uint32 hashStringCRC32(const UString &string)
static const size_t kInvalidColumn
FieldType
The type of a GFF4 field.
Basic reading stream interfaces.
size_t getRowCount() const
Return the number of rows in the array.
size_t getColumnCount() const
Return the number of columns in the array.
GDAFile(Common::SeekableReadStream *gda)
Take over this stream and read a GDA file out of it.
const GFF4Struct * getRow(size_t row) const
Get a row as a GFF4 struct.
size_t findColumn(const Common::UString &name) const
Find a column by its name.
Common::UString getString(size_t row, uint32 columnHash, const Common::UString &def="") const
UString toLower() const
Return a lowercased copy of the string.
ColumnHashMap _columnHashMap
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
64bit IEEE float (double).
static const size_t kInvalidRow
bool hasRow(size_t row) const
Does this row exist in the GDA?
std::vector< Header > Headers
const Headers & getHeaders() const
Get the column headers.
const GFF4List & getList(uint32 field) const
Type identifyType(const Columns &columns, const Row &rows, size_t column) const
Interface for a seekable & readable data stream.
static const uint32 kG2DAID