The manager for interacting with a budget file. More...
#include <BudgetFile.h>
Public Member Functions | |
BudgetFile () | |
BudgetFile (const QString &fileLocation, const QString &backUpExtension=BudgetFile::defaultBackUpExtension_) | |
Initialises the entire object using the supplied values. | |
const QString & | backUpExtension () const |
The extension to use when backing-up a budget file. | |
void | changeLocation (const ::QString &fileLocation) override |
Changes the location of the budget file to load. | |
const QString & | directoryPath () const |
The absolute directory path of the budget file. | |
storage::BudgetLoadValues | load () const override |
Loads the budget file from the local file-system. | |
const QString & | name () const noexcept override |
The file name of the budget file. | |
void | store (const accounting::GeneralLedger &gl, const budgeting::Budget &b, const foundation::TypeIndexMap< budgeting::BudgetSource, accounting::AccountNumber > &budgetCodes, const banking::BankMap &banks, const surveying::CompletedSurveys &surveys) const override |
Creates or overwrites the budget file to the local file-system. When overwriting the budget file, a back-up copy is created in the same directory. | |
![]() | |
BudgetStorage ()=default | |
BudgetStorage (BudgetStorage &&)=default | |
BudgetStorage (const BudgetStorage &)=default | |
virtual | ~BudgetStorage ()=default |
BudgetStorage & | operator= (BudgetStorage &&)=default |
BudgetStorage & | operator= (const BudgetStorage &)=default |
Static Public Attributes | |
static const QChar | defaultBackUpExtension_ |
static const QString | oldBackUpExtension_ |
The extension used when backing-up a back-up to a budget file. | |
The manager for interacting with a budget file.
drn::file_storage::BudgetFile::BudgetFile | ( | ) |
|
explicit |
Initialises the entire object using the supplied values.
Error | When the supplied file location is empty. |
Error | When the supplied file location is not absolute. |
Error | When the supplied back-up extension starts with the full stop file separator ('.'). |
fileLocation | The file name and absolute directory path of the budget file. The text after the last directory separator is assumed to be the name of the budget file. |
backUpExtension | (Optional) The extension to use when backing-up a pre-existing budget file. When this is not the default, it must not start with the full stop. |
|
nodiscard |
The extension to use when backing-up a budget file.
|
overridevirtual |
Changes the location of the budget file to load.
StorageError | When the location is invalid. |
fileLocation | The directory path and file-name of the budget file to use. |
Implements drn::storage::BudgetStorage.
|
nodiscard |
The absolute directory path of the budget file.
|
nodiscardoverridevirtual |
Loads the budget file from the local file-system.
StorageError | When the budget file cannot be found. |
Implements drn::storage::BudgetStorage.
|
nodiscardoverridevirtualnoexcept |
The file name of the budget file.
Implements drn::storage::BudgetStorage.
|
overridevirtual |
Creates or overwrites the budget file to the local file-system. When overwriting the budget file, a back-up copy is created in the same directory.
StorageError | When the budget file cannot be saved. |
StorageError | When the budget file cannot be backed-up prior to saving. |
[in] | gl | The general ledger whose contents are to be stored in the file. |
[in] | b | The budget whose contents are to be stored in the file. |
[in] | budgetCodes | The mapping between each budget item and its ledger account number. |
[in] | banks | The financial institutions whose contents are to be stored in the file. |
Implements drn::storage::BudgetStorage.
|
static |
The default extension used when backing-up a budget file, on systems like KDE this will show a nice back-up icon.
|
static |
The extension used when backing-up a back-up to a budget file.