summaryrefslogtreecommitdiff
path: root/taro/db.h
blob: abc0d03ae8da46da1ebe651ead9513372e614690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <al/array.h>
#include <al/wstr.h>

enum {
    PROP_TYPE_BOOL,
    PROP_TYPE_SLIDER,
    PROP_TYPE_UNKNOWN
};

struct slider_value {
    f64 min, max;
    f64 step;
    f64 value;
};

struct prop {
    u8 type;
    wstr title;
    void *value;
};

struct entry {
    str id;
    str path;
    s64 compare;
    bool loaded;
    bool has_package;
    str preview_path;
    bool has_preview;
    wstr title;
    array(struct prop) props;
};

struct db {
    array(struct entry) entries;
};

void db_init(struct db *db);
bool db_load_entries(struct db *db, str *path);
void db_sort(struct db *db);
bool db_ensure_entry_loaded(struct db *db, struct entry *e);
void db_unload(struct db *db);