/* * Copyright 2014 (c) Anna Schumaker. * * The Genre tag is used to store the name of genres * added to the tag database. * * When writing a Genre tag to disk, nol ywrite out the * genre_name field: * * ... Video Game Music * ... Game Music */ #ifndef OCARINA_CORE_TAGS_GENRE_H #define OCARINA_CORE_TAGS_GENRE_H #include struct genre { gchar *ge_name; /* This genre's name. */ gchar **ge_tokens; /* This genre's tokenized strings. */ gchar **ge_alts; /* This genre's alternate ascii tokens. */ struct db_entry ge_dbe; }; #define GENRE(dbe) ((struct genre *)DBE_DATA(dbe)) /* Called to initialize the genre database. */ void genre_db_init(); /* Called to clean up the genre database. */ void genre_db_deinit(); /* Called to find a genre tag by name. */ struct genre *genre_find(const gchar *); /* Called to get a genre tag with a specific index. */ struct genre *genre_get(const unsigned int); /* Called to compare two genre tags. */ int genre_compare(struct genre *, struct genre *); /* Called to check if a genre has a token that matches the given string. */ bool genre_match_token(struct genre *, const gchar *); /* Called to find the database index of the genre tag. */ static inline unsigned int genre_index(struct genre *genre) { return genre->ge_dbe.dbe_index; } #ifdef CONFIG_TESTING const struct db_ops *test_genre_ops(); #endif /* CONFIG_TESTING */ #endif /* OCARINA_CORE_TAGS_GENRE_H */