|
EHM DAL 0.2.5
Data abstraction layer for Eastside Hockey Manager
|
Public Types | |
| enum class | DateFormat { DateMonthYear , MonthDateYear , YearMonthDate } |
| The DateFormat enum represents the date format used when returning cell data. More... | |
Public Member Functions | |
| Spreadsheet (const QString &file_path=QString()) | |
| Spreadsheet (const QString &folder_path, const QString &file_name) | |
| Spreadsheet (const settings::FolderPath &path) | |
| void | add () |
| void | add (const QString &text) |
| void | add (const QVariant &data) |
| void | add (const QVariant &data, const qint32 row) |
| void | add (const QVariant &data, const qint32 start_row, const qint32 row_count) |
| void | add (ehm_dal::tables::AbstractTable *model, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds all rows and columns from model to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole. | |
| void | add (ehm_dal::tables::AbstractTable *model, const qint32 row, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds the selected row and all columns from model to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole. | |
| void | add (ehm_dal::tables::AbstractTable *model, const std::vector< qint32 > &rows, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds the selected rows and all columns from model to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole. | |
| void | add (const ehm_dal::column_data::ColumnIndexList &columns, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds all rows and selected columns to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole. | |
| void | add (const ehm_dal::column_data::ColumnIndexList &columns, const qint32 row, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds selected row and columns to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole. | |
| void | add (const ehm_dal::column_data::ColumnIndexList &columns, const std::vector< qint32 > &rows, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds selected rows and columns to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole. | |
| void | add (QAbstractTableModel *model, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds all rows and columns from model to the spreadsheet. This is generally used to export a QAbstractTableModel using Qt::DisplayRole or Qt::EditRole. | |
| void | add (QAbstractTableModel *model, const qint32 row, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds the selected row and all columns from model to the spreadsheet. This is generally used to export a QAbstractTableModel using Qt::DisplayRole or Qt::EditRole. | |
| void | add (QAbstractTableModel *model, const std::vector< qint32 > &rows, const Qt::ItemDataRole role=Qt::DisplayRole) |
Adds the selected rows and all columns from model to the spreadsheet. This is generally used to export a QAbstractTableModel using Qt::DisplayRole or Qt::EditRole. | |
| void | add (const ehm_dal::data_types::Pointer &pointer, const Qt::ItemDataRole role=Qt::DisplayRole) |
| Adds all columns of the selected Pointer to the spreadsheet. | |
| void | add (const ehm_dal::data_types::Pointer &pointer, const std::vector< qint32 > &column_index_list, const Qt::ItemDataRole role=Qt::DisplayRole) |
| Adds the selected columns of the selected Pointer to the spreadsheet. | |
| void | add (const std::vector< ehm_dal::data_types::Pointer > &pointer_list, const Qt::ItemDataRole role=Qt::DisplayRole) |
| Adds all columns of the selected Pointers to the spreadsheet. | |
| void | add (const std::vector< ehm_dal::data_types::Pointer > &pointer_list, const std::vector< qint32 > &column_index_list, const Qt::ItemDataRole role=Qt::DisplayRole) |
| Adds the selected columns of the selected Pointers to the spreadsheet. | |
| void | addPrefix () |
| Adds a blank cell to the current prefix row. | |
| void | addPrefix (const QVariant &data) |
Adds data to the current prefix row. | |
| void | addHeader () |
| Adds a blank cell to the current header row. | |
| void | addHeader (const QString &text) |
Adds text to the current header row. | |
| void | addHeader (const QStringList &text_list) |
Adds the text_list to the current header row. | |
| void | addHeader (const QVariant &data) |
Adds data to the current header row. | |
| void | addHeader (QAbstractTableModel *model) |
| Adds a header row of column names of all columns from the 'model'. This is typically used to add the names of all columns from a Table as a header row to the spreadsheet. | |
| void | addHeader (const ehm_dal::column_data::ColumnIndexList &columns) |
Adds a header row of column names corresponding to the columns. | |
| void | addHeader (QAbstractTableModel *model, const std::vector< qint32 > &column_index_list) |
| Adds a header row of column names of the selected columns from the 'model'. This is typically used to add the names of the selected columns from a Table as a header row to the spreadsheet. | |
| void | addHeaderPrefix () |
| Adds a blank cell to the current prefix header row. | |
| void | addHeaderPrefix (const QVariant &data) |
Adds data to the current prefix header row. | |
| void | printDiagnosticData () const |
| Prints various diagnostic data to the console. | |
| QString | file () |
| Returns the file path, file base name and file extension. | |
| QString | fileExtension () const |
| Returns the file extension of the output spreadsheet. | |
| QString | fileName () |
| Returns the file name of the output spreadsheet without the file extension. | |
| QString | fileNameAndExtension () |
| Returns the file and extension of the output spreadsheet. | |
| QString | folderPath () const |
| Returns the file path. | |
| QString | identifier () |
| Returns the identifier text string located at the top left cell (i.e. Cell A1). | |
| void | addFileNameSuffix (const QString &suffix) |
Adds suffix to the end of the file name. | |
| bool | setFile (const QString &path) |
Set the file path, name and extension from path. | |
| bool | setFileName (const QString &file_name) |
Set the file name from file_name. | |
| bool | open (const QString &file_path) |
| Opens a file without showing a dialog window. | |
| bool | open (const QString &folder, const QString &file_name) |
| Opens a file without showing a dialog window. | |
| bool | read () |
| Reads the current file. | |
| bool | save (const QString &folder, const QString &file_name) |
| Saves the spreadsheet to the selected folder path and file name. | |
| bool | write () |
| Writes/saves the spreadsheet to the output file. | |
| bool | showOpenDialog (QString file_path=QString(), const bool read_data=true) |
| Displays a dialog window allowing the user to select a spreadsheet to open. | |
| bool | showOpenDialog (settings::FolderPath &path, const bool read_data=true) |
| Displays a dialog window allowing the user to select a spreadsheet to open. | |
| bool | showSaveDialog (const QString &file_name="output.csv", QString file_path=QString()) |
| Displays a dialog window allowing the user to save the spreadsheet. | |
| bool | showSaveDialog (settings::FolderPath &path) |
| Displays a dialog window allowing the user to save the spreadsheet. | |
| QVariant | cell (const qint32 row, const qint32 col, const bool return_as_date=false) const |
Returns the data located at row and col. | |
| std::span< const QVariant > | cells (const qint32 row, const qint32 col, const qint32 col_count) const |
Returns the cell data as a QDate located at row and col. | |
| bool | columnContainsData (const qint32 column) const |
| Returns whether a column contains any data. | |
| qint32 | columnCount (const qint32 row) const |
| Returns the column count for the selected row. | |
| std::span< const QVariant > | row (const qint32 row) const |
Returns the data of the entirety of the selected row. | |
| qint32 | rowCount () const |
| Returns the data row count. | |
| QVariant | prefix (const qint32 row) const |
| bool | hasPrefixData () const |
| qint32 | prefixCount () const |
| std::span< const QVariant > | header (const qint32 row) const |
| QVariant | headerCell (const qint32 row, const quint16 col) const |
| qint32 | headerCount () const |
| QVariant | prefixHeader (const qint32 row) const |
| bool | hasPrefixHeaderData () const |
| qint32 | prefixHeaderCount () const |
| void | addNewHeaderRow () |
| Adds a new header row. | |
| void | addNewRow () |
| Adds a new data row. | |
| void | setHeaderCount (const qint32 header_row_count) |
Sets the number of header rows to header_row_count. | |
| std::unique_ptr< SpreadsheetFile > | newSpreadsheet (QFile &f) |
Creates a new spreadsheet from f and returns a pointer to the created ehm_dal::spreadsheet::SpreadsheetFile. | |
Static Public Member Functions | |
| static DateFormat | dateFormat () |
| Returns the current date format used when returning cell data. | |
| static QString | dateFormatString () |
| Returns the current date format used when returning cell data. | |
| static void | setDateFormat (const DateFormat date_format) |
Sets the data format to date_format when returning cell data. This can be modified before or after reading spreadsheet data. | |
| static qint32 | defaultFileExtension () |
| Returns the default file extension. | |
| static QString | fileExtensionListAsString (const bool merged_list=true) |
| Returns a list of supported file extensions. | |
| static QStringList | fileExtensionListAsStringList () |
| Returns a list of supported file extensions. | |
| static void | setDefaultFileExtension (const qint32 i) |
Set the default file extension to i. | |
| static QString | exportPath () |
| Returns the default file path used for exporting data. | |
| static QString | importPath () |
| Returns the default file path used for importing data. | |
|
strong |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const ehm_dal::column_data::ColumnIndexList & | columns, |
| const qint32 | row, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds selected row and columns to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole.
| columns | Source list of columns |
| row | Selected row index |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const ehm_dal::column_data::ColumnIndexList & | columns, |
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds all rows and selected columns to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole.
| columns | Source list of columns |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const ehm_dal::column_data::ColumnIndexList & | columns, |
| const std::vector< qint32 > & | rows, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds selected rows and columns to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole.
| columns | Source list of columns |
| rows | Selected row indexes |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const ehm_dal::data_types::Pointer & | pointer, |
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds all columns of the selected Pointer to the spreadsheet.
| pointer | Source pointer |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const ehm_dal::data_types::Pointer & | pointer, |
| const std::vector< qint32 > & | column_index_list, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds the selected columns of the selected Pointer to the spreadsheet.
| pointer | Source pointer |
| column_index_list | Column indexes to be added |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const std::vector< ehm_dal::data_types::Pointer > & | pointer_list, |
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds all columns of the selected Pointers to the spreadsheet.
| pointer_list | Source pointers |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | const std::vector< ehm_dal::data_types::Pointer > & | pointer_list, |
| const std::vector< qint32 > & | column_index_list, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds the selected columns of the selected Pointers to the spreadsheet.
| pointer_list | Source pointers |
| column_index_list | Column indexes to be added |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | ehm_dal::tables::AbstractTable * | model, |
| const qint32 | row, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds the selected row and all columns from model to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole.
| model | Source ehm_dal::tables::AbstractTable |
| row | Source row index |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | ehm_dal::tables::AbstractTable * | model, |
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds all rows and columns from model to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole.
| model | Source ehm_dal::tables::AbstractTable |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | ehm_dal::tables::AbstractTable * | model, |
| const std::vector< qint32 > & | rows, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds the selected rows and all columns from model to the spreadsheet. This is generally used to export a ehm_dal::tables::AbstractTable using Qt::DisplayRole or Qt::EditRole.
| model | Source ehm_dal::tables::AbstractTable |
| rows | Source row indexes |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | QAbstractTableModel * | model, |
| const qint32 | row, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds the selected row and all columns from model to the spreadsheet. This is generally used to export a QAbstractTableModel using Qt::DisplayRole or Qt::EditRole.
| model | Source QAbstractTableModel |
| row | Source row index |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | QAbstractTableModel * | model, |
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds all rows and columns from model to the spreadsheet. This is generally used to export a QAbstractTableModel using Qt::DisplayRole or Qt::EditRole.
| model | Source QAbstractTableModel |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::add | ( | QAbstractTableModel * | model, |
| const std::vector< qint32 > & | rows, | ||
| const Qt::ItemDataRole | role = Qt::DisplayRole |
||
| ) |
Adds the selected rows and all columns from model to the spreadsheet. This is generally used to export a QAbstractTableModel using Qt::DisplayRole or Qt::EditRole.
| model | Source QAbstractTableModel |
| row | Source row indexes |
| role | Source data role |
| void ehm_dal::spreadsheet::Spreadsheet::addFileNameSuffix | ( | const QString & | suffix | ) |
Adds suffix to the end of the file name.
| suffix |
| void ehm_dal::spreadsheet::Spreadsheet::addHeader | ( | const ehm_dal::column_data::ColumnIndexList & | columns | ) |
Adds a header row of column names corresponding to the columns.
| columns | Source list of columns |
|
inline |
Adds text to the current header row.
| text | Text to be added |
| void ehm_dal::spreadsheet::Spreadsheet::addHeader | ( | const QStringList & | text_list | ) |
Adds the text_list to the current header row.
| text_list | QStringList to be added |
| void ehm_dal::spreadsheet::Spreadsheet::addHeader | ( | const QVariant & | data | ) |
Adds data to the current header row.
| data | Data to be added |
| void ehm_dal::spreadsheet::Spreadsheet::addHeader | ( | QAbstractTableModel * | model | ) |
Adds a header row of column names of all columns from the 'model'. This is typically used to add the names of all columns from a Table as a header row to the spreadsheet.
| model | Source QAbstractTableModel or Table |
| void ehm_dal::spreadsheet::Spreadsheet::addHeader | ( | QAbstractTableModel * | model, |
| const std::vector< qint32 > & | column_index_list | ||
| ) |
Adds a header row of column names of the selected columns from the 'model'. This is typically used to add the names of the selected columns from a Table as a header row to the spreadsheet.
| model | Source QAbstractTableModel or Table |
| column_index_list | Column indexes to be added |
|
inline |
Adds data to the current prefix header row.
| data | Data to be added |
|
inline |
Adds data to the current prefix row.
| data | Data to be added |
| QVariant ehm_dal::spreadsheet::Spreadsheet::cell | ( | const qint32 | row, |
| const qint32 | col, | ||
| const bool | return_as_date = false |
||
| ) | const |
Returns the data located at row and col.
| row | Row index |
| col | Column index |
| std::span< const QVariant > ehm_dal::spreadsheet::Spreadsheet::cells | ( | const qint32 | row, |
| const qint32 | col, | ||
| const qint32 | col_count | ||
| ) | const |
Returns the cell data as a QDate located at row and col.
| row | Row index |
| col | Column index |
| return_as_date | True = return the value as a date |
| bool ehm_dal::spreadsheet::Spreadsheet::columnContainsData | ( | const qint32 | column | ) | const |
Returns whether a column contains any data.
| column | Column index |
| qint32 ehm_dal::spreadsheet::Spreadsheet::columnCount | ( | const qint32 | row | ) | const |
Returns the column count for the selected row.
| row | Row index |
| QString ehm_dal::spreadsheet::Spreadsheet::fileExtension | ( | ) | const |
Returns the file extension of the output spreadsheet.
|
static |
Returns a list of supported file extensions.
| merged_list | If true, the list will include ";;" separators for use as individual file filters. |
| std::unique_ptr< SpreadsheetFile > ehm_dal::spreadsheet::Spreadsheet::newSpreadsheet | ( | QFile & | f | ) |
Creates a new spreadsheet from f and returns a pointer to the created ehm_dal::spreadsheet::SpreadsheetFile.
| f | Source QFile |
ehm_dal::spreadsheet::SpreadsheetFile | bool ehm_dal::spreadsheet::Spreadsheet::open | ( | const QString & | file_path | ) |
Opens a file without showing a dialog window.
| file_path | Folder path and file name to be opened |
| bool ehm_dal::spreadsheet::Spreadsheet::open | ( | const QString & | folder, |
| const QString & | file_name | ||
| ) |
Opens a file without showing a dialog window.
| folder | Folder path |
| file_name | File name |
| bool ehm_dal::spreadsheet::Spreadsheet::read | ( | ) |
Reads the current file.
| std::span< const QVariant > ehm_dal::spreadsheet::Spreadsheet::row | ( | const qint32 | row | ) | const |
Returns the data of the entirety of the selected row.
| row | Row index |
|
inline |
Returns the data row count.
| bool ehm_dal::spreadsheet::Spreadsheet::save | ( | const QString & | folder, |
| const QString & | file_name | ||
| ) |
Saves the spreadsheet to the selected folder path and file name.
| folder | Folder path |
| file_name | File name |
|
static |
Sets the data format to date_format when returning cell data. This can be modified before or after reading spreadsheet data.
| date_format | Selected DateFormat |
|
static |
Set the default file extension to i.
| i | Spreadsheet::ENUM_FILE_EXTENSIONS |
| bool ehm_dal::spreadsheet::Spreadsheet::setFile | ( | const QString & | path | ) |
Set the file path, name and extension from path.
| path |
path contains any text. | bool ehm_dal::spreadsheet::Spreadsheet::setFileName | ( | const QString & | file_name | ) |
Set the file name from file_name.
| file_name |
file_name contains any text. | void ehm_dal::spreadsheet::Spreadsheet::setHeaderCount | ( | const qint32 | header_row_count | ) |
Sets the number of header rows to header_row_count.
| header_row_count |
| bool ehm_dal::spreadsheet::Spreadsheet::showOpenDialog | ( | QString | file_path = QString(), |
| const bool | read_data = true |
||
| ) |
Displays a dialog window allowing the user to select a spreadsheet to open.
| file_path | Initial file path to show in the dialog |
| read_data | True = read the file. False = do not read the file. |
false if the user has clicked cancel. | bool ehm_dal::spreadsheet::Spreadsheet::showOpenDialog | ( | settings::FolderPath & | path, |
| const bool | read_data = true |
||
| ) |
Displays a dialog window allowing the user to select a spreadsheet to open.
| path | Initial file path to show in the dialog |
| read_data | True = read the file. False = do not read the file. |
false if the user has clicked cancel. | bool ehm_dal::spreadsheet::Spreadsheet::showSaveDialog | ( | const QString & | file_name = "output.csv", |
| QString | file_path = QString() |
||
| ) |
Displays a dialog window allowing the user to save the spreadsheet.
| file_name | Initial file name to show in the dialog |
| file_path | Initial file path to show in the dialog |
false if the user has clicked cancel. | bool ehm_dal::spreadsheet::Spreadsheet::showSaveDialog | ( | settings::FolderPath & | path | ) |
Displays a dialog window allowing the user to save the spreadsheet.
| Initial | file path to show in the dialog |
false if the user has clicked cancel. | bool ehm_dal::spreadsheet::Spreadsheet::write | ( | ) |
Writes/saves the spreadsheet to the output file.