Table adapter that maps spreadsheet rows to serializable objects.
More...
#include <Utils/XMLSpreadsheet/CXMLTableData.h>
|
| | CXMLTableData (CXMLSpreadsheet::SSheet *sheet) |
| | Construct a table adapter for a sheet.
|
|
virtual | ~CXMLTableData () |
| | Destroy the table adapter.
|
| void | addColumn (const char *name) |
| | Append a column mapping.
|
| void | insertColumn (const char *name, u32 position) |
| | Insert a column mapping at a position.
|
| void | removeColumn (u32 index) |
| | Remove a column mapping.
|
| const char * | getColumn (u32 index) |
| | Get a column mapping name.
|
| u32 | getNumColumn () |
| | Get the number of mapped columns.
|
| u32 | getNumRow () |
| | Get the number of rows in the source sheet.
|
| u32 | fetchData (std::function< CObjectSerializable *()> creatorFunc, std::vector< CObjectSerializable * > &data, u32 fromRow, int count) |
| | Create and fill serializable objects from sheet rows.
|
| void | copyRowToObject (CXMLSpreadsheet::SRow *row, CObjectSerializable *data) |
| | Copy one spreadsheet row into a serializable object.
|
| template<class T> |
| void | freeData (std::vector< T * > &data) |
| | Delete all pointers in a fetched data vector and clear it.
|
| template<class T> |
| u32 | fetchData (std::vector< T * > &data, u32 fromRow, int count) |
| | Create and fill typed serializable objects from sheet rows.
|
Table adapter that maps spreadsheet rows to serializable objects.
Columns define the property names used when copying row values into CObjectSerializable instances.
◆ CXMLTableData()
Construct a table adapter for a sheet.
- Parameters
-
| sheet | Source sheet. The adapter does not own this pointer. |
◆ addColumn()
| void Skylicht::CXMLTableData::addColumn |
( |
const char * | name | ) |
|
Append a column mapping.
- Parameters
-
| name | Serializable property name for the column. |
◆ copyRowToObject()
Copy one spreadsheet row into a serializable object.
- Parameters
-
| row | Source row. |
| data | Destination serializable object. |
◆ fetchData() [1/2]
Create and fill serializable objects from sheet rows.
- Parameters
-
| creatorFunc | Function that creates a new serializable object. |
| data | Receives created objects. Ownership is transferred to the caller. |
| fromRow | First row index to fetch. |
| count | Maximum number of rows to fetch, or a non-positive value for all rows. |
- Returns
- Number of objects appended to data.
◆ fetchData() [2/2]
template<class T>
| u32 Skylicht::CXMLTableData::fetchData |
( |
std::vector< T * > & | data, |
|
|
u32 | fromRow, |
|
|
int | count ) |
|
inline |
Create and fill typed serializable objects from sheet rows.
T must derive from CObjectSerializable.
- Template Parameters
-
| T | Object type to allocate. |
- Parameters
-
| data | Receives created objects. Ownership is transferred to the caller. |
| fromRow | First row index to fetch. |
| count | Maximum number of rows to fetch, or a non-positive value for all rows. |
- Returns
- Number of objects appended to data, or 0 if T is not serializable.
◆ freeData()
template<class T>
| void Skylicht::CXMLTableData::freeData |
( |
std::vector< T * > & | data | ) |
|
|
inline |
Delete all pointers in a fetched data vector and clear it.
- Template Parameters
-
| T | Object type stored in the vector. |
- Parameters
-
| data | Vector of owned pointers. |
◆ getColumn()
| const char * Skylicht::CXMLTableData::getColumn |
( |
u32 | index | ) |
|
|
inline |
Get a column mapping name.
- Parameters
-
| index | Zero-based column index. |
- Returns
- Column name.
◆ getNumColumn()
| u32 Skylicht::CXMLTableData::getNumColumn |
( |
| ) |
|
|
inline |
Get the number of mapped columns.
- Returns
- Column count.
◆ getNumRow()
| u32 Skylicht::CXMLTableData::getNumRow |
( |
| ) |
|
|
inline |
Get the number of rows in the source sheet.
- Returns
- Row count.
◆ insertColumn()
| void Skylicht::CXMLTableData::insertColumn |
( |
const char * | name, |
|
|
u32 | position ) |
Insert a column mapping at a position.
- Parameters
-
| name | Serializable property name for the column. |
| position | Zero-based insertion position. |
◆ removeColumn()
| void Skylicht::CXMLTableData::removeColumn |
( |
u32 | index | ) |
|
Remove a column mapping.
- Parameters
-
| index | Zero-based column index. |
The documentation for this class was generated from the following file: