Anna Schumaker
1c22ecfda4
core/database: De-templatize the database
...
We now have an interface for controlling everything through struct
db_entry, so let's just have the database store a db_entry directly.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
1bef380ba7
core/database: Introduce the dbe_key() database operation
...
And store the result in the db_entry struct for use later.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
f51852f62e
core/database: Introduce the dbe_write() database operation
...
For writing database entries to disk.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
2da33f1c75
core/database: Introduce the dbe_read() database operation
...
This function allocates and returns a new database entry using
information read from a file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
c77ca65630
core/database: Introduce the dbe_setup() database operation
...
Track tags need to add themselves to the filter index and update the
library track count once added to the database.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
c8021639ba
core/database: Introduce the dbe_free() database operation
...
The Track tag needs to do some cleanup when removed from a database, so
we need to use this op when removing items.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
049156a523
core/database: Introduce the dbe_alloc() database operation
...
For allocating new database items from a given key. Tracks do not need
this function since we have special handling for creation and insertion.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
ab1572ed34
core/database: Add operations vector
...
I intend to replace C++ inheritance with this struct of function
pointers.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:48:18 -05:00
Anna Schumaker
446f1228cf
core/tags/library: Add library_file() function
...
To help with finding the full path of files that are located in the
library's directory.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
24504c7de8
core/tags/library: Remove library size() and {inc|dec}_size() functions
...
We can just access this variable directly instead.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
ac2b4ad52c
core/tags/library: Remove library enabled() function
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
47ab4c4b17
core/tags/library: Move library_set_enabled() out of the library struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
f41235e5b2
core/tags/library: Replace tags :: library_size() with library_db_get()
...
It's easier to just pass off the library database rather than forcing
higher layers to iterate over the entire thing (including possible
invalid entries).
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
768f86e802
core/tags/library: Move library_db_init() out of the tags namespace
...
And add the function library_db_deinit().
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
d7cff5faf4
core/tags/library: Move library_remove() out of tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
a288922b65
core/tags/library: Move library_find() out of the tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
e1093f7eab
core/tags/library: Move library_get() out of the tags namespace
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
ffa5e65ba7
core/tags/library: Convert Library class to a struct
...
I also have to replace the "library" namespace with the "collection"
namespace to avoid naming collisions.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
2c5b14c7f3
core/database: Replace database constructor and destructor
...
Use db_init() and db_deinit() instead.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
ffd38bd28b
core/database: Move db_find() out of the database struct
...
I also take the chance to modify this function slightly. Now, if a
matching item could not be found a new item will be allocated.
I added the new function db_get() if callers just want to get an item
without allocating.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
f2f23cb225
core/database: Move db_at() out of the database struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
929279259d
core/database: Move db_remove() out of the database struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
9c358539fe
core/database: Move db_insert() out of the database struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
68c953f186
core/database: Move db_{save|autosave}() out of the database struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
8486fc6111
core/database: Move db_load() out of the database struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
3a74cb0aa5
core/database: Move db_actual_size() out of the database struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
8a4e9fc2bc
core/database: Convert class to a struct
...
In addition, we lowercase variable names and add a db_ prefix to all
struct members.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-12-10 16:41:33 -05:00
Anna Schumaker
7529ccd4cc
core/file: Switch file_readl() to return a gchar *
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:06 -04:00
Anna Schumaker
dbd27d1297
core/file: Use a C-style file stream for reading from files
...
I also introduced a file_readf() function to make it easier to read a
formatted string from the file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:23:05 -04:00
Anna Schumaker
f24da08d85
core/file: Use a C-style file stream for writing to files
...
I also introduced a file_writef() function to make it easier to write a
formatted string to the file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-12 08:22:36 -04:00
Anna Schumaker
3b220d3f3a
core/file: Move file_readl() out of the file struct
...
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-09 09:14:34 -04:00
Anna Schumaker
1dcc56c87e
core/file: Convert class to a struct
...
In addition, we lowercase variable names and add an f_ prefix to all
struct mebers.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-10-07 10:39:51 -04:00
Anna Schumaker
ead1397b31
Remove Doxygen tags
...
I wasn't actually using Doxygen for anything, so it's probably best just
to remove it.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2015-09-02 14:24:42 -04:00
Anna Schumaker
f433ced9cb
Library: Add functions for looking up or creating Library tags
...
This patch moves the library_db into tags/library.cpp, where it can be
effectively managed by the Library tag. For this to work, I need to add
some extra functions to the tags namespace to:
- Create new Library tags,
- Find tags by index,
- Remove the Library at a specific index, and
- Find the actual size of the library_db.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker
d88f008728
Library: Update documentation for the Library tag
...
I also take the chance to remove the corresponding section of the DESIGN
file.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker
ce8b3ada03
Library: Rename count -> _size
...
Also make it private and provide accessor functions.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker
754d45efd0
Library: Make _enabled private
...
I added in accessor functions to get and set this value.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker
01e514736e
Library Tag: Make root_path private
...
And just change the name of the variable to "_path".
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00
Anna Schumaker
4d6cb81f77
Library: Move the Library tag into a new file
...
No code or documentation changes yet, just split things out for now.
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
2014-12-04 08:31:51 -05:00