ASAPCabinetFE
 
Loading...
Searching...
No Matches
ITableCallbacks Class Referenceabstract

Interface for managing ASAP index file operations. More...

#include <itable_callbacks.h>

+ Inheritance diagram for ITableCallbacks:
+ Collaboration diagram for ITableCallbacks:

Public Member Functions

virtual bool load (const Settings &settings, std::vector< TableData > &tables, LoadingProgress *progress=nullptr)=0
 Loads table data from the ASAP index file.
 
virtual bool save (const Settings &settings, const std::vector< TableData > &tables, LoadingProgress *progress=nullptr)=0
 Saves table data to the ASAP index file.
 
virtual std::vector< TableDatamergeTables (const Settings &settings, const std::vector< TableData > &newTables, LoadingProgress *progress=nullptr)=0
 Merges new table data with existing index data.
 

Detailed Description

Interface for managing ASAP index file operations.

Defines methods for loading, saving, and merging table data, supporting progress tracking and configuration via Settings. Implementers handle JSON serialization and file I/O.

Member Function Documentation

◆ load()

virtual bool ITableCallbacks::load ( const Settings settings,
std::vector< TableData > &  tables,
LoadingProgress progress = nullptr 
)
pure virtual

Loads table data from the ASAP index file.

Reads and parses asapcab_index.json from the specified settings.indexPath, populating the tables vector with TableData objects. Supports progress tracking.

Parameters
settingsThe application settings containing the index file path.
tablesReference to the vector to store the loaded table data.
progressOptional pointer to LoadingProgress for real-time updates.
Returns
True if loading succeeds, false otherwise.

Implemented in AsapIndexManager.

◆ mergeTables()

virtual std::vector< TableData > ITableCallbacks::mergeTables ( const Settings settings,
const std::vector< TableData > &  newTables,
LoadingProgress progress = nullptr 
)
pure virtual

Merges new table data with existing index data.

Compares new table data with existing index entries, updating tables with higher-quality metadata (based on jsonOwner priority), adding new tables, and removing deleted ones. Preserves user fields like playCount. Returns the merged table data.

Parameters
settingsThe application settings containing the index file path.
newTablesThe new table data to merge.
progressOptional pointer to LoadingProgress for real-time updates.
Returns
The merged vector of TableData.

Implemented in AsapIndexManager.

◆ save()

virtual bool ITableCallbacks::save ( const Settings settings,
const std::vector< TableData > &  tables,
LoadingProgress progress = nullptr 
)
pure virtual

Saves table data to the ASAP index file.

Serializes the provided tables vector into a JSON array and writes it to asapcab_index.json at settings.indexPath. Supports progress tracking.

Parameters
settingsThe application settings containing the index file path.
tablesThe vector of TableData to save.
progressOptional pointer to LoadingProgress for real-time updates.
Returns
True if saving succeeds, false otherwise.

Implemented in AsapIndexManager.

+ Here is the caller graph for this function:

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