API Reference
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
DB.Api.Table Class Reference

Class to handle data in the form of tables. Tables comprise a specified number of fields (columns) and any number of records (rows). Tables are used by DB for both results and intermediate storage as well as providing a mechanism for DB data table files (.DAT files) which are used to house various databases such as materials and constructions. Tables used to house the .DAT files require the data files to use a specific format whereby the field of each record is delimited using # character, the first record contains field categories and the second record contains the field names. In contrast, tables used for results and intermediate storage don't have the same requirement for the first two records and data is accessed exclusively by index. More...

Public Member Functions

Record AddRecord ()
 Adds an empty record to the table object.
 
bool RemoveRecordByIndex (int index)
 Removes record from table.
 
bool RemoveRecordByHandle (int handle)
 Removes record by handle or ID (first field in the table)
 
bool SaveToFile (string dstPath)
 Saves table in the form of an ASCII text file.
 
int GetUniqueId ()
 Returns a unique handle or ID from table (first ID currently unused by table)
 
void AddField (string key, string value)
 Adds new field to table and sets the value of the new field in all records to the supplied default value.
 
void Dispose ()
 

Properties

Collections.Records Records [get]
 Instantiates a collection of table records.
 
Collections.Categories Categories [get]
 Instantiates a collection of table category IDs. A list of category IDs are located at the top of DB component and template .dat files (Component and Template objects). Category IDs are referenced using the CategoryId field found in .dat files. Category IDs point to externalised text in LocalisedCategories_n.txt files.
 
Collections.Fields Fields [get]
 Instantiates a collection of table fields.
 

Detailed Description

Class to handle data in the form of tables. Tables comprise a specified number of fields (columns) and any number of records (rows). Tables are used by DB for both results and intermediate storage as well as providing a mechanism for DB data table files (.DAT files) which are used to house various databases such as materials and constructions. Tables used to house the .DAT files require the data files to use a specific format whereby the field of each record is delimited using # character, the first record contains field categories and the second record contains the field names. In contrast, tables used for results and intermediate storage don't have the same requirement for the first two records and data is accessed exclusively by index.

Member Function Documentation

◆ AddField()

void DB.Api.Table.AddField ( string  key,
string  value 
)

Adds new field to table and sets the value of the new field in all records to the supplied default value.

Parameters
keyname of new field to be added to table
valuedefault value to be assigned to new field in all records

◆ AddRecord()

Record DB.Api.Table.AddRecord ( )

Adds an empty record to the table object.

Returns
the newly added record as a Record object

◆ GetUniqueId()

int DB.Api.Table.GetUniqueId ( )

Returns a unique handle or ID from table (first ID currently unused by table)

Returns
integer value of ID

◆ RemoveRecordByHandle()

bool DB.Api.Table.RemoveRecordByHandle ( int  handle)

Removes record by handle or ID (first field in the table)

Parameters
handlehandle or ID of record to be removed
Returns
TRUE if record removed successfully otherwise FALSE

◆ RemoveRecordByIndex()

bool DB.Api.Table.RemoveRecordByIndex ( int  index)

Removes record from table.

Parameters
indexindex of record to be removed
Returns
TRUE if record removed successfully otherwise FALSE

◆ SaveToFile()

bool DB.Api.Table.SaveToFile ( string  dstPath)

Saves table in the form of an ASCII text file.

Parameters
dstPathfull path name of file
Returns
TRUE if file saved successfully otherwise FALSE

The documentation for this class was generated from the following file: