Reader for XML spreadsheet and CSV table data.
More...
#include <Utils/XMLSpreadsheet/CXMLSpreadsheet.h>
|
|
| CXMLSpreadsheet () |
| | Construct an empty spreadsheet.
|
|
virtual | ~CXMLSpreadsheet () |
| | Destroy the spreadsheet and all loaded data.
|
| bool | open (const char *file) |
| | Load spreadsheet data from an XML file.
|
| bool | open (io::IXMLReader *xmlReader) |
| | Load spreadsheet data from an existing XML reader.
|
| bool | openCSV (const char *file) |
| | Load spreadsheet data from a CSV file.
|
| u32 | getSheetCount () |
| | Get the number of loaded sheets.
|
| SSheet * | getSheet (int i) |
| | Get a sheet by index.
|
| SSheet * | operator[] (int i) |
| | Get a sheet by index.
|
| SCell * | getCell (SSheet *sheet, u32 row, u32 col) |
| | Find a cell by row and column.
|
| SCell * | getCell (SSheet *sheet, const char *cellName) |
| | Find a cell by spreadsheet cell name.
|
| std::list< SCell * > | getRange (SSheet *sheet, u32 fromRow, u32 fromCol, u32 toRow, u32 toCol) |
| | Get all cells inside a rectangular range.
|
| std::list< SCell * > | getRange (SSheet *sheet, const char *from, const char *to) |
| | Get all cells inside a named rectangular range.
|
| bool | convertCellName (const char *cellName, u32 &row, u32 &col) |
| | Convert a spreadsheet cell name into row and column indexes.
|
|
void | clear () |
| | Clear all loaded sheets and data.
|
|
| bool | splitCsvLine (const std::string &line, char delimiter, std::vector< std::string > &cells) |
| | Split one CSV line into cell strings.
|
| bool | combineLine (std::vector< std::string > &cols, std::vector< std::string > &cells) |
| | Combine parsed columns with continuation cells for multi-line CSV fields.
|
|
|
std::vector< SSheet * > | m_sheets |
Reader for XML spreadsheet and CSV table data.
The class owns all sheet, row, and cell objects it creates. Pointers returned by lookup functions remain valid until clear or the spreadsheet destructor.
◆ combineLine()
| bool Skylicht::CXMLSpreadsheet::combineLine |
( |
std::vector< std::string > & | cols, |
|
|
std::vector< std::string > & | cells ) |
|
protected |
Combine parsed columns with continuation cells for multi-line CSV fields.
- Parameters
-
| cols | Current accumulated columns. |
| cells | Newly parsed cells. |
- Returns
- True when a complete row is available.
◆ convertCellName()
| bool Skylicht::CXMLSpreadsheet::convertCellName |
( |
const char * | cellName, |
|
|
u32 & | row, |
|
|
u32 & | col ) |
Convert a spreadsheet cell name into row and column indexes.
- Parameters
-
| cellName | Cell name such as A1. |
| row | Receives row index. |
| col | Receives column index. |
- Returns
- True if the name was converted.
◆ getCell() [1/2]
| SCell * Skylicht::CXMLSpreadsheet::getCell |
( |
SSheet * | sheet, |
|
|
const char * | cellName ) |
Find a cell by spreadsheet cell name.
- Parameters
-
| sheet | Sheet to search. |
| cellName | Cell name such as A1. |
- Returns
- Cell pointer, or null when not found.
◆ getCell() [2/2]
| SCell * Skylicht::CXMLSpreadsheet::getCell |
( |
SSheet * | sheet, |
|
|
u32 | row, |
|
|
u32 | col ) |
Find a cell by row and column.
- Parameters
-
| sheet | Sheet to search. |
| row | Row index. |
| col | Column index. |
- Returns
- Cell pointer, or null when not found.
◆ getRange() [1/2]
| std::list< SCell * > Skylicht::CXMLSpreadsheet::getRange |
( |
SSheet * | sheet, |
|
|
const char * | from, |
|
|
const char * | to ) |
Get all cells inside a named rectangular range.
- Parameters
-
| sheet | Sheet to search. |
| from | First cell name, such as A1. |
| to | Last cell name, such as C10. |
- Returns
- List of matching cell pointers.
◆ getRange() [2/2]
| std::list< SCell * > Skylicht::CXMLSpreadsheet::getRange |
( |
SSheet * | sheet, |
|
|
u32 | fromRow, |
|
|
u32 | fromCol, |
|
|
u32 | toRow, |
|
|
u32 | toCol ) |
Get all cells inside a rectangular range.
- Parameters
-
| sheet | Sheet to search. |
| fromRow | First row index. |
| fromCol | First column index. |
| toRow | Last row index. |
| toCol | Last column index. |
- Returns
- List of matching cell pointers.
◆ getSheet()
| SSheet * Skylicht::CXMLSpreadsheet::getSheet |
( |
int | i | ) |
|
|
inline |
Get a sheet by index.
- Parameters
-
- Returns
- Sheet pointer owned by the spreadsheet.
◆ getSheetCount()
| u32 Skylicht::CXMLSpreadsheet::getSheetCount |
( |
| ) |
|
|
inline |
Get the number of loaded sheets.
- Returns
- Sheet count.
◆ open() [1/2]
| bool Skylicht::CXMLSpreadsheet::open |
( |
const char * | file | ) |
|
Load spreadsheet data from an XML file.
- Parameters
-
| file | Path to the XML spreadsheet file. |
- Returns
- True if loading succeeds.
◆ open() [2/2]
| bool Skylicht::CXMLSpreadsheet::open |
( |
io::IXMLReader * | xmlReader | ) |
|
Load spreadsheet data from an existing XML reader.
- Parameters
-
| xmlReader | XML reader positioned at the spreadsheet source. |
- Returns
- True if loading succeeds.
◆ openCSV()
| bool Skylicht::CXMLSpreadsheet::openCSV |
( |
const char * | file | ) |
|
Load spreadsheet data from a CSV file.
- Parameters
-
| file | Path to the CSV file. |
- Returns
- True if loading succeeds.
◆ operator[]()
| SSheet * Skylicht::CXMLSpreadsheet::operator[] |
( |
int | i | ) |
|
|
inline |
Get a sheet by index.
- Parameters
-
- Returns
- Sheet pointer owned by the spreadsheet.
◆ splitCsvLine()
| bool Skylicht::CXMLSpreadsheet::splitCsvLine |
( |
const std::string & | line, |
|
|
char | delimiter, |
|
|
std::vector< std::string > & | cells ) |
|
protected |
Split one CSV line into cell strings.
- Parameters
-
| line | Source CSV line. |
| delimiter | CSV delimiter character. |
| cells | Receives parsed cells. |
- Returns
- True if the line was split successfully.
The documentation for this class was generated from the following file: