/** * Copyright 2014 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_TAGS_LIBRARY_H #define OCARINA_CORE_TAGS_LIBRARY_H #include /** * 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. */ /** * Library tag constructor. * * @param path Path to the library directory on disk. */ library(const std::string &); /** * Called to access the library tag's primary key. * * @return Library::_path. */ const std::string primary_key() const; /** * Read library information from file. * * @param file The file to read from. */ void read(file &); /** * Write library information to file. * * @param file The file to write to. */ void write(file &); }; /* 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 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 &); #endif /* OCARINA_CORE_TAGS_LIBRARY_H */