ocarina/include/core/tags/library.h

62 lines
1.6 KiB
C++

/**
* Copyright 2014 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_TAGS_LIBRARY_H
#define OCARINA_CORE_TAGS_LIBRARY_H
extern "C" {
#include <core/database.h>
}
#include <string>
/**
* The Library tag is used to store a single directory added
* to Ocarina by the user.
*
* When writing a Library tag to disk, write out the _enabled
* and _path fields for each tag.
*
* ... << enabled1 << path1
* ... << enabled2 << path2
* ... << enabled3 << path3
*/
struct library : public db_entry {
unsigned int li_size; /* This library's track count. */
bool li_enabled;/* True if this library is enabled. */
std::string li_path; /* This library's root path. */
library(); /**< Library tag constructor. */
};
#define LIBRARY(dbe) ((struct library *)dbe)
/* Called to initialize the library database. */
void library_db_init();
/* Called to clean up the library database. */
void library_db_deinit();
/* Called to access the library database. */
const struct database *library_db_get();
/* Called to find a library tag by library path. */
struct library *library_find(const std::string &);
/* Called to get a library tag with a specific index. */
struct library *library_get(const unsigned int);
/* Called to remove a specific library tag. */
void library_remove(struct library *);
/* Called to configure if the library tag is enabled. */
void library_set_enabled(struct library *, bool);
/* Called to find the full path of files under the library directory. */
std::string library_file(struct library *, const std::string &);
#ifdef CONFIG_TESTING
const struct db_ops *test_library_ops();
#endif /* CONFIG_TESTING */
#endif /* OCARINA_CORE_TAGS_LIBRARY_H */