From ffa5e65ba7e37f8c472b619118b827a224c03bc9 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 23 Oct 2015 10:21:12 -0400 Subject: [PATCH] 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 --- core/audio.cpp | 2 +- core/core.cpp | 2 +- core/deck.cpp | 4 +-- core/library.cpp | 26 +++++++++---------- core/playlist.cpp | 6 ++--- core/tags/library.cpp | 50 ++++++++++++++++++------------------- core/tags/track.cpp | 10 ++++---- gui/collection.cpp | 2 +- gui/manager.cpp | 30 +++++++++++----------- include/core/library.h | 10 ++++---- include/core/tags/library.h | 20 +++++++-------- include/core/tags/track.h | 12 ++++----- tests/core/audio.cpp | 4 +-- tests/core/deck.cpp | 6 ++--- tests/core/library.cpp | 42 +++++++++++++++---------------- tests/core/playlist.cpp | 8 +++--- tests/core/tags/library.cpp | 20 +++++++-------- tests/core/tags/track.cpp | 4 +-- 18 files changed, 128 insertions(+), 130 deletions(-) diff --git a/core/audio.cpp b/core/audio.cpp index 588d6b74..45c77ae3 100644 --- a/core/audio.cpp +++ b/core/audio.cpp @@ -67,7 +67,7 @@ void AudioDriver :: eos() { if (cur_track) { cur_track->played(); - library :: get_queue()->updated(cur_track); + collection :: get_queue()->updated(cur_track); } _load_track(deck :: next(), continue_playback()); diff --git a/core/core.cpp b/core/core.cpp index 0a1197cd..7ce1fd66 100644 --- a/core/core.cpp +++ b/core/core.cpp @@ -14,7 +14,7 @@ void core :: init() { filter_init(); tags :: init(); - library :: init(); + collection :: init(); playlist :: init(); deck :: init(); audio :: init(); diff --git a/core/deck.cpp b/core/deck.cpp index 74d1c2b3..f8498215 100644 --- a/core/deck.cpp +++ b/core/deck.cpp @@ -71,7 +71,7 @@ static void upgrade_v0() { int random, ascending; unsigned int num, field; - Queue *library = library :: get_queue(); + Queue *library = collection :: get_queue(); file_readf(&deck_file, "%d %u", &random, &num); if (random) @@ -214,7 +214,7 @@ Track *deck :: next() } if (!track) - track = library :: get_queue()->next(); + track = collection :: get_queue()->next(); if (track) recent_queue.add(track); return track; diff --git a/core/library.cpp b/core/library.cpp index 2ac0582e..92cd8a64 100644 --- a/core/library.cpp +++ b/core/library.cpp @@ -69,7 +69,7 @@ public: static LibraryQueue library_q; struct scan_info { - Library *library; + struct library *library; std :: string path; }; @@ -80,7 +80,7 @@ static void scan_path(struct scan_info &); /* * Scanning functions are here */ -static void tag_track(Library *library, const std::string &filepath) +static void tag_track(struct library *library, const std::string &filepath) { Track *track; TagLib :: Tag *tag; @@ -108,7 +108,7 @@ static void tag_track(Library *library, const std::string &filepath) library_q.add(track); } -static void process_path(Library *library, const std :: string &dir, +static void process_path(struct library *library, const std :: string &dir, const std :: string &name) { struct scan_info scan = { @@ -140,7 +140,7 @@ static void scan_path(struct scan_info &scan) tags :: commit_track_db(); } -static void validate_library(Library *&library) +static void validate_library(struct library *&library) { Track *track; @@ -162,7 +162,7 @@ static void validate_library(Library *&library) * External API begins here */ -void library :: init() +void collection :: init() { Track *track; @@ -175,9 +175,9 @@ void library :: init() } } -Library *library :: add(const std::string &dir) +struct library *collection :: add(const std::string &dir) { - Library *library = NULL; + struct library *library = NULL; if (g_file_test(dir.c_str(), G_FILE_TEST_IS_DIR) == false) return library; @@ -188,7 +188,7 @@ Library *library :: add(const std::string &dir) return library; } -void library :: remove(Library *library) +void collection :: remove(struct library *library) { if (library) { set_enabled(library, false); @@ -197,7 +197,7 @@ void library :: remove(Library *library) } } -void library :: update(Library *library) +void collection :: update(struct library *library) { struct scan_info scan = { .library = library, @@ -210,9 +210,9 @@ void library :: update(Library *library) } } -void library :: update_all() +void collection :: update_all() { - Library *library; + struct library *library; for (unsigned int i = 0; i < tags :: library_size(); i++) { library = tags :: get_library(i); @@ -221,7 +221,7 @@ void library :: update_all() } } -void library :: set_enabled(Library *library, bool enabled) +void collection :: set_enabled(struct library *library, bool enabled) { Track *track; @@ -241,7 +241,7 @@ void library :: set_enabled(Library *library, bool enabled) } } -Queue *library :: get_queue() +Queue *collection :: get_queue() { return &library_q; } diff --git a/core/playlist.cpp b/core/playlist.cpp index a8b2ef5d..dfcccd00 100644 --- a/core/playlist.cpp +++ b/core/playlist.cpp @@ -95,7 +95,7 @@ void playlist :: init() return; set_for_each(&ent->ie_set, &it) - library :: get_queue()->del(tags :: get_track(it.it_val)); + collection :: get_queue()->del(tags :: get_track(it.it_val)); } bool playlist :: has(Track *track, const std::string &name) @@ -113,7 +113,7 @@ void playlist :: add(Track *track, const std::string &name) if (cur_plist == name) playlist_q.add(track); if (name == "Banned") - library :: get_queue()->del(track); + collection :: get_queue()->del(track); } } @@ -123,7 +123,7 @@ void playlist :: del(Track *track, const std::string &name) if (cur_plist == name) playlist_q.del(track); if (name == "Banned") - library :: get_queue()->add(track); + collection :: get_queue()->add(track); } void playlist :: select(const std::string &name) diff --git a/core/tags/library.cpp b/core/tags/library.cpp index dda472c5..10f25585 100644 --- a/core/tags/library.cpp +++ b/core/tags/library.cpp @@ -4,66 +4,66 @@ #include -static database library_db; +static database library_db; -Library :: Library() - : _size(0), _enabled(false) +library :: library() + : li_size(0), li_enabled(false) { } -Library :: Library(const std::string &path) - : _size(0), _path(path), _enabled(true) +library :: library(const std::string &path) + : li_size(0), li_enabled(true), li_path(path) { } -const std::string Library :: primary_key() const +const std::string library :: primary_key() const { - return _path; + return li_path; } -void Library :: read(file &file) +void library :: read(file &file) { int enabled; gchar *path; file_readf(&file, "%d\n", &enabled); - _enabled = enabled; + li_enabled = enabled; path = file_readl(&file); - _path = path; + li_path = path; g_free(path); } -void Library :: write(file &file) +void library :: write(file &file) { - file_writef(&file, "%d %s", _enabled, _path.c_str()); + file_writef(&file, "%d %s", li_enabled, li_path.c_str()); } -const bool Library :: enabled() +const bool library :: enabled() { - return _enabled; + return li_enabled; } -void Library :: set_enabled(bool enabled) +void library :: set_enabled(bool enabled) { - _enabled = enabled; + li_enabled = enabled; db_save(&library_db); } -const unsigned int Library :: size() +const unsigned int library :: size() { - return _size; + return li_size; } -void Library :: inc_size() +void library :: inc_size() { - _size++; + li_size++; } -void Library :: dec_size() +void library :: dec_size() { - _size--; + li_size--; } @@ -73,17 +73,17 @@ void tags :: init_library_db() db_load(&library_db); } -Library *tags :: get_library(const std::string &path) +struct library *tags :: get_library(const std::string &path) { return db_find(&library_db, path.c_str()); } -Library *tags :: get_library(const unsigned int index) +struct library *tags :: get_library(const unsigned int index) { return db_at(&library_db, index); } -void tags :: remove_library(Library *library) +void tags :: remove_library(struct library *library) { if (library) db_remove(&library_db, library); diff --git a/core/tags/track.cpp b/core/tags/track.cpp index 0e552ae1..73318747 100644 --- a/core/tags/track.cpp +++ b/core/tags/track.cpp @@ -10,7 +10,7 @@ static database track_db; -static const std::string make_key(Library *library, const std::string &path) +static const std::string make_key(struct library *library, const std::string &path) { std :: string res; @@ -31,7 +31,7 @@ Track :: Track() {} Track :: Track(struct album *album, struct artist *artist, struct genre *genre, - Library *library, const std::string &filepath, + struct library *library, const std::string &filepath, const std::string &name, unsigned int length, unsigned int track) : GenericTag(name), _album(album), _artist(artist), _genre(genre), _library(library), @@ -62,7 +62,7 @@ Track :: ~Track() struct album *Track :: album() { return _album; } struct artist *Track :: artist() { return _artist; } struct genre *Track :: genre() { return _genre; } -Library *Track :: library() { return _library; } +struct library *Track :: library() { return _library; } unsigned int Track :: count() { return _count; } unsigned int Track :: length() { return _length; } @@ -149,7 +149,7 @@ void tags :: init_track_db() } Track *tags :: add_track(struct album *album, struct artist *artist, - struct genre *genre, Library *library, + struct genre *genre, struct library *library, const std::string &filepath, const std::string &name, unsigned int length, unsigned int track) { @@ -170,7 +170,7 @@ void tags :: remove_track(Track *track) db_remove(&track_db, track); } -void tags :: remove_library_tracks(Library *library) +void tags :: remove_library_tracks(struct library *library) { Track *it, *next; diff --git a/gui/collection.cpp b/gui/collection.cpp index 01dcb908..e8a3acd0 100644 --- a/gui/collection.cpp +++ b/gui/collection.cpp @@ -12,7 +12,7 @@ private: CollectionLabel *collection_label; public: - CollectionTab() : Tab(library::get_queue()) + CollectionTab() : Tab(collection :: get_queue()) { tab_builder->add_from_file(gui :: share_file("QueueLabel.ui")); tab_builder->get_widget_derived("CollectionLabel", collection_label); diff --git a/gui/manager.cpp b/gui/manager.cpp index 66df62ab..971ef8b2 100644 --- a/gui/manager.cpp +++ b/gui/manager.cpp @@ -29,7 +29,7 @@ public: -static void list_path(Library *lib) +static void list_path(struct library *lib) { Gtk::TreeModel::Row row; @@ -42,20 +42,20 @@ static void list_path(Library *lib) } } -static Library *get_library_and_row(const Gtk::TreePath &path, +static struct library *get_library_and_row(const Gtk::TreePath &path, Gtk::TreeModel::Row &row) { row = *(c_list->get_iter(path)); return tags :: get_library(row[c_cols.c_id]); } -static Library *get_library(const Gtk::TreePath &path) +static struct library *get_library(const Gtk::TreePath &path) { Gtk::TreeModel::Row row; return get_library_and_row(path, row); } -static Library *current_library_and_row(Gtk::TreeModel::Row &row) +static struct library *current_library_and_row(Gtk::TreeModel::Row &row) { Gtk::TreePath path; Gtk::TreeViewColumn *col; @@ -66,7 +66,7 @@ static Library *current_library_and_row(Gtk::TreeModel::Row &row) return get_library_and_row(path, row); } -static Library *current_library() +static struct library *current_library() { Gtk::TreeModel::Row row; return current_library_and_row(row); @@ -76,7 +76,7 @@ static Library *current_library() void update_paths() { - Library *lib; + struct library *lib; Gtk::TreeModel::Children::iterator it; for (it = c_list->children().begin(); it != c_list->children().end(); it++) { @@ -95,7 +95,7 @@ static void remove_banned_tracks() return; set_for_each(&ent->ie_set, &it) - library :: get_queue()->del(tags :: get_track(it.it_val)); + collection :: get_queue()->del(tags :: get_track(it.it_val)); } @@ -121,32 +121,32 @@ static void idle_enable() static void on_add() { - list_path(library :: add(c_chooser->get_filename())); + list_path(collection :: add(c_chooser->get_filename())); idle_enable(); } static void on_update() { - library :: update_all(); + collection :: update_all(); idle_enable(); } static void on_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col) { - library :: update(get_library(path)); + collection :: update(get_library(path)); idle_enable(); } static void on_cursor_changed() { - Library *lib = current_library(); + struct library *lib = current_library(); if (lib && (c_chooser->get_current_folder() != lib->primary_key())) c_chooser->set_current_folder(lib->primary_key()); } static bool on_key_pressed(GdkEventKey *event) { - Library *lib; + struct library *lib; Gtk::TreeModel::Row row; std::string key = gdk_keyval_name(event->keyval); @@ -154,7 +154,7 @@ static bool on_key_pressed(GdkEventKey *event) return false; lib = current_library_and_row(row); - library :: remove(lib); + collection :: remove(lib); c_list->erase(row); return true; } @@ -162,9 +162,9 @@ static bool on_key_pressed(GdkEventKey *event) static void on_toggled(const Glib::ustring &str) { Gtk::TreeModel::Row row; - Library *lib = get_library_and_row(Gtk::TreePath(str), row); + struct library *lib = get_library_and_row(Gtk::TreePath(str), row); - library :: set_enabled(lib, !lib->enabled()); + collection :: set_enabled(lib, !lib->enabled()); row[c_cols.c_enabled] = lib->enabled(); if (lib->enabled()) remove_banned_tracks(); diff --git a/include/core/library.h b/include/core/library.h index 5d97d7f8..1afc8730 100644 --- a/include/core/library.h +++ b/include/core/library.h @@ -19,7 +19,7 @@ * ... << flags << _sort_order.size() * ... << _sort_order[N].field << _sort_order[N].ascending << ... */ -namespace library +namespace collection { /** @@ -35,7 +35,7 @@ namespace library * @return The newly created Library tag or NULL if a * tag could not be created. */ - Library *add(const std::string &); + struct library *add(const std::string &); /** * Remove a Library tag from the database along with every @@ -43,7 +43,7 @@ namespace library * * @param library The library path that should be removed. */ - void remove(Library *); + void remove(struct library *); /** * First, scan over every Track in the database and remove @@ -54,7 +54,7 @@ namespace library * * @param library The library path that should be updated. */ - void update(Library *); + void update(struct library *); /** * Call library :: update() on all Library tags. @@ -69,7 +69,7 @@ namespace library * @param enabled Set to true if the library should be enabled, * and false to disable it. */ - void set_enabled(Library *, bool); + void set_enabled(struct library *, bool); /** * Use to access the library queue. diff --git a/include/core/tags/library.h b/include/core/tags/library.h index e723414b..d1f4a0b0 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -18,21 +18,19 @@ * ... << enabled2 << path2 * ... << enabled3 << path3 */ -class Library : public DatabaseEntry { -private: - unsigned int _size; /**< Number of tracks in this library. */ - std::string _path; /**< Path to the root directory of this library. */ - bool _enabled; /**< Is this library path enabled? */ +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. */ -public: - Library(); /**< Library tag constructor. */ + library(); /**< Library tag constructor. */ /** * Library tag constructor. * * @param path Path to the library directory on disk. */ - Library(const std::string &); + library(const std::string &); /** * Called to access the library tag's primary key. @@ -102,7 +100,7 @@ namespace tags * @param path The path to the library directory on disk. * @return A matching Library tag. */ - Library *get_library(const std::string &); + struct library *get_library(const std::string &); /** * Called to look up a Library tag by tag index. @@ -110,14 +108,14 @@ namespace tags * @param index The index of the Library tag. * @return A matching Library tag. */ - Library *get_library(const unsigned int); + struct library *get_library(const unsigned int); /** * Called to remove a specific Library tag. * * @param library The Library tag to remove. */ - void remove_library(Library *); + void remove_library(struct library *); /** * Called to find the number of rows in the library_db, diff --git a/include/core/tags/track.h b/include/core/tags/track.h index 686a6e58..9c6ea07f 100644 --- a/include/core/tags/track.h +++ b/include/core/tags/track.h @@ -23,7 +23,7 @@ private: struct album *_album; /**< Pointer to the Album containing this track. */ struct artist *_artist; /**< Pointer to the Artist performing this track. */ struct genre *_genre; /**< Pointer to the Genre describing this track. */ - Library *_library; /**< Pointer to the Library containing this track. */ + struct library *_library; /**< Pointer to the Library containing this track. */ unsigned int _count; /**< Number of times this track has been played.*/ unsigned int _length; /**< Length of this track (in seconds). */ @@ -45,7 +45,7 @@ public: * @param length The length of this track (in seconds). * @param track The track number of this track. */ - Track(struct album *, struct artist *, struct genre *, Library *, + Track(struct album *, struct artist *, struct genre *, struct library *, const std::string &, const std::string &, unsigned int, unsigned int); @@ -63,7 +63,7 @@ public: struct album *album(); /**< @return Track::_album. */ struct artist *artist(); /**< @return Track::_artist. */ struct genre *genre(); /**< @return Track::_genre. */ - Library *library(); /**< @return Track::_library. */ + struct library *library(); /**< @return Track::_library. */ unsigned int count(); /**< @return Track::_count. */ unsigned int length(); /**< @return Track::_length. */ @@ -137,8 +137,8 @@ namespace tags * the track_db. */ Track *add_track(struct album *, struct artist *, struct genre *, - Library *, const std::string &, const std::string &, - unsigned int, unsigned int); + struct library *, const std::string &, + const std::string &, unsigned int, unsigned int); /** * Called to look up a Track tag by tag index. @@ -160,7 +160,7 @@ namespace tags * * @param library The Library tag that will be matched. */ - void remove_library_tracks(Library *); + void remove_library_tracks(struct library *); /** * Called to find the number of rows in the track_db, diff --git a/tests/core/audio.cpp b/tests/core/audio.cpp index 5d712f52..918f65c6 100644 --- a/tests/core/audio.cpp +++ b/tests/core/audio.cpp @@ -85,7 +85,7 @@ void test_init() filter_init(); tags :: init(); - library :: init(); + collection :: init(); audio :: init(); track = audio :: current_track(); @@ -122,7 +122,7 @@ void test_track_controls() Track *track = NULL; TestDriver *driver = (TestDriver *)audio :: get_driver(); - library :: get_queue()->unset_flag(Q_RANDOM); + collection :: get_queue()->unset_flag(Q_RANDOM); audio :: pause(); audio :: next(); diff --git a/tests/core/deck.cpp b/tests/core/deck.cpp index c19fa12f..144f7da5 100644 --- a/tests/core/deck.cpp +++ b/tests/core/deck.cpp @@ -21,10 +21,10 @@ static void test_init() test_cp_data_dir(); filter_init(); tags :: init(); - library :: init(); + collection :: init(); deck :: init(); - test_equal(library :: get_queue()->has_flag(Q_RANDOM), true); + test_equal(collection :: get_queue()->has_flag(Q_RANDOM), true); test_equal(deck :: get_queues().size(), (size_t)2); it = deck :: get_queues().begin(); @@ -142,7 +142,7 @@ static void test_next_prev() test_equal(deck :: index(q1), (unsigned)0); q1->unset_flag(Q_ENABLED); - library :: get_queue()->unset_flag(Q_RANDOM); + collection :: get_queue()->unset_flag(Q_RANDOM); test_equal(q1->size(), (unsigned)5); deck :: next(); diff --git a/tests/core/library.cpp b/tests/core/library.cpp index 5fd8e874..0b6acb4e 100644 --- a/tests/core/library.cpp +++ b/tests/core/library.cpp @@ -8,11 +8,11 @@ #include "test.h" static Queue *Q_NULL = NULL; -static Library *LIB_NULL = NULL; +static struct library *LIB_NULL = NULL; static void test_init() { - Queue *q = library :: get_queue(); + Queue *q = collection :: get_queue(); test_not_equal(q, Q_NULL); test_equal(q->has_flag(Q_ENABLED), true); @@ -21,56 +21,56 @@ static void test_init() test_cp_data_dir(); filter_init(); tags :: init(); - library :: init(); + collection :: init(); test_equal(q->size(), (unsigned)24); } static void test_enable() { - Queue *q = library :: get_queue(); - Library *library = tags :: get_library(0); + Queue *q = collection :: get_queue(); + struct library *library = tags :: get_library(0); - library :: set_enabled(LIB_NULL, true); + collection :: set_enabled(LIB_NULL, true); test_equal(q->size(), (unsigned)24); - library :: set_enabled(library, false); + collection :: set_enabled(library, false); test_equal(q->size(), (unsigned)0); - library :: set_enabled(library, true); + collection :: set_enabled(library, true); test_equal(q->size(), (unsigned)24); - library :: set_enabled(library, true); + collection :: set_enabled(library, true); test_equal(q->size(), (unsigned)24); - library :: set_enabled(library, false); + collection :: set_enabled(library, false); test_equal(q->size(), (unsigned)0); - library :: set_enabled(library, true); + collection :: set_enabled(library, true); test_equal(q->size(), (unsigned)24); } static void test_remove() { - Queue *q = library :: get_queue(); - Library *library = tags :: get_library(0); + Queue *q = collection :: get_queue(); + struct library *library = tags :: get_library(0); - library :: remove(LIB_NULL); + collection :: remove(LIB_NULL); test_equal(q->size(), (unsigned)24); - library :: remove(library); + collection :: remove(library); test_equal(q->size(), (unsigned)0); - library :: remove(library); + collection :: remove(library); test_equal(q->size(), (unsigned)0); } static void test_add() { - Queue *q = library :: get_queue(); + Queue *q = collection :: get_queue(); test_generate_library(); - library :: add("/tmp/ocarina/"); + collection :: add("/tmp/ocarina/"); test_equal(q->size(), (unsigned)0); test_equal(idle :: run_task(), true); @@ -84,10 +84,10 @@ static void test_add() static void test_update() { - Queue *q = library :: get_queue(); + Queue *q = collection :: get_queue(); test_rm_library_dirs(); - library :: update_all(); + collection :: update_all(); test_equal(idle :: run_task(), true); test_equal(q->size(), (unsigned)21); @@ -98,7 +98,7 @@ static void test_update() test_generate_library(); - library :: update_all(); + collection :: update_all(); test_equal(idle :: run_task(), true); test_equal(q->size(), (unsigned)21); diff --git a/tests/core/playlist.cpp b/tests/core/playlist.cpp index 3c92db2a..1d53904b 100644 --- a/tests/core/playlist.cpp +++ b/tests/core/playlist.cpp @@ -26,12 +26,12 @@ static void test_init() test_cp_data_dir(); filter_init(); tags :: init(); - library :: init(); + collection :: init(); playlist :: init(); ent = playlist :: get_tracks("Banned"); test_equal(set_size(&ent->ie_set), (size_t)4); - test_equal(library :: get_queue()->size(), (unsigned)20); + test_equal(collection :: get_queue()->size(), (unsigned)20); ent = playlist :: get_tracks("Favorites"); test_equal(set_size(&ent->ie_set), (size_t)8); ent = playlist :: get_tracks("No Such Playlist"); @@ -62,7 +62,7 @@ static void test_add() { index_entry *ent; Queue *q = playlist :: get_queue(); - Queue *l = library :: get_queue(); + Queue *l = collection :: get_queue(); playlist :: select("Favorites"); @@ -86,7 +86,7 @@ static void test_delete() { index_entry *ent; Queue *q = playlist :: get_queue(); - Queue *l = library :: get_queue(); + Queue *l = collection :: get_queue(); playlist :: del(tags :: get_track(5), "Banned"); ent = playlist :: get_tracks("Banned"); diff --git a/tests/core/tags/library.cpp b/tests/core/tags/library.cpp index e00a1b12..1fb1243e 100644 --- a/tests/core/tags/library.cpp +++ b/tests/core/tags/library.cpp @@ -4,21 +4,21 @@ #include #include "../test.h" -static void test_verify_empty(Library *library) +static void test_verify_empty(struct library *library) { test_equal(library->primary_key(), ""); test_equal(library->enabled(), false); test_equal(library->size(), 0); } -static void test_verify_zelda(Library *library) +static void test_verify_zelda(struct library *library) { test_equal(library->primary_key(), "/home/Zelda/Music"); test_equal(library->enabled(), true); test_equal(library->size(), 0); } -static void test_verify_link(Library *library) +static void test_verify_link(struct library *library) { test_equal(library->primary_key(), "/home/Link/Music"); test_equal(library->enabled(), false); @@ -27,9 +27,9 @@ static void test_verify_link(Library *library) static void test_library() { - Library *link = new Library("/home/Link/Music"); - Library *zelda = new Library("/home/Zelda/Music"); - Library *library = new Library(); + struct library *link = new struct library("/home/Link/Music"); + struct library *zelda = new struct library("/home/Zelda/Music"); + struct library *library = new struct library(); file f; link->set_enabled(false); @@ -68,8 +68,8 @@ static void test_library() static void test_library_db() { - database library_db; - Library *library, *library2; + database library_db; + struct library *library, *library2; test_equal(tags :: library_size(), 0); @@ -80,7 +80,7 @@ static void test_library_db() test_equal(tags :: library_size(), 1); test_equal(tags :: get_library("/home/Zelda/Music"), library); test_equal(tags :: get_library(0), library); - test_equal(tags :: get_library(1), (Library *)NULL); + test_equal(tags :: get_library(1), (struct library *)NULL); db_init(&library_db, "library.db", false); db_load(&library_db); @@ -92,7 +92,7 @@ static void test_library_db() test_verify_zelda(library2); tags :: remove_library(library); - test_equal(tags :: get_library(0), (Library *)NULL); + test_equal(tags :: get_library(0), (struct library *)NULL); test_equal(tags :: library_size(), 1); db_deinit(&library_db); diff --git a/tests/core/tags/track.cpp b/tests/core/tags/track.cpp index 02ee4f72..47b5d70b 100644 --- a/tests/core/tags/track.cpp +++ b/tests/core/tags/track.cpp @@ -16,7 +16,7 @@ extern "C" { static struct artist *artist = NULL; static struct album *album = NULL; static struct genre *genre = NULL; -static Library *library = NULL; +static struct library *library = NULL; const std::string MUSIC_DIR = "/home/Zelda/Music"; @@ -27,7 +27,7 @@ static void test_track_tag_default() test_equal(track.album(), (struct album *)NULL); test_equal(track.artist(), (struct artist *)NULL); test_equal(track.genre(), (struct genre *)NULL); - test_equal(track.library(), (Library *)NULL); + test_equal(track.library(), (struct library *)NULL); test_equal(track.name(), (std::string)""); test_equal(track.lowercase(), (std::string)"");