2021-12-24 09:01:21 +00:00
|
|
|
//
|
|
|
|
// NSTableViewDataSource+sqlite.h
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Christopher Snowhill on 12/22/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef NSTableViewDataSource_sqlite_h
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <sqlite3.h>
|
|
|
|
#import "PlaylistEntry.h"
|
|
|
|
|
|
|
|
@interface SQLiteStore : NSObject
|
|
|
|
{
|
|
|
|
@private NSString *g_databasePath;
|
|
|
|
@private sqlite3 *g_database;
|
|
|
|
@private sqlite3_stmt *stmt[38];
|
2022-01-15 06:42:57 +00:00
|
|
|
@private NSMutableArray *databaseMirror;
|
2021-12-24 09:01:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@property (nonatomic, readwrite) NSString *databasePath;
|
|
|
|
@property (nonatomic, assign, readwrite) sqlite3 *database;
|
|
|
|
|
|
|
|
+ (SQLiteStore *)sharedStore;
|
|
|
|
|
|
|
|
- (id)init;
|
|
|
|
- (void)dealloc;
|
|
|
|
|
|
|
|
- (void) trackUpdate:(PlaylistEntry *)track;
|
|
|
|
|
2022-01-09 10:10:08 +00:00
|
|
|
- (void)playlistInsertTracks:(NSArray *)tracks atIndex:(int64_t)index progressCall:(void(^)(double progress))callback;
|
|
|
|
- (void)playlistInsertTracks:(NSArray *)tracks atObjectIndexes:(NSIndexSet *)indexes progressCall:(void(^)(double progress))callback;
|
|
|
|
- (void)playlistRemoveTracks:(int64_t)index forCount:(int64_t)count progressCall:(void(^)(double progress))callback;
|
|
|
|
- (void)playlistRemoveTracksAtIndexes:(NSIndexSet *)indexes progressCall:(void(^)(double progress))callback;
|
2021-12-24 09:01:21 +00:00
|
|
|
- (PlaylistEntry *)playlistGetItem:(int64_t)index;
|
2022-01-15 06:42:57 +00:00
|
|
|
- (PlaylistEntry *)playlistGetCachedItem:(int64_t)index;
|
2021-12-24 09:01:21 +00:00
|
|
|
- (int64_t)playlistGetCount;
|
|
|
|
#if 0
|
|
|
|
- (void)playlistMoveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex;
|
|
|
|
#endif
|
|
|
|
|
2022-01-09 10:10:08 +00:00
|
|
|
- (void)syncPlaylistEntries:(NSArray *)entries progressCall:(void(^)(double progress))callback;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
|
|
|
- (void)queueAddItem:(int64_t)playlistIndex;
|
|
|
|
- (void)queueAddItems:(NSArray *)playlistIndexes;
|
|
|
|
- (void)queueRemoveItem:(int64_t)queueIndex;
|
|
|
|
- (void)queueRemovePlaylistItems:(NSArray *)playlistIndexes;
|
|
|
|
- (int64_t)queueGetEntry:(int64_t)queueIndex;
|
|
|
|
- (int64_t)queueGetCount;
|
|
|
|
- (void)queueEmpty;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#define NSTableViewDataSource_sqlite_h
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* NSTableViewDataSource_sqlite_h */
|