EHM DAL 0.2.3
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
ehm_dal::file_io::AbstractFileManager Class Referenceabstract

The AbstractFileManager class is a base class providing simple read and write file access to database and saved game files. More...

#include <abstract_file_manager.h>

Inheritance diagram for ehm_dal::file_io::AbstractFileManager:

Public Member Functions

 AbstractFileManager (const QString &folder_path_key)
 
bool close (const bool show_confirmation_dialog=true)
 Closes the active database/saved game and clears all tables.
 
virtual QString descriptor () const =0
 Returns the file manager descriptor. E.g. This will return "database" for a database file manager.
 
virtual QString fileFilterString () const =0
 Returns a list of supported file type filters for QFileDialog.
 
bool open (const QString &path)
 Opens the file at path.
 
bool open (QWidget *parent=nullptr)
 Displays a file dialog window and opens the user selected file.
 
bool save ()
 Saves the data to the existing file.
 
bool saveAs (QWidget *parent=nullptr)
 Displays a file dialog window and saves the user selected destination.
 
bool isOpen () const
 Returns whether or not a file is presently open.
 
bool isSaved () const
 Returns whether or not the file has been previously saved.
 

Protected Member Functions

void setOpenStatus (const bool is_open)
 
void setSaveStatus (const bool has_been_saved)
 

Detailed Description

The AbstractFileManager class is a base class providing simple read and write file access to database and saved game files.

Member Function Documentation

◆ close()

bool ehm_dal::file_io::AbstractFileManager::close ( const bool  show_confirmation_dialog = true)

Closes the active database/saved game and clears all tables.

Parameters
show_confirmation_dialogindicates whether or not to display a dialog asking the user to confirm
Returns
whether or not successful

◆ descriptor()

virtual QString ehm_dal::file_io::AbstractFileManager::descriptor ( ) const
pure virtual

Returns the file manager descriptor. E.g. This will return "database" for a database file manager.

Implemented in ehm_dal::file_io::DatabaseFileManager, and ehm_dal::file_io::SavedGameFileManager.

◆ fileFilterString()

virtual QString ehm_dal::file_io::AbstractFileManager::fileFilterString ( ) const
pure virtual

Returns a list of supported file type filters for QFileDialog.

Implemented in ehm_dal::file_io::DatabaseFileManager, and ehm_dal::file_io::SavedGameFileManager.

◆ open() [1/2]

bool ehm_dal::file_io::AbstractFileManager::open ( const QString &  path)

Opens the file at path.

Parameters
pathfile path
Returns
whether or not successful

◆ open() [2/2]

bool ehm_dal::file_io::AbstractFileManager::open ( QWidget *  parent = nullptr)

Displays a file dialog window and opens the user selected file.

Parameters
parentparent widget for the dialog window
Returns
whether or not successful

◆ save()

bool ehm_dal::file_io::AbstractFileManager::save ( )

Saves the data to the existing file.

Returns
whether or not successful

◆ saveAs()

bool ehm_dal::file_io::AbstractFileManager::saveAs ( QWidget *  parent = nullptr)

Displays a file dialog window and saves the user selected destination.

Parameters
parentparent widget for the dialog window
Returns
whether or not successful