|
|
Choosing A Webhost: |
[mb-commits] r9188 - in libmusicbrainz/trunk: . include/musicbrainz3 src te: msg#00007audio.musicbrainz.cvs
Author: luks Date: 2007-06-20 19:30:21 +0000 (Wed, 20 Jun 2007) New Revision: 9188 Modified: libmusicbrainz/trunk/NEWS.txt libmusicbrainz/trunk/include/musicbrainz3/releaseevent.h libmusicbrainz/trunk/src/mbxmlparser.cpp libmusicbrainz/trunk/src/releaseevent.cpp libmusicbrainz/trunk/src/utils_private.h libmusicbrainz/trunk/test/test_parser_release.cpp Log: Support for catalog numbers and barcodes. Modified: libmusicbrainz/trunk/NEWS.txt =================================================================== --- libmusicbrainz/trunk/NEWS.txt 2007-06-20 19:11:15 UTC (rev 9187) +++ libmusicbrainz/trunk/NEWS.txt 2007-06-20 19:30:21 UTC (rev 9188) @@ -4,6 +4,7 @@ - Fixed mb_query_get_tracks function name in mb_c.h. - Detect correctly installed libdiscid in src/disc.cpp. - Support for releaseEvents in ArtistIncludes. (#2974) + - Support for catalog numbers and barcodes. Changes for libmusicbrainz 3.0.0 (2007-05-12) --------------------------------------------- Modified: libmusicbrainz/trunk/include/musicbrainz3/releaseevent.h =================================================================== --- libmusicbrainz/trunk/include/musicbrainz3/releaseevent.h 2007-06-20 19:11:15 UTC (rev 9187) +++ libmusicbrainz/trunk/include/musicbrainz3/releaseevent.h 2007-06-20 19:30:21 UTC (rev 9188) @@ -88,6 +88,12 @@ */ void setDate(const std::string &dateStr); + void setCatalogNumber(const std::string &catalogNumber); + std::string getCatalogNumber() const; + + void setBarcode(const std::string &barcode); + std::string getBarcode() const; + private: class ReleaseEventPrivate; Modified: libmusicbrainz/trunk/src/mbxmlparser.cpp =================================================================== --- libmusicbrainz/trunk/src/mbxmlparser.cpp 2007-06-20 19:11:15 UTC (rev 9187) +++ libmusicbrainz/trunk/src/mbxmlparser.cpp 2007-06-20 19:30:21 UTC (rev 9188) @@ -369,6 +369,8 @@ ReleaseEvent *releaseEvent = factory.newReleaseEvent(); releaseEvent->setCountry(getTextAttr(releaseEventNode, "country")); releaseEvent->setDate(getTextAttr(releaseEventNode, "date")); + releaseEvent->setCatalogNumber(getTextAttr(releaseEventNode, "catalog-number")); + releaseEvent->setBarcode(getTextAttr(releaseEventNode, "barcode")); return releaseEvent; } Modified: libmusicbrainz/trunk/src/releaseevent.cpp =================================================================== --- libmusicbrainz/trunk/src/releaseevent.cpp 2007-06-20 19:11:15 UTC (rev 9187) +++ libmusicbrainz/trunk/src/releaseevent.cpp 2007-06-20 19:30:21 UTC (rev 9188) @@ -22,6 +22,7 @@ #include <string> #include <musicbrainz3/releaseevent.h> +#include "utils_private.h" using namespace std; using namespace MusicBrainz; @@ -34,6 +35,8 @@ string country; string dateStr; + string catalogNumber; + string barcode; }; ReleaseEvent::ReleaseEvent(const string &country, const string &dateStr) @@ -49,27 +52,7 @@ delete d; } -string -ReleaseEvent::getCountry() const -{ - return d->country; -} - -void -ReleaseEvent::setCountry(const string &value) -{ - d->country = value; -} - -string -ReleaseEvent::getDate() const -{ - return d->dateStr; -} - -void -ReleaseEvent::setDate(const string &value) -{ - d->dateStr = value; -} - +SIMPLE_STRING_SETTER_GETTER(ReleaseEvent, Country, country); +SIMPLE_STRING_SETTER_GETTER(ReleaseEvent, CatalogNumber, catalogNumber); +SIMPLE_STRING_SETTER_GETTER(ReleaseEvent, Barcode, barcode); +SIMPLE_STRING_SETTER_GETTER(ReleaseEvent, Date, dateStr); Modified: libmusicbrainz/trunk/src/utils_private.h =================================================================== --- libmusicbrainz/trunk/src/utils_private.h 2007-06-20 19:11:15 UTC (rev 9187) +++ libmusicbrainz/trunk/src/utils_private.h 2007-06-20 19:30:21 UTC (rev 9188) @@ -44,4 +44,16 @@ } +#define SIMPLE_STRING_SETTER_GETTER(class, name, name2) \ + string \ + class::get##name() const \ + { \ + return d->name2; \ + } \ + void \ + class::set##name(const string &value) \ + { \ + d->name2 = value; \ + } \ + #endif Modified: libmusicbrainz/trunk/test/test_parser_release.cpp =================================================================== --- libmusicbrainz/trunk/test/test_parser_release.cpp 2007-06-20 19:11:15 UTC (rev 9187) +++ libmusicbrainz/trunk/test/test_parser_release.cpp 2007-06-20 19:30:21 UTC (rev 9188) @@ -19,6 +19,7 @@ CPPUNIT_TEST(testReleaseArtist); CPPUNIT_TEST(testReleaseDiscs); CPPUNIT_TEST(testReleaseEvents); + CPPUNIT_TEST(testReleaseEvents2); CPPUNIT_TEST(testReleaseTracks); CPPUNIT_TEST(testReleaseTracksVA); CPPUNIT_TEST(testReleaseSearch); @@ -82,6 +83,17 @@ CPPUNIT_ASSERT_EQUAL(string("1992-02-25"), re[2]->getDate()); } + void testReleaseEvents2() + { + Metadata *md = MbXmlParser().parse(get_file_contents("../test-data/valid/release/Under_the_Pink_3.xml")); + Release *release = md->getRelease(); + CPPUNIT_ASSERT(release); + ReleaseEventList &re = release->getReleaseEvents(); + CPPUNIT_ASSERT_EQUAL(1, int(re.size())); + CPPUNIT_ASSERT_EQUAL(string("82567-2"), re[0]->getCatalogNumber()); + CPPUNIT_ASSERT_EQUAL(string("07567825672"), re[0]->getBarcode()); + } + void testReleaseTracks() { Metadata *md = MbXmlParser().parse(get_file_contents("../test-data/valid/release/Highway_61_Revisited_1.xml"));
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [mb-commits] r9187 - in libmusicbrainz/trunk: . include/musicbrainz3 src, root |
|---|---|
| Next by Date: | [mb-commits] r9189 - libmusicbrainz/trunk/src, root |
| Previous by Thread: | [mb-commits] r9187 - in libmusicbrainz/trunk: . include/musicbrainz3 src, root |
| Next by Thread: | [mb-commits] r9189 - libmusicbrainz/trunk/src, root |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |