Handles all ROM file I/O operations. More...
#include <rom_file_manager.h>
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) |
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 |
bool | IsValidRomFile (const std::string &filename) const |
Private Attributes | |
ToastManager * | toast_manager_ = nullptr |
Handles all ROM file I/O operations.
Extracted from EditorManager to provide focused ROM file management:
Definition at line 24 of file rom_file_manager.h.
|
explicit |
Definition at line 14 of file rom_file_manager.cc.
|
default |
absl::Status yaze::editor::RomFileManager::LoadRom | ( | Rom * | rom, |
const std::string & | filename | ||
) |
Definition at line 17 of file rom_file_manager.cc.
References LoadRomFromFile().
Referenced by yaze::editor::EditorManager::LoadRom(), yaze::editor::EditorManager::OpenProject(), yaze::editor::EditorManager::OpenRomOrProject(), and OpenRomOrProject().
absl::Status yaze::editor::RomFileManager::SaveRom | ( | Rom * | rom | ) |
Definition at line 27 of file rom_file_manager.cc.
References yaze::Rom::SaveSettings::backup, IsRomLoaded(), yaze::editor::kError, yaze::editor::kSuccess, yaze::Rom::SaveSettings::save_new, yaze::Rom::SaveToFile(), yaze::editor::ToastManager::Show(), toast_manager_, and yaze::Rom::SaveSettings::z3_save.
Referenced by yaze::editor::EditorManager::SaveRom().
absl::Status yaze::editor::RomFileManager::SaveRomAs | ( | Rom * | rom, |
const std::string & | filename | ||
) |
Definition at line 48 of file rom_file_manager.cc.
References yaze::Rom::SaveSettings::backup, yaze::Rom::SaveSettings::filename, IsRomLoaded(), yaze::editor::kError, yaze::editor::kSuccess, yaze::Rom::SaveSettings::save_new, yaze::Rom::SaveToFile(), yaze::editor::ToastManager::Show(), toast_manager_, and yaze::Rom::SaveSettings::z3_save.
Referenced by yaze::editor::EditorManager::SaveRomAs().
absl::Status yaze::editor::RomFileManager::OpenRomOrProject | ( | Rom * | rom, |
const std::string & | filename | ||
) |
Definition at line 76 of file rom_file_manager.cc.
References LoadRom().
absl::Status yaze::editor::RomFileManager::CreateBackup | ( | Rom * | rom | ) |
Definition at line 96 of file rom_file_manager.cc.
References yaze::Rom::SaveSettings::backup, yaze::Rom::SaveSettings::filename, yaze::Rom::filename(), GenerateBackupFilename(), IsRomLoaded(), yaze::editor::kError, yaze::editor::kSuccess, yaze::Rom::SaveToFile(), yaze::editor::ToastManager::Show(), toast_manager_, and yaze::Rom::SaveSettings::z3_save.
absl::Status yaze::editor::RomFileManager::ValidateRom | ( | Rom * | rom | ) |
Definition at line 121 of file rom_file_manager.cc.
References IsRomLoaded(), yaze::editor::kSuccess, yaze::editor::ToastManager::Show(), yaze::Rom::size(), yaze::Rom::title(), and toast_manager_.
Referenced by yaze::editor::MenuOrchestrator::OnValidateRom().
bool yaze::editor::RomFileManager::IsRomLoaded | ( | Rom * | rom | ) | const |
Definition at line 139 of file rom_file_manager.cc.
References yaze::Rom::is_loaded().
Referenced by yaze::editor::MenuOrchestrator::CanSaveRom(), CreateBackup(), GetRomFilename(), yaze::editor::MenuOrchestrator::HasActiveRom(), SaveRom(), SaveRomAs(), and ValidateRom().
std::string yaze::editor::RomFileManager::GetRomFilename | ( | Rom * | rom | ) | const |
Definition at line 143 of file rom_file_manager.cc.
References yaze::Rom::filename(), and IsRomLoaded().
Referenced by yaze::editor::MenuOrchestrator::GetRomFilename().
|
private |
Definition at line 150 of file rom_file_manager.cc.
References IsValidRomFile(), yaze::editor::kError, yaze::editor::kSuccess, yaze::Rom::LoadFromFile(), yaze::editor::ToastManager::Show(), yaze::Rom::title(), and toast_manager_.
Referenced by LoadRom().
|
private |
Definition at line 177 of file rom_file_manager.cc.
Referenced by CreateBackup().
|
private |
Definition at line 189 of file rom_file_manager.cc.
Referenced by LoadRomFromFile().
|
private |
Definition at line 42 of file rom_file_manager.h.
Referenced by CreateBackup(), LoadRomFromFile(), SaveRom(), SaveRomAs(), and ValidateRom().