diff --git a/include/core/database.h b/include/core/database.h index 3cef82c1..b9b302c3 100644 --- a/include/core/database.h +++ b/include/core/database.h @@ -156,13 +156,6 @@ struct database { */ void remove(unsigned int); - /** - * Called to find the number of valid items in the Database. - * - * @return Database::_size - */ - unsigned int size(); - /** * Called to find the size of the backing std::vector. * diff --git a/include/core/database.hpp b/include/core/database.hpp index 835e8800..67ba3cc9 100644 --- a/include/core/database.hpp +++ b/include/core/database.hpp @@ -112,12 +112,6 @@ void database :: remove(unsigned int index) autosave(); } -template -unsigned int database :: size() -{ - return db_size; -} - template unsigned int database :: actual_size() { @@ -127,7 +121,7 @@ unsigned int database :: actual_size() template typename database::iterator database :: begin() { - if (size() == 0) + if (db_size == 0) return end(); iterator it = db_entries.begin(); diff --git a/tests/core/database.cpp b/tests/core/database.cpp index 3acfed66..0d3ffeb0 100644 --- a/tests/core/database.cpp +++ b/tests/core/database.cpp @@ -65,7 +65,7 @@ static void test_init() /* Check initial sizes. */ test_equal(db.actual_size(), 0); - test_equal(db.size(), 0); + test_equal(db.db_size, 0); } static void test_stress(unsigned int N) @@ -87,7 +87,7 @@ static void test_stress(unsigned int N) ptrs.push_back(dbe); } test_loop_passed(); - test_equal(db.size(), N); + test_equal(db.db_size, N); test_equal(db.actual_size(), N); /* database.at() */ @@ -123,7 +123,7 @@ static void test_stress(unsigned int N) g_free(key); } test_loop_passed(); db.remove(N); - test_equal(db.size(), N / 2); + test_equal(db.db_size, N / 2); test_equal(db.actual_size(), N); /* database.first(), database.next(), database.end() */ @@ -154,7 +154,7 @@ static void test_save_load() db1.insert(int_entry(i)); db2.load(); - test_equal(db2.size(), N); + test_equal(db2.db_size, N); test_equal(db2.actual_size(), N); for (i = 0; i < N; i++) { dbe = db2.at(i); @@ -168,7 +168,7 @@ static void test_save_load() db2 = database("save_load.db", false); db2.load(); - test_equal(db2.size(), N / 2); + test_equal(db2.db_size, N / 2); for (i = 1; i < N; i++) { dbe = db2.at(i); if ((i % 2) == 0) { @@ -187,13 +187,13 @@ static void test_save_load() db1 = database("save_load.db", false); db1.load(); - test_equal(db1.size(), N / 2); + test_equal(db1.db_size, N / 2); db2.save(); db1 = database("save_load.db", false); db1.load(); - test_equal(db1.size(), N); + test_equal(db1.db_size, N); test_equal(db1.actual_size(), 2 * N); for (i = 1; i < (2 * N); i++) { dbe = db1.at(i); diff --git a/tests/core/index.cpp b/tests/core/index.cpp index 02a95b2d..58e54d00 100644 --- a/tests/core/index.cpp +++ b/tests/core/index.cpp @@ -19,12 +19,12 @@ static void test_single_item() IndexEntry *it = index.find("a"); test_not_equal(it, (IndexEntry *)NULL); - test_equal(index.size(), (unsigned)1); + test_equal(index.db_size, (unsigned)1); test_equal(it->size(), (size_t)1); test_equal(*(it->begin()), (unsigned)0); index.remove("a", 0); - test_equal(index.size(), (unsigned)1); + test_equal(index.db_size, (unsigned)1); test_equal(it->size(), (size_t)0); } @@ -39,7 +39,7 @@ static void test_insertion(unsigned int n) INDEX->insert(std::string(1, c), i); } - test_equal(INDEX->size(), (n == 0) ? 0 : 26); + test_equal(INDEX->db_size, (n == 0) ? 0 : 26); for (char c = 'a'; c <= 'z'; c++) { IndexEntry *it = INDEX->find(std::string(1, c)); @@ -78,12 +78,12 @@ static void test_save_load(unsigned int n) IndexEntry *it1, *it2; idx2.load(); - test_equal(idx2.size(), (unsigned)0); + test_equal(idx2.db_size, (unsigned)0); INDEX->save(); idx2.load(); - test_equal(idx2.size(), INDEX->size()); + test_equal(idx2.db_size, INDEX->db_size); test_equal(idx2.actual_size(), INDEX->actual_size()); for (char c = 'a'; c <= 'z'; c++) { diff --git a/tests/core/tags/album.cpp b/tests/core/tags/album.cpp index 64e126d7..7eb4ac4a 100644 --- a/tests/core/tags/album.cpp +++ b/tests/core/tags/album.cpp @@ -50,7 +50,7 @@ static void test_album_tag_lookup() test_equal(tags :: get_album(1), (Album *)NULL); album_db.load(); - test_equal(album_db.size(), (unsigned)1); + test_equal(album_db.db_size, (unsigned)1); } DECLARE_UNIT_TESTS( diff --git a/tests/core/tags/artist.cpp b/tests/core/tags/artist.cpp index b07c4e78..393bc343 100644 --- a/tests/core/tags/artist.cpp +++ b/tests/core/tags/artist.cpp @@ -31,7 +31,7 @@ static void test_artist_tag_lookup() test_equal(tags :: get_artist(1), (Artist *)NULL); artist_db.load(); - test_equal(artist_db.size(), (unsigned)1); + test_equal(artist_db.db_size, (unsigned)1); } DECLARE_UNIT_TESTS( diff --git a/tests/core/tags/genre.cpp b/tests/core/tags/genre.cpp index 6d6ab425..c9d8e4b1 100644 --- a/tests/core/tags/genre.cpp +++ b/tests/core/tags/genre.cpp @@ -31,7 +31,7 @@ static void test_genere_tag_lookup() test_equal(tags :: get_genre(1), (Genre *)NULL); genre_db.load(); - test_equal(genre_db.size(), (unsigned)1); + test_equal(genre_db.db_size, (unsigned)1); } DECLARE_UNIT_TESTS( diff --git a/tests/core/tags/track.cpp b/tests/core/tags/track.cpp index 11911336..47ba7237 100644 --- a/tests/core/tags/track.cpp +++ b/tests/core/tags/track.cpp @@ -109,7 +109,7 @@ static void test_track_tag_load_db(unsigned int size) { database track_db("track.db", false); track_db.load(); - test_equal(track_db.size(), size); + test_equal(track_db.db_size, size); } static void test_track_tag_lookup()