yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::RomFileManager Class Reference

Handles all ROM file I/O operations. More...

#include <rom_file_manager.h>

Collaboration diagram for yaze::editor::RomFileManager:

Classes

struct  BackupEntry
 

Public Member Functions

 RomFileManager (ToastManager *toast_manager)
 
 ~RomFileManager ()=default
 
absl::Status LoadRom (Rom *rom, const std::string &filename)
 
absl::Status SaveRom (Rom *rom)
 
absl::Status SaveRomAs (Rom *rom, const std::string &filename)
 
absl::Status OpenRomOrProject (Rom *rom, const std::string &filename)
 
absl::Status CreateBackup (Rom *rom)
 
absl::Status ValidateRom (Rom *rom)
 
void SetBackupFolder (const std::string &folder)
 
void SetBackupBeforeSave (bool enabled)
 
void SetBackupRetentionCount (int count)
 
void SetBackupKeepDaily (bool enabled)
 
void SetBackupKeepDailyDays (int days)
 
std::vector< BackupEntryListBackups (const std::string &rom_filename) const
 
absl::Status PruneBackups (const std::string &rom_filename) const
 
bool IsRomLoaded (Rom *rom) const
 
std::string GetRomFilename (Rom *rom) const
 

Private Member Functions

absl::Status LoadRomFromFile (Rom *rom, const std::string &filename)
 
std::string GenerateBackupFilename (const std::string &original_filename) const
 
std::filesystem::path GetBackupDirectory (const std::string &original_filename) const
 
bool IsValidRomFile (const std::string &filename) const
 

Private Attributes

ToastManagertoast_manager_ = nullptr
 
bool backup_before_save_ = true
 
std::string backup_folder_
 
int backup_retention_count_ = 20
 
bool backup_keep_daily_ = true
 
int backup_keep_daily_days_ = 14
 

Detailed Description

Handles all ROM file I/O operations.

Extracted from EditorManager to provide focused ROM file management:

  • ROM loading and saving
  • Asset loading
  • ROM validation and backup
  • File path management

Definition at line 27 of file rom_file_manager.h.

Constructor & Destructor Documentation

◆ RomFileManager()

yaze::editor::RomFileManager::RomFileManager ( ToastManager * toast_manager)
explicit

Definition at line 43 of file rom_file_manager.cc.

◆ ~RomFileManager()

yaze::editor::RomFileManager::~RomFileManager ( )
default

Member Function Documentation

◆ LoadRom()

absl::Status yaze::editor::RomFileManager::LoadRom ( Rom * rom,
const std::string & filename )

◆ SaveRom()

◆ SaveRomAs()

absl::Status yaze::editor::RomFileManager::SaveRomAs ( Rom * rom,
const std::string & filename )

◆ OpenRomOrProject()

absl::Status yaze::editor::RomFileManager::OpenRomOrProject ( Rom * rom,
const std::string & filename )

Definition at line 126 of file rom_file_manager.cc.

References LoadRom().

Here is the call graph for this function:

◆ CreateBackup()

◆ ValidateRom()

absl::Status yaze::editor::RomFileManager::ValidateRom ( Rom * rom)

◆ SetBackupFolder()

void yaze::editor::RomFileManager::SetBackupFolder ( const std::string & folder)
inline

◆ SetBackupBeforeSave()

void yaze::editor::RomFileManager::SetBackupBeforeSave ( bool enabled)
inline

◆ SetBackupRetentionCount()

void yaze::editor::RomFileManager::SetBackupRetentionCount ( int count)
inline

◆ SetBackupKeepDaily()

void yaze::editor::RomFileManager::SetBackupKeepDaily ( bool enabled)
inline

◆ SetBackupKeepDailyDays()

void yaze::editor::RomFileManager::SetBackupKeepDailyDays ( int days)
inline

◆ ListBackups()

◆ PruneBackups()

absl::Status yaze::editor::RomFileManager::PruneBackups ( const std::string & rom_filename) const

Definition at line 329 of file rom_file_manager.cc.

References backup_keep_daily_, backup_keep_daily_days_, backup_retention_count_, ListBackups(), and LOG_WARN.

Referenced by CreateBackup(), and yaze::editor::RomLifecycleManager::PruneRomBackups().

Here is the call graph for this function:

◆ IsRomLoaded()

bool yaze::editor::RomFileManager::IsRomLoaded ( Rom * rom) const

◆ GetRomFilename()

std::string yaze::editor::RomFileManager::GetRomFilename ( Rom * rom) const

Definition at line 210 of file rom_file_manager.cc.

References yaze::Rom::filename(), and IsRomLoaded().

Referenced by yaze::editor::MenuOrchestrator::GetRomFilename().

Here is the call graph for this function:

◆ LoadRomFromFile()

absl::Status yaze::editor::RomFileManager::LoadRomFromFile ( Rom * rom,
const std::string & filename )
private

◆ GenerateBackupFilename()

std::string yaze::editor::RomFileManager::GenerateBackupFilename ( const std::string & original_filename) const
private

Definition at line 249 of file rom_file_manager.cc.

References GetBackupDirectory().

Referenced by CreateBackup().

Here is the call graph for this function:

◆ GetBackupDirectory()

std::filesystem::path yaze::editor::RomFileManager::GetBackupDirectory ( const std::string & original_filename) const
private

Definition at line 272 of file rom_file_manager.cc.

References backup_folder_.

Referenced by GenerateBackupFilename(), and ListBackups().

◆ IsValidRomFile()

bool yaze::editor::RomFileManager::IsValidRomFile ( const std::string & filename) const
private

Definition at line 384 of file rom_file_manager.cc.

Referenced by LoadRomFromFile().

Member Data Documentation

◆ toast_manager_

ToastManager* yaze::editor::RomFileManager::toast_manager_ = nullptr
private

Definition at line 62 of file rom_file_manager.h.

Referenced by CreateBackup(), LoadRomFromFile(), SaveRom(), SaveRomAs(), and ValidateRom().

◆ backup_before_save_

bool yaze::editor::RomFileManager::backup_before_save_ = true
private

Definition at line 71 of file rom_file_manager.h.

Referenced by SaveRom(), SaveRomAs(), and SetBackupBeforeSave().

◆ backup_folder_

std::string yaze::editor::RomFileManager::backup_folder_
private

Definition at line 72 of file rom_file_manager.h.

Referenced by GetBackupDirectory(), and SetBackupFolder().

◆ backup_retention_count_

int yaze::editor::RomFileManager::backup_retention_count_ = 20
private

Definition at line 73 of file rom_file_manager.h.

Referenced by PruneBackups(), and SetBackupRetentionCount().

◆ backup_keep_daily_

bool yaze::editor::RomFileManager::backup_keep_daily_ = true
private

Definition at line 74 of file rom_file_manager.h.

Referenced by PruneBackups(), and SetBackupKeepDaily().

◆ backup_keep_daily_days_

int yaze::editor::RomFileManager::backup_keep_daily_days_ = 14
private

Definition at line 75 of file rom_file_manager.h.

Referenced by PruneBackups(), and SetBackupKeepDailyDays().


The documentation for this class was generated from the following files: