/** * Copyright 2014 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_TAGS_LIBRARY_H #define OCARINA_CORE_TAGS_LIBRARY_H #include #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 DatabaseEntry { 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 check if this library path is currently enabled. * * @return Library::_enabled. */ const bool enabled(); /** * Called to set if this library path is enabled. * * @param enabled True if this path should be enabled, false otherwise. */ void set_enabled(bool); /** * Called to access the number of tracks in this library. * * @return Library::_size. */ const unsigned int size(); /** * Used to increase Library::_size by 1. */ void inc_size(); /** * Used to decrease Library::_size by 1. */ void dec_size(); }; namespace tags { /** Called to read the library_db from disk. */ void init_library_db(); /** * Called to find the number of rows in the library_db, * including NULL rows. * * @return The Database::actual_size() of the library_db. */ unsigned int library_size(); } /* 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 *); #endif /* OCARINA_CORE_TAGS_LIBRARY_H */