diff --git a/Doxyfile.cmake b/Doxyfile.cmake index 9171c8a..f1b69c7 100644 --- a/Doxyfile.cmake +++ b/Doxyfile.cmake @@ -1,7 +1,6 @@ PROJECT_NAME = "${PROJECT_NAME}" PROJECT_NUMBER = ${PROJECT_VERSION} HTML_OUTPUT = docs -GENERATE_HTML = YES GENERATE_LATEX = NO GENERATE_MAN = NO GENERATE_RTF = NO diff --git a/Doxyfile.cmake.doxygen b/Doxyfile.cmake.doxygen deleted file mode 100644 index f1b69c7..0000000 --- a/Doxyfile.cmake.doxygen +++ /dev/null @@ -1,20 +0,0 @@ -PROJECT_NAME = "${PROJECT_NAME}" -PROJECT_NUMBER = ${PROJECT_VERSION} -HTML_OUTPUT = docs -GENERATE_LATEX = NO -GENERATE_MAN = NO -GENERATE_RTF = NO -CASE_SENSE_NAMES = NO -INPUT = include/musicbrainz5 -EXCLUDE = include/musicbrainz5/xmlParser.h -JAVADOC_AUTOBRIEF = YES -EXTRACT_ALL = YES -EXTRACT_STATIC = YES -SHOW_USED_FILES = NO -GENERATE_TREEVIEW = YES -SHOW_INCLUDE_FILES = NO -FULL_PATH_NAMES = NO -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -PREDEFINED = LIBMB5_DEPRECATED(f)= -REPEAT_BRIEF = NO diff --git a/include/musicbrainz5/Entity.h b/include/musicbrainz5/Entity.h index 0f92d55..fca7a14 100644 --- a/include/musicbrainz5/Entity.h +++ b/include/musicbrainz5/Entity.h @@ -76,12 +76,10 @@ namespace MusicBrainz5 os >> RetVal; if (os.fail()) { -#ifdef _MB5_DEBUG_ std::cerr << "Error parsing value '"; if (Node.getText()) std::cerr << Node.getText(); std::cerr << "'" << std::endl; -#endif } } @@ -94,9 +92,7 @@ namespace MusicBrainz5 os >> RetVal; if (os.fail()) { -#ifdef _MB5_DEBUG_ std::cerr << "Error parsing value '" << Text << "'" << std::endl; -#endif } } diff --git a/include/musicbrainz5/Entity.h.silence-warnings b/include/musicbrainz5/Entity.h.silence-warnings deleted file mode 100644 index fca7a14..0000000 --- a/include/musicbrainz5/Entity.h.silence-warnings +++ /dev/null @@ -1,117 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#ifndef _MUSICBRAINZ5_ENTITY_H -#define _MUSICBRAINZ5_ENTITY_H - -#include -#include -#include -#include - -#include "musicbrainz5/xmlParser.h" - -namespace MusicBrainz5 -{ - class CEntityPrivate; - - class CRelationListList; - - class CEntity - { - public: - CEntity(); - CEntity(const CEntity& Other); - CEntity& operator =(const CEntity& Other); - virtual ~CEntity(); - - virtual CEntity *Clone()=0; - - void Parse(const XMLNode& Node); - - std::map ExtAttributes() const; - std::map ExtElements() const; - - virtual std::ostream& Serialise(std::ostream& os) const; - static std::string GetElementName(); - - protected: - void ProcessRelationList(const XMLNode& Node, CRelationListList* & RetVal); - - template - void ProcessItem(const XMLNode& Node, T* & RetVal) - { - RetVal=new T(Node); - } - - template - void ProcessItem(const XMLNode& Node, T& RetVal) - { - std::stringstream os; - if (Node.getText()) - os << (const char *)Node.getText(); - - os >> RetVal; - if (os.fail()) - { - std::cerr << "Error parsing value '"; - if (Node.getText()) - std::cerr << Node.getText(); - std::cerr << "'" << std::endl; - } - } - - template - void ProcessItem(const std::string& Text, T& RetVal) - { - std::stringstream os; - os << Text; - - os >> RetVal; - if (os.fail()) - { - std::cerr << "Error parsing value '" << Text << "'" << std::endl; - } - } - - void ProcessItem(const XMLNode& Node, std::string& RetVal) - { - if (Node.getText()) - RetVal=Node.getText(); - } - - virtual void ParseAttribute(const std::string& Name, const std::string& Value)=0; - virtual void ParseElement(const XMLNode& Node)=0; - - private: - CEntityPrivate *m_d; - - void Cleanup(); - }; -} - -std::ostream& operator << (std::ostream& os, const MusicBrainz5::CEntity& Entity); - -#endif diff --git a/src/Alias.cc b/src/Alias.cc index 29dbe15..bdafc99 100644 --- a/src/Alias.cc +++ b/src/Alias.cc @@ -106,18 +106,14 @@ void MusicBrainz5::CAlias::ParseAttribute(const std::string& Name, const std::st m_d->m_EndDate=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised alias attribute: '" << Name << "'" << std::endl; -#endif } } void MusicBrainz5::CAlias::ParseElement(const XMLNode& Node) { std::string NodeName=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised alias element: '" << NodeName << std::endl; -#endif } std::string MusicBrainz5::CAlias::GetElementName() diff --git a/src/Alias.cc.silence-warnings b/src/Alias.cc.silence-warnings deleted file mode 100644 index bdafc99..0000000 --- a/src/Alias.cc.silence-warnings +++ /dev/null @@ -1,174 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Alias.h" - -class MusicBrainz5::CAliasPrivate -{ -public: - std::string m_Locale; - std::string m_Text; - std::string m_SortName; - std::string m_Type; - std::string m_Primary; - std::string m_BeginDate; - std::string m_EndDate; -}; - -MusicBrainz5::CAlias::CAlias(const XMLNode& Node) -: CEntity(), - m_d(new CAliasPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Alias node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - ProcessItem(Node,m_d->m_Text); - } -} - -MusicBrainz5::CAlias::CAlias(const CAlias& Other) -: CEntity(), - m_d(new CAliasPrivate) -{ - *this=Other; -} - -MusicBrainz5::CAlias& MusicBrainz5::CAlias::operator =(const CAlias& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Locale=Other.m_d->m_Locale; - m_d->m_Text=Other.m_d->m_Text; - m_d->m_SortName=Other.m_d->m_SortName; - m_d->m_Type=Other.m_d->m_Type; - m_d->m_Primary=Other.m_d->m_Primary; - m_d->m_BeginDate=Other.m_d->m_BeginDate; - m_d->m_EndDate=Other.m_d->m_EndDate; - } - - return *this; -} - -MusicBrainz5::CAlias::~CAlias() -{ - delete m_d; -} - -MusicBrainz5::CAlias *MusicBrainz5::CAlias::Clone() -{ - return new CAlias(*this); -} - -void MusicBrainz5::CAlias::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("locale"==Name) - m_d->m_Locale=Value; - else if ("sort-name"==Name) - m_d->m_SortName=Value; - else if ("type"==Name) - m_d->m_Type=Value; - else if ("primary"==Name) - m_d->m_Primary=Value; - else if ("begin-date"==Name) - m_d->m_BeginDate=Value; - else if ("end-date"==Name) - m_d->m_EndDate=Value; - else - { - std::cerr << "Unrecognised alias attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CAlias::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - std::cerr << "Unrecognised alias element: '" << NodeName << std::endl; -} - -std::string MusicBrainz5::CAlias::GetElementName() -{ - return "alias"; -} - -std::string MusicBrainz5::CAlias::Locale() const -{ - return m_d->m_Locale; -} - -std::string MusicBrainz5::CAlias::Text() const -{ - return m_d->m_Text; -} - -std::string MusicBrainz5::CAlias::SortName() const -{ - return m_d->m_SortName; -} - -std::string MusicBrainz5::CAlias::Type() const -{ - return m_d->m_Type; -} - -std::string MusicBrainz5::CAlias::Primary() const -{ - return m_d->m_Primary; -} - -std::string MusicBrainz5::CAlias::BeginDate() const -{ - return m_d->m_BeginDate; -} - -std::string MusicBrainz5::CAlias::EndDate() const -{ - return m_d->m_EndDate; -} - -std::ostream& MusicBrainz5::CAlias::Serialise(std::ostream& os) const -{ - os << "Alias:" << std::endl; - - CEntity::Serialise(os); - - os << "\tLocale: " << Locale() << std::endl; - os << "\tText: " << Text() << std::endl; - os << "\tSort Name: " << SortName() << std::endl; - os << "\tType: " << Type() << std::endl; - os << "\tPrimary: " << Primary() << std::endl; - os << "\tBeginDate: " << BeginDate() << std::endl; - os << "\tEndDate: " << EndDate() << std::endl; - - return os; -} diff --git a/src/Annotation.cc b/src/Annotation.cc index 3091973..e138c83 100644 --- a/src/Annotation.cc +++ b/src/Annotation.cc @@ -87,9 +87,7 @@ void MusicBrainz5::CAnnotation::ParseAttribute(const std::string& Name, const st m_d->m_Type=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised annotation attribute: '" << Name << "'" << std::endl; -#endif } } @@ -111,9 +109,7 @@ void MusicBrainz5::CAnnotation::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised annotation element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Annotation.cc.silence-warnings b/src/Annotation.cc.silence-warnings deleted file mode 100644 index e138c83..0000000 --- a/src/Annotation.cc.silence-warnings +++ /dev/null @@ -1,153 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Annotation.h" - -class MusicBrainz5::CAnnotationPrivate -{ -public: - std::string m_Type; - std::string m_Entity; - std::string m_Name; - std::string m_Text; -}; - -MusicBrainz5::CAnnotation::CAnnotation(const XMLNode& Node) -: CEntity(), - m_d(new CAnnotationPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Annotation node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CAnnotation::CAnnotation(const CAnnotation& Other) -: CEntity(), - m_d(new CAnnotationPrivate) -{ - *this=Other; -} - -MusicBrainz5::CAnnotation& MusicBrainz5::CAnnotation::operator =(const CAnnotation& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Type=Other.m_d->m_Type; - m_d->m_Entity=Other.m_d->m_Entity; - m_d->m_Name=Other.m_d->m_Name; - m_d->m_Text=Other.m_d->m_Text; - } - - return *this; -} - -MusicBrainz5::CAnnotation::~CAnnotation() -{ - delete m_d; -} - -MusicBrainz5::CAnnotation *MusicBrainz5::CAnnotation::Clone() -{ - return new CAnnotation(*this); -} - -void MusicBrainz5::CAnnotation::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("type"==Name) - m_d->m_Type=Value; - else - { - std::cerr << "Unrecognised annotation attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CAnnotation::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("entity"==NodeName) - { - ProcessItem(Node,m_d->m_Entity); - } - else if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else if ("text"==NodeName) - { - ProcessItem(Node,m_d->m_Text); - } - else - { - std::cerr << "Unrecognised annotation element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CAnnotation::GetElementName() -{ - return "annotation"; -} - -std::string MusicBrainz5::CAnnotation::Type() const -{ - return m_d->m_Type; -} - -std::string MusicBrainz5::CAnnotation::Entity() const -{ - return m_d->m_Entity; -} - -std::string MusicBrainz5::CAnnotation::Name() const -{ - return m_d->m_Name; -} - -std::string MusicBrainz5::CAnnotation::Text() const -{ - return m_d->m_Text; -} - -std::ostream& MusicBrainz5::CAnnotation::Serialise(std::ostream& os) const -{ - os << "Annotation:" << std::endl; - - CEntity::Serialise(os); - - os << "\tType: " << Type() << std::endl; - os << "\tEntity: " << Entity() << std::endl; - os << "\tName: " << Name() << std::endl; - os << "\tText: " << Text() << std::endl; - - return os; -} diff --git a/src/Artist.cc b/src/Artist.cc index 528ff96..bcf37c3 100644 --- a/src/Artist.cc +++ b/src/Artist.cc @@ -234,9 +234,7 @@ void MusicBrainz5::CArtist::ParseAttribute(const std::string& Name, const std::s m_d->m_Type=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised artist attribute: '" << Name << "'" << std::endl; -#endif } } @@ -322,9 +320,7 @@ void MusicBrainz5::CArtist::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised artist element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Artist.cc.silence-warnings b/src/Artist.cc.silence-warnings deleted file mode 100644 index bcf37c3..0000000 --- a/src/Artist.cc.silence-warnings +++ /dev/null @@ -1,487 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Artist.h" - -#include "musicbrainz5/Lifespan.h" -#include "musicbrainz5/IPI.h" -#include "musicbrainz5/Rating.h" -#include "musicbrainz5/UserRating.h" -#include "musicbrainz5/AliasList.h" -#include "musicbrainz5/Alias.h" -#include "musicbrainz5/RecordingList.h" -#include "musicbrainz5/Recording.h" -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/ReleaseGroupList.h" -#include "musicbrainz5/ReleaseGroup.h" -#include "musicbrainz5/LabelList.h" -#include "musicbrainz5/Label.h" -#include "musicbrainz5/WorkList.h" -#include "musicbrainz5/Work.h" -#include "musicbrainz5/RelationList.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/Relation.h" -#include "musicbrainz5/TagList.h" -#include "musicbrainz5/Tag.h" -#include "musicbrainz5/UserTagList.h" -#include "musicbrainz5/UserTag.h" - -class MusicBrainz5::CArtistPrivate -{ - public: - CArtistPrivate() - : m_IPIList(0), - m_Lifespan(0), - m_AliasList(0), - m_RecordingList(0), - m_ReleaseList(0), - m_ReleaseGroupList(0), - m_LabelList(0), - m_WorkList(0), - m_RelationListList(0), - m_TagList(0), - m_UserTagList(0), - m_Rating(0), - m_UserRating(0) - { - } - - std::string m_ID; - std::string m_Type; - std::string m_Name; - std::string m_SortName; - std::string m_Gender; - std::string m_Country; - std::string m_Disambiguation; - CIPIList *m_IPIList; - CLifespan *m_Lifespan; - CAliasList *m_AliasList; - CRecordingList *m_RecordingList; - CReleaseList *m_ReleaseList; - CReleaseGroupList *m_ReleaseGroupList; - CLabelList *m_LabelList; - CWorkList *m_WorkList; - CRelationListList *m_RelationListList; - CTagList *m_TagList; - CUserTagList *m_UserTagList; - CRating *m_Rating; - CUserRating *m_UserRating; -}; - -MusicBrainz5::CArtist::CArtist(const XMLNode& Node) -: CEntity(), - m_d(new CArtistPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Artist node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CArtist::CArtist(const CArtist& Other) -: CEntity(), - m_d(new CArtistPrivate) -{ - *this=Other; -} - -MusicBrainz5::CArtist& MusicBrainz5::CArtist::operator =(const CArtist& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Type=Other.m_d->m_Type; - m_d->m_Name=Other.m_d->m_Name; - m_d->m_SortName=Other.m_d->m_SortName; - m_d->m_Gender=Other.m_d->m_Gender; - m_d->m_Country=Other.m_d->m_Country; - m_d->m_Disambiguation=Other.m_d->m_Disambiguation; - - if (Other.m_d->m_IPIList) - m_d->m_IPIList=new CIPIList(*Other.m_d->m_IPIList); - - if (Other.m_d->m_Lifespan) - m_d->m_Lifespan=new CLifespan(*Other.m_d->m_Lifespan); - - if (Other.m_d->m_AliasList) - m_d->m_AliasList=new CAliasList(*Other.m_d->m_AliasList); - - if (Other.m_d->m_RecordingList) - m_d->m_RecordingList=new CRecordingList(*Other.m_d->m_RecordingList); - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - - if (Other.m_d->m_ReleaseGroupList) - m_d->m_ReleaseGroupList=new CReleaseGroupList(*Other.m_d->m_ReleaseGroupList); - - if (Other.m_d->m_LabelList) - m_d->m_LabelList=new CLabelList(*Other.m_d->m_LabelList); - - if (Other.m_d->m_WorkList) - m_d->m_WorkList=new CWorkList(*Other.m_d->m_WorkList); - - if (Other.m_d->m_RelationListList) - m_d->m_RelationListList=new CRelationListList(*Other.m_d->m_RelationListList); - - if (Other.m_d->m_TagList) - m_d->m_TagList=new CTagList(*Other.m_d->m_TagList); - - if (Other.m_d->m_UserTagList) - m_d->m_UserTagList=new CUserTagList(*Other.m_d->m_UserTagList); - - if (Other.m_d->m_Rating) - m_d->m_Rating=new CRating(*Other.m_d->m_Rating); - - if (Other.m_d->m_UserRating) - m_d->m_UserRating=new CUserRating(*Other.m_d->m_UserRating); - } - - return *this; -} - -MusicBrainz5::CArtist::~CArtist() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CArtist::Cleanup() -{ - delete m_d->m_IPIList; - m_d->m_IPIList=0; - - delete m_d->m_Lifespan; - m_d->m_Lifespan=0; - - delete m_d->m_AliasList; - m_d->m_AliasList=0; - - delete m_d->m_RecordingList; - m_d->m_RecordingList=0; - - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; - - delete m_d->m_ReleaseGroupList; - m_d->m_ReleaseGroupList=0; - - delete m_d->m_LabelList; - m_d->m_LabelList=0; - - delete m_d->m_WorkList; - m_d->m_WorkList=0; - - delete m_d->m_RelationListList; - m_d->m_RelationListList=0; - - delete m_d->m_TagList; - m_d->m_TagList=0; - - delete m_d->m_UserTagList; - m_d->m_UserTagList=0; - - delete m_d->m_Rating; - m_d->m_Rating=0; - - delete m_d->m_UserRating; - m_d->m_UserRating=0; -} - -MusicBrainz5::CArtist *MusicBrainz5::CArtist::Clone() -{ - return new CArtist(*this); -} - -void MusicBrainz5::CArtist::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else if ("type"==Name) - m_d->m_Type=Value; - else - { - std::cerr << "Unrecognised artist attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CArtist::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else if ("sort-name"==NodeName) - { - ProcessItem(Node,m_d->m_SortName); - } - else if ("gender"==NodeName) - { - ProcessItem(Node,m_d->m_Gender); - } - else if ("country"==NodeName) - { - ProcessItem(Node,m_d->m_Country); - } - else if ("disambiguation"==NodeName) - { - ProcessItem(Node,m_d->m_Disambiguation); - } - else if ("ipi"==NodeName) - { - //Ignore IPI - } - else if ("ipi-list"==NodeName) - { - ProcessItem(Node,m_d->m_IPIList); - } - else if ("life-span"==NodeName) - { - ProcessItem(Node,m_d->m_Lifespan); - } - else if ("alias-list"==NodeName) - { - ProcessItem(Node,m_d->m_AliasList); - } - else if ("recording-list"==NodeName) - { - ProcessItem(Node,m_d->m_RecordingList); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else if ("release-group-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseGroupList); - } - else if ("label-list"==NodeName) - { - ProcessItem(Node,m_d->m_LabelList); - } - else if ("work-list"==NodeName) - { - ProcessItem(Node,m_d->m_WorkList); - } - else if ("relation-list"==NodeName) - { - ProcessRelationList(Node,m_d->m_RelationListList); - } - else if ("tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_TagList); - } - else if ("user-tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_UserTagList); - } - else if ("rating"==NodeName) - { - ProcessItem(Node,m_d->m_Rating); - } - else if ("user-rating"==NodeName) - { - ProcessItem(Node,m_d->m_UserRating); - } - else - { - std::cerr << "Unrecognised artist element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CArtist::GetElementName() -{ - return "artist"; -} - -std::string MusicBrainz5::CArtist::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CArtist::Type() const -{ - return m_d->m_Type; -} - -std::string MusicBrainz5::CArtist::Name() const -{ - return m_d->m_Name; -} - -std::string MusicBrainz5::CArtist::SortName() const -{ - return m_d->m_SortName; -} - -std::string MusicBrainz5::CArtist::Gender() const -{ - return m_d->m_Gender; -} - -std::string MusicBrainz5::CArtist::Country() const -{ - return m_d->m_Country; -} - -std::string MusicBrainz5::CArtist::Disambiguation() const -{ - return m_d->m_Disambiguation; -} - -MusicBrainz5::CIPIList *MusicBrainz5::CArtist::IPIList() const -{ - return m_d->m_IPIList; -} - -MusicBrainz5::CLifespan *MusicBrainz5::CArtist::Lifespan() const -{ - return m_d->m_Lifespan; -} - -MusicBrainz5::CAliasList *MusicBrainz5::CArtist::AliasList() const -{ - return m_d->m_AliasList; -} - -MusicBrainz5::CRecordingList *MusicBrainz5::CArtist::RecordingList() const -{ - return m_d->m_RecordingList; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CArtist::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -MusicBrainz5::CReleaseGroupList *MusicBrainz5::CArtist::ReleaseGroupList() const -{ - return m_d->m_ReleaseGroupList; -} - -MusicBrainz5::CLabelList *MusicBrainz5::CArtist::LabelList() const -{ - return m_d->m_LabelList; -} - -MusicBrainz5::CWorkList *MusicBrainz5::CArtist::WorkList() const -{ - return m_d->m_WorkList; -} - -MusicBrainz5::CRelationListList *MusicBrainz5::CArtist::RelationListList() const -{ - return m_d->m_RelationListList; -} - -MusicBrainz5::CTagList *MusicBrainz5::CArtist::TagList() const -{ - return m_d->m_TagList; -} - -MusicBrainz5::CUserTagList *MusicBrainz5::CArtist::UserTagList() const -{ - return m_d->m_UserTagList; -} - -MusicBrainz5::CRating *MusicBrainz5::CArtist::Rating() const -{ - return m_d->m_Rating; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CArtist::UserRating() const -{ - return m_d->m_UserRating; -} - -std::ostream& MusicBrainz5::CArtist::Serialise(std::ostream& os) const -{ - os << "Artist:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tType: " << Type() << std::endl; - os << "\tName: " << Name() << std::endl; - os << "\tSort name: " << SortName() << std::endl; - os << "\tGender: " << Gender() << std::endl; - os << "\tCountry: " << Country() << std::endl; - os << "\tDisambiguation: " << Disambiguation() << std::endl; - - if (IPIList()) - os << *IPIList() << std::endl; - - if (Lifespan()) - os << *Lifespan() << std::endl; - - if (AliasList()) - os << *AliasList() << std::endl; - - if (RecordingList()) - os << *RecordingList() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - if (ReleaseGroupList()) - os << *ReleaseGroupList() << std::endl; - - if (LabelList()) - os << *LabelList() << std::endl; - - if (WorkList()) - os << *WorkList() << std::endl; - - if (RelationListList()) - os << *RelationListList() << std::endl; - - if (TagList()) - os << *TagList() << std::endl; - - if (UserTagList()) - os << *UserTagList() << std::endl; - - if (Rating()) - os << *Rating() << std::endl; - - if (UserRating()) - os << *UserRating() << std::endl; - - return os; -} - diff --git a/src/ArtistCredit.cc b/src/ArtistCredit.cc index b31f549..6ad7e64 100644 --- a/src/ArtistCredit.cc +++ b/src/ArtistCredit.cc @@ -98,11 +98,7 @@ MusicBrainz5::CArtistCredit *MusicBrainz5::CArtistCredit::Clone() void MusicBrainz5::CArtistCredit::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised artistcredit attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CArtistCredit::ParseElement(const XMLNode& Node) @@ -116,9 +112,7 @@ void MusicBrainz5::CArtistCredit::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised artistcredit element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/ArtistCredit.cc.silence-warnings b/src/ArtistCredit.cc.silence-warnings deleted file mode 100644 index 6ad7e64..0000000 --- a/src/ArtistCredit.cc.silence-warnings +++ /dev/null @@ -1,139 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/ArtistCredit.h" - -#include "musicbrainz5/NameCreditList.h" -#include "musicbrainz5/NameCredit.h" - -class MusicBrainz5::CArtistCreditPrivate -{ - public: - CArtistCreditPrivate() - : m_NameCreditList(0) - { - } - - CNameCreditList *m_NameCreditList; -}; - -MusicBrainz5::CArtistCredit::CArtistCredit(const XMLNode& Node) -: CEntity(), - m_d(new CArtistCreditPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Artist credit node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - m_d->m_NameCreditList=new CNameCreditList(Node); - } -} - -MusicBrainz5::CArtistCredit::CArtistCredit(const CArtistCredit& Other) -: CEntity(), - m_d(new CArtistCreditPrivate) -{ - *this=Other; -} - -MusicBrainz5::CArtistCredit& MusicBrainz5::CArtistCredit::operator =(const CArtistCredit& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - if (Other.m_d->m_NameCreditList) - m_d->m_NameCreditList=new CNameCreditList(*Other.m_d->m_NameCreditList); - } - - return *this; -} - -MusicBrainz5::CArtistCredit::~CArtistCredit() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CArtistCredit::Cleanup() -{ - delete m_d->m_NameCreditList; - m_d->m_NameCreditList=0; -} - -MusicBrainz5::CArtistCredit *MusicBrainz5::CArtistCredit::Clone() -{ - return new CArtistCredit(*this); -} - -void MusicBrainz5::CArtistCredit::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised artistcredit attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CArtistCredit::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name-credit"==NodeName) - { - //The artist credit element is a special case, in that all it contains is a list of name-credits - //Parsing of this list is handled in the constructor - } - else - { - std::cerr << "Unrecognised artistcredit element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CArtistCredit::GetElementName() -{ - return "artist-credit"; -} - -MusicBrainz5::CNameCreditList *MusicBrainz5::CArtistCredit::NameCreditList() const -{ - return m_d->m_NameCreditList; -} - -std::ostream& MusicBrainz5::CArtistCredit::Serialise(std::ostream& os) const -{ - os << "Artist credit:" << std::endl; - - CEntity::Serialise(os); - - if (NameCreditList()) - os << *NameCreditList() << std::endl; - - return os; -} diff --git a/src/Attribute.cc b/src/Attribute.cc index dafc0a9..9e0afce 100644 --- a/src/Attribute.cc +++ b/src/Attribute.cc @@ -80,20 +80,14 @@ MusicBrainz5::CAttribute *MusicBrainz5::CAttribute::Clone() void MusicBrainz5::CAttribute::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised attribute attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CAttribute::ParseElement(const XMLNode& Node) { std::string NodeName=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised attribute element: '" << NodeName << "'" << std::endl; -#endif } std::string MusicBrainz5::CAttribute::GetElementName() diff --git a/src/Attribute.cc.silence-warnings b/src/Attribute.cc.silence-warnings deleted file mode 100644 index 9e0afce..0000000 --- a/src/Attribute.cc.silence-warnings +++ /dev/null @@ -1,114 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Attribute.h" - -class MusicBrainz5::CAttributePrivate -{ - public: - std::string m_Text; -}; - -MusicBrainz5::CAttribute::CAttribute(const XMLNode& Node) -: CEntity(), - m_d(new CAttributePrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Attribute node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - ProcessItem(Node,m_d->m_Text); - } -} - -MusicBrainz5::CAttribute::CAttribute(const CAttribute& Other) -: CEntity(), - m_d(new CAttributePrivate) -{ - *this=Other; -} - -MusicBrainz5::CAttribute& MusicBrainz5::CAttribute::operator =(const CAttribute& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Text=Other.m_d->m_Text; - } - - return *this; -} - -MusicBrainz5::CAttribute::~CAttribute() -{ - delete m_d; -} - -MusicBrainz5::CAttribute *MusicBrainz5::CAttribute::Clone() -{ - return new CAttribute(*this); -} - -void MusicBrainz5::CAttribute::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised attribute attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CAttribute::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - std::cerr << "Unrecognised attribute element: '" << NodeName << "'" << std::endl; -} - -std::string MusicBrainz5::CAttribute::GetElementName() -{ - return "attribute"; -} - -std::string MusicBrainz5::CAttribute::Text() const -{ - return m_d->m_Text; -} - -std::ostream& MusicBrainz5::CAttribute::Serialise(std::ostream& os) const -{ - os << "Attribute:" << std::endl; - - CEntity::Serialise(os); - - os << "\tText: " << Text() << std::endl; - - return os; -} - - diff --git a/src/CDStub.cc b/src/CDStub.cc index 707429d..f237351 100644 --- a/src/CDStub.cc +++ b/src/CDStub.cc @@ -111,9 +111,7 @@ void MusicBrainz5::CCDStub::ParseAttribute(const std::string& Name, const std::s m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised cdstub attribute: '" << Name << "'" << std::endl; -#endif } } @@ -143,9 +141,7 @@ void MusicBrainz5::CCDStub::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised cd stub element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/CDStub.cc.silence-warnings b/src/CDStub.cc.silence-warnings deleted file mode 100644 index f237351..0000000 --- a/src/CDStub.cc.silence-warnings +++ /dev/null @@ -1,199 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/CDStub.h" - -#include "musicbrainz5/NonMBTrackList.h" -#include "musicbrainz5/NonMBTrack.h" - -class MusicBrainz5::CCDStubPrivate -{ - public: - CCDStubPrivate() - : m_NonMBTrackList(0) - { - } - - std::string m_ID; - std::string m_Title; - std::string m_Artist; - std::string m_Barcode; - std::string m_Comment; - CNonMBTrackList *m_NonMBTrackList; -}; - -MusicBrainz5::CCDStub::CCDStub(const XMLNode& Node) -: CEntity(), - m_d(new CCDStubPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "CDStub node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CCDStub::CCDStub(const CCDStub& Other) -: CEntity(), - m_d(new CCDStubPrivate) -{ - *this=Other; -} - -MusicBrainz5::CCDStub& MusicBrainz5::CCDStub::operator =(const CCDStub& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Artist=Other.m_d->m_Artist; - m_d->m_Barcode=Other.m_d->m_Barcode; - m_d->m_Comment=Other.m_d->m_Comment; - - if (Other.m_d->m_NonMBTrackList) - m_d->m_NonMBTrackList=new CNonMBTrackList(*Other.m_d->m_NonMBTrackList); - } - - return *this; -} - -MusicBrainz5::CCDStub::~CCDStub() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CCDStub::Cleanup() -{ - delete m_d->m_NonMBTrackList; - m_d->m_NonMBTrackList=0; -} - -MusicBrainz5::CCDStub *MusicBrainz5::CCDStub::Clone() -{ - return new CCDStub(*this); -} - -void MusicBrainz5::CCDStub::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised cdstub attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CCDStub::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("artist"==NodeName) - { - ProcessItem(Node,m_d->m_Artist); - } - else if ("barcode"==NodeName) - { - ProcessItem(Node,m_d->m_Barcode); - } - else if ("comment"==NodeName) - { - ProcessItem(Node,m_d->m_Comment); - } - else if ("track-list"==NodeName) - { - ProcessItem(Node,m_d->m_NonMBTrackList); - } - else - { - std::cerr << "Unrecognised cd stub element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CCDStub::GetElementName() -{ - return "cdstub"; -} - -std::string MusicBrainz5::CCDStub::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CCDStub::Title() const -{ - return m_d->m_Title; -} - -std::string MusicBrainz5::CCDStub::Artist() const -{ - return m_d->m_Artist; -} - -std::string MusicBrainz5::CCDStub::Barcode() const -{ - return m_d->m_Barcode; -} - -std::string MusicBrainz5::CCDStub::Comment() const -{ - return m_d->m_Comment; -} - -MusicBrainz5::CNonMBTrackList *MusicBrainz5::CCDStub::NonMBTrackList() const -{ - return m_d->m_NonMBTrackList; -} - -std::ostream& MusicBrainz5::CCDStub::Serialise(std::ostream& os) const -{ - os << "CDStub:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tTitle: " << Title() << std::endl; - os << "\tArtist: " << Artist() << std::endl; - os << "\tBarcode: " << Barcode() << std::endl; - os << "\tComment: " << Comment() << std::endl; - - if (NonMBTrackList()) - os << *NonMBTrackList() << std::endl; - - return os; -} diff --git a/src/Collection.cc b/src/Collection.cc index 8cb2c72..293af2c 100644 --- a/src/Collection.cc +++ b/src/Collection.cc @@ -106,9 +106,7 @@ void MusicBrainz5::CCollection::ParseAttribute(const std::string& Name, const st m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised collection attribute: '" << Name << "'" << std::endl; -#endif } } @@ -130,9 +128,7 @@ void MusicBrainz5::CCollection::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised collection element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Collection.cc.silence-warnings b/src/Collection.cc.silence-warnings deleted file mode 100644 index 293af2c..0000000 --- a/src/Collection.cc.silence-warnings +++ /dev/null @@ -1,174 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Collection.h" - -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/Release.h" - -class MusicBrainz5::CCollectionPrivate -{ - public: - CCollectionPrivate() - : m_ReleaseList(0) - { - } - - std::string m_ID; - std::string m_Name; - std::string m_Editor; - CReleaseList *m_ReleaseList; -}; -MusicBrainz5::CCollection::CCollection(const XMLNode& Node) -: CEntity(), - m_d(new CCollectionPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Medium node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CCollection::CCollection(const CCollection& Other) -: CEntity(), - m_d(new CCollectionPrivate) -{ - *this=Other; -} - -MusicBrainz5::CCollection& MusicBrainz5::CCollection::operator =(const CCollection& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Name=Other.m_d->m_Name; - m_d->m_Editor=Other.m_d->m_Editor; - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - } - - return *this; -} - -MusicBrainz5::CCollection::~CCollection() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CCollection::Cleanup() -{ - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; -} - -MusicBrainz5::CCollection *MusicBrainz5::CCollection::Clone() -{ - return new CCollection(*this); -} - -void MusicBrainz5::CCollection::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised collection attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CCollection::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else if ("editor"==NodeName) - { - ProcessItem(Node,m_d->m_Editor); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else - { - std::cerr << "Unrecognised collection element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CCollection::GetElementName() -{ - return "collection"; -} - -std::string MusicBrainz5::CCollection::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CCollection::Name() const -{ - return m_d->m_Name; -} - -std::string MusicBrainz5::CCollection::Editor() const -{ - return m_d->m_Editor; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CCollection::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -std::ostream& MusicBrainz5::CCollection::Serialise(std::ostream& os) const -{ - os << "Collection:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tName: " << Name() << std::endl; - os << "\tEditor: " << Editor() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - return os; -} diff --git a/src/Disc.cc b/src/Disc.cc index bbd0922..0616ea7 100644 --- a/src/Disc.cc +++ b/src/Disc.cc @@ -106,9 +106,7 @@ void MusicBrainz5::CDisc::ParseAttribute(const std::string& Name, const std::str ProcessItem(Value,m_d->m_ID); else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised disc attribute: '" << Name << "'" << std::endl; -#endif } } @@ -126,9 +124,7 @@ void MusicBrainz5::CDisc::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised disc element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Disc.cc.silence-warnings b/src/Disc.cc.silence-warnings deleted file mode 100644 index 0616ea7..0000000 --- a/src/Disc.cc.silence-warnings +++ /dev/null @@ -1,165 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Disc.h" - -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/Release.h" - -class MusicBrainz5::CDiscPrivate -{ - public: - CDiscPrivate() - : m_Sectors(0), - m_ReleaseList(0) - { - } - - std::string m_ID; - int m_Sectors; - CReleaseList *m_ReleaseList; -}; - -MusicBrainz5::CDisc::CDisc(const XMLNode& Node) -: CEntity(), - m_d(new CDiscPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Disc node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CDisc::CDisc(const CDisc& Other) -: CEntity(), - m_d(new CDiscPrivate) -{ - *this=Other; -} - -MusicBrainz5::CDisc& MusicBrainz5::CDisc::operator =(const CDisc& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Sectors=Other.m_d->m_Sectors; - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - } - - return *this; -} - -MusicBrainz5::CDisc::~CDisc() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CDisc::Cleanup() -{ - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; -} - -MusicBrainz5::CDisc *MusicBrainz5::CDisc::Clone() -{ - return new CDisc(*this); -} - -void MusicBrainz5::CDisc::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - ProcessItem(Value,m_d->m_ID); - else - { - std::cerr << "Unrecognised disc attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CDisc::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("sectors"==NodeName) - { - ProcessItem(Node,m_d->m_Sectors); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else - { - std::cerr << "Unrecognised disc element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CDisc::GetElementName() -{ - return "disc"; -} - -std::string MusicBrainz5::CDisc::ID() const -{ - return m_d->m_ID; -} - -int MusicBrainz5::CDisc::Sectors() const -{ - return m_d->m_Sectors; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CDisc::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -std::ostream& MusicBrainz5::CDisc::Serialise(std::ostream& os) const -{ - os << "Disc:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tSectors: " << Sectors() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - return os; -} - diff --git a/src/FreeDBDisc.cc b/src/FreeDBDisc.cc index 4d5f1a3..a888192 100644 --- a/src/FreeDBDisc.cc +++ b/src/FreeDBDisc.cc @@ -111,9 +111,7 @@ void MusicBrainz5::CFreeDBDisc::ParseAttribute(const std::string& Name, const st m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised freedb disc attribute: '" << Name << "'" << std::endl; -#endif } } @@ -143,9 +141,7 @@ void MusicBrainz5::CFreeDBDisc::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised freedb disc element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/FreeDBDisc.cc.silence-warnings b/src/FreeDBDisc.cc.silence-warnings deleted file mode 100644 index a888192..0000000 --- a/src/FreeDBDisc.cc.silence-warnings +++ /dev/null @@ -1,199 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/FreeDBDisc.h" - -#include "musicbrainz5/NonMBTrackList.h" -#include "musicbrainz5/NonMBTrack.h" - -class MusicBrainz5::CFreeDBDiscPrivate -{ - public: - CFreeDBDiscPrivate() - : m_NonMBTrackList(0) - { - } - - std::string m_ID; - std::string m_Title; - std::string m_Artist; - std::string m_Category; - std::string m_Year; - CNonMBTrackList *m_NonMBTrackList; -}; - -MusicBrainz5::CFreeDBDisc::CFreeDBDisc(const XMLNode& Node) -: CEntity(), - m_d(new CFreeDBDiscPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "FreeDBDisc node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CFreeDBDisc::CFreeDBDisc(const CFreeDBDisc& Other) -: CEntity(), - m_d(new CFreeDBDiscPrivate) -{ - *this=Other; -} - -MusicBrainz5::CFreeDBDisc& MusicBrainz5::CFreeDBDisc::operator =(const CFreeDBDisc& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Artist=Other.m_d->m_Artist; - m_d->m_Category=Other.m_d->m_Category; - m_d->m_Year=Other.m_d->m_Year; - - if (Other.m_d->m_NonMBTrackList) - m_d->m_NonMBTrackList=new CNonMBTrackList(*Other.m_d->m_NonMBTrackList); - } - - return *this; -} - -MusicBrainz5::CFreeDBDisc::~CFreeDBDisc() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CFreeDBDisc::Cleanup() -{ - delete m_d->m_NonMBTrackList; - m_d->m_NonMBTrackList=0; -} - -MusicBrainz5::CFreeDBDisc *MusicBrainz5::CFreeDBDisc::Clone() -{ - return new CFreeDBDisc(*this); -} - -void MusicBrainz5::CFreeDBDisc::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised freedb disc attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CFreeDBDisc::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("artist"==NodeName) - { - ProcessItem(Node,m_d->m_Artist); - } - else if ("category"==NodeName) - { - ProcessItem(Node,m_d->m_Category); - } - else if ("year"==NodeName) - { - ProcessItem(Node,m_d->m_Year); - } - else if ("nonmb-track-list"==NodeName) - { - ProcessItem(Node,m_d->m_NonMBTrackList); - } - else - { - std::cerr << "Unrecognised freedb disc element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CFreeDBDisc::GetElementName() -{ - return "freedb-disc"; -} - -std::string MusicBrainz5::CFreeDBDisc::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CFreeDBDisc::Title() const -{ - return m_d->m_Title; -} - -std::string MusicBrainz5::CFreeDBDisc::Artist() const -{ - return m_d->m_Artist; -} - -std::string MusicBrainz5::CFreeDBDisc::Category() const -{ - return m_d->m_Category; -} - -std::string MusicBrainz5::CFreeDBDisc::Year() const -{ - return m_d->m_Year; -} - -MusicBrainz5::CNonMBTrackList *MusicBrainz5::CFreeDBDisc::NonMBTrackList() const -{ - return m_d->m_NonMBTrackList; -} - -std::ostream& MusicBrainz5::CFreeDBDisc::Serialise(std::ostream& os) const -{ - os << "FreeDBDisc:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tTitle: " << Title() << std::endl; - os << "\tArtist: " << Artist() << std::endl; - os << "\tCategory: " << Category() << std::endl; - os << "\tYear: " << Year() << std::endl; - - if (NonMBTrackList()) - os << *NonMBTrackList() << std::endl; - - return os; -} diff --git a/src/HTTPFetch.cc b/src/HTTPFetch.cc index baec359..ac3f9b4 100644 --- a/src/HTTPFetch.cc +++ b/src/HTTPFetch.cc @@ -36,26 +36,6 @@ #include "ne_string.h" #include "ne_request.h" -#if defined(__GNUC__) -__attribute__((constructor)) -#else - #error Non GCC compiler detected -#endif -static void initialize_neon() -{ - ne_sock_init(); -} - -#if defined(__GNUC__) -__attribute__((destructor)) -#else - #error Non GCC compiler detected -#endif -static void destroy_neon() -{ - ne_sock_exit(); -} - class MusicBrainz5::CHTTPFetchPrivate { public: @@ -167,6 +147,8 @@ int MusicBrainz5::CHTTPFetch::Fetch(const std::string& URL, const std::string& R m_d->m_Data.clear(); + ne_sock_init(); + ne_session *sess=ne_session_create("http", m_d->m_Host.c_str(), m_d->m_Port); if (sess) { @@ -248,6 +230,8 @@ int MusicBrainz5::CHTTPFetch::Fetch(const std::string& URL, const std::string& R } } + ne_sock_exit(); + return Ret; } diff --git a/src/HTTPFetch.cc.silence-warnings b/src/HTTPFetch.cc.silence-warnings deleted file mode 100644 index ac3f9b4..0000000 --- a/src/HTTPFetch.cc.silence-warnings +++ /dev/null @@ -1,287 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/HTTPFetch.h" - -#include -#include - -#include "ne_session.h" -#include "ne_auth.h" -#include "ne_string.h" -#include "ne_request.h" - -class MusicBrainz5::CHTTPFetchPrivate -{ - public: - CHTTPFetchPrivate() - : m_Port(80), - m_Result(0), - m_Status(0), - m_ProxyPort(0) - { - } - - std::string m_UserAgent; - std::string m_Host; - int m_Port; - std::vector m_Data; - int m_Result; - int m_Status; - std::string m_ErrorMessage; - std::string m_UserName; - std::string m_Password; - std::string m_ProxyHost; - int m_ProxyPort; - std::string m_ProxyUserName; - std::string m_ProxyPassword; -}; - -MusicBrainz5::CHTTPFetch::CHTTPFetch(const std::string& UserAgent, const std::string& Host, int Port) -: m_d(new CHTTPFetchPrivate) -{ - m_d->m_UserAgent=UserAgent; - - for (std::string::size_type Pos=0;Posm_UserAgent.length();Pos++) - if (m_d->m_UserAgent[Pos]=='-') - m_d->m_UserAgent[Pos]='/'; - - m_d->m_Host=Host; - m_d->m_Port=Port; - - // Parse http_proxy environmnent variable - const char *http_proxy = getenv("http_proxy"); - if (http_proxy) - { - ne_uri uri; - if (!ne_uri_parse(http_proxy, &uri)) - { - if (uri.host) - m_d->m_ProxyHost = uri.host; - if (uri.port) - m_d->m_ProxyPort = uri.port; - - if (uri.userinfo) - { - char *pos = strchr(uri.userinfo, ':'); - if (pos) - { - *pos = '\0'; - m_d->m_ProxyUserName = uri.userinfo; - m_d->m_ProxyPassword = pos + 1; - } - else - { - m_d->m_ProxyUserName = uri.userinfo; - } - } - } - - ne_uri_free(&uri); - } -} - -MusicBrainz5::CHTTPFetch::~CHTTPFetch() -{ - delete m_d; -} - -void MusicBrainz5::CHTTPFetch::SetUserName(const std::string& UserName) -{ - m_d->m_UserName=UserName; -} - -void MusicBrainz5::CHTTPFetch::SetPassword(const std::string& Password) -{ - m_d->m_Password=Password; -} - -void MusicBrainz5::CHTTPFetch::SetProxyHost(const std::string& ProxyHost) -{ - m_d->m_ProxyHost=ProxyHost; -} - -void MusicBrainz5::CHTTPFetch::SetProxyPort(int ProxyPort) -{ - m_d->m_ProxyPort=ProxyPort; -} - -void MusicBrainz5::CHTTPFetch::SetProxyUserName(const std::string& ProxyUserName) -{ - m_d->m_ProxyUserName=ProxyUserName; -} - -void MusicBrainz5::CHTTPFetch::SetProxyPassword(const std::string& ProxyPassword) -{ - m_d->m_ProxyPassword=ProxyPassword; -} - -int MusicBrainz5::CHTTPFetch::Fetch(const std::string& URL, const std::string& Request) -{ - int Ret=0; - - m_d->m_Data.clear(); - - ne_sock_init(); - - ne_session *sess=ne_session_create("http", m_d->m_Host.c_str(), m_d->m_Port); - if (sess) - { - ne_set_useragent(sess, m_d->m_UserAgent.c_str()); - - ne_set_server_auth(sess, httpAuth, this); - - // Use proxy server - if (!m_d->m_ProxyHost.empty()) - { - ne_session_proxy(sess, m_d->m_ProxyHost.c_str(), m_d->m_ProxyPort); - ne_set_proxy_auth(sess, proxyAuth, this); - } - - ne_request *req = ne_request_create(sess, Request.c_str(), URL.c_str()); - if (Request=="PUT") - ne_set_request_body_buffer(req,0,0); - - if (Request!="GET") - ne_set_request_flag(req, NE_REQFLAG_IDEMPOTENT, 0); - - ne_add_response_body_reader(req, ne_accept_2xx, httpResponseReader, &m_d->m_Data); - - m_d->m_Result = ne_request_dispatch(req); - m_d->m_Status = ne_get_status(req)->code; - - Ret=m_d->m_Data.size(); - - ne_request_destroy(req); - - m_d->m_ErrorMessage = ne_get_error(sess); - - ne_session_destroy(sess); - - switch (m_d->m_Result) - { - case NE_OK: - break; - - case NE_CONNECT: - case NE_LOOKUP: - throw CConnectionError(m_d->m_ErrorMessage); - break; - - case NE_TIMEOUT: - throw CTimeoutError(m_d->m_ErrorMessage); - break; - - case NE_AUTH: - case NE_PROXYAUTH: - throw CAuthenticationError(m_d->m_ErrorMessage); - break; - - default: - throw CFetchError(m_d->m_ErrorMessage); - break; - } - - switch (m_d->m_Status) - { - case 200: - break; - - case 400: - throw CRequestError(m_d->m_ErrorMessage); - break; - - case 401: - throw CAuthenticationError(m_d->m_ErrorMessage); - break; - - case 404: - throw CResourceNotFoundError(m_d->m_ErrorMessage); - break; - - default: - throw CFetchError(m_d->m_ErrorMessage); - break; - } - } - - ne_sock_exit(); - - return Ret; -} - -int MusicBrainz5::CHTTPFetch::httpAuth(void *userdata, const char *realm, int attempts, - char *username, char *password) -{ - realm=realm; - - MusicBrainz5::CHTTPFetch *Fetch = (MusicBrainz5::CHTTPFetch *)userdata; - strncpy(username, Fetch->m_d->m_UserName.c_str(), NE_ABUFSIZ); - strncpy(password, Fetch->m_d->m_Password.c_str(), NE_ABUFSIZ); - return attempts; -} - -int MusicBrainz5::CHTTPFetch::proxyAuth(void *userdata, const char *realm, int attempts, - char *username, char *password) -{ - realm=realm; - - MusicBrainz5::CHTTPFetch *Fetch = (MusicBrainz5::CHTTPFetch *)userdata; - strncpy(username, Fetch->m_d->m_ProxyUserName.c_str(), NE_ABUFSIZ); - strncpy(password, Fetch->m_d->m_ProxyPassword.c_str(), NE_ABUFSIZ); - return attempts; -} - -int MusicBrainz5::CHTTPFetch::httpResponseReader(void *userdata, const char *buf, size_t len) -{ - std::vector *buffer = reinterpret_cast *>(userdata); - - buffer->insert(buffer->end(),buf,buf+len); - - return 0; -} - -std::vector MusicBrainz5::CHTTPFetch::Data() const -{ - return m_d->m_Data; -} - -int MusicBrainz5::CHTTPFetch::Result() const -{ - return m_d->m_Result; -} - -int MusicBrainz5::CHTTPFetch::Status() const -{ - return m_d->m_Status; -} - -std::string MusicBrainz5::CHTTPFetch::ErrorMessage() const -{ - return m_d->m_ErrorMessage; -} diff --git a/src/IPI.cc b/src/IPI.cc index 1722540..8c5e9ad 100644 --- a/src/IPI.cc +++ b/src/IPI.cc @@ -86,20 +86,14 @@ MusicBrainz5::CIPI *MusicBrainz5::CIPI::Clone() void MusicBrainz5::CIPI::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised IPI attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CIPI::ParseElement(const XMLNode& Node) { std::string Name=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised IPI element: '" << Name << "'" << std::endl; -#endif } std::string MusicBrainz5::CIPI::GetElementName() diff --git a/src/IPI.cc.silence-warnings b/src/IPI.cc.silence-warnings deleted file mode 100644 index 8c5e9ad..0000000 --- a/src/IPI.cc.silence-warnings +++ /dev/null @@ -1,119 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/IPI.h" - -class MusicBrainz5::CIPIPrivate -{ - public: - CIPIPrivate() - { - } - - std::string m_IPI; -}; - -MusicBrainz5::CIPI::CIPI(const XMLNode& Node) -: CEntity(), - m_d(new CIPIPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "IPI node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - { - ProcessItem(Node,m_d->m_IPI); - } - } -} - -MusicBrainz5::CIPI::CIPI(const CIPI& Other) -: CEntity(), - m_d(new CIPIPrivate) -{ - *this=Other; -} - -MusicBrainz5::CIPI& MusicBrainz5::CIPI::operator =(const CIPI& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_IPI=Other.m_d->m_IPI; - } - - return *this; -} - -MusicBrainz5::CIPI::~CIPI() -{ - delete m_d; -} - -MusicBrainz5::CIPI *MusicBrainz5::CIPI::Clone() -{ - return new CIPI(*this); -} - -void MusicBrainz5::CIPI::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised IPI attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CIPI::ParseElement(const XMLNode& Node) -{ - std::string Name=Node.getName(); - - std::cerr << "Unrecognised IPI element: '" << Name << "'" << std::endl; -} - -std::string MusicBrainz5::CIPI::GetElementName() -{ - return "ipi"; -} - -std::string MusicBrainz5::CIPI::IPI() const -{ - return m_d->m_IPI; -} - -std::ostream& MusicBrainz5::CIPI::Serialise(std::ostream& os) const -{ - os << "IPI:" << std::endl; - - CEntity::Serialise(os); - - os << "\tIPI: " << IPI() << std::endl; - - return os; -} - diff --git a/src/ISRC.cc b/src/ISRC.cc index 81509a2..bd63a76 100644 --- a/src/ISRC.cc +++ b/src/ISRC.cc @@ -103,9 +103,7 @@ void MusicBrainz5::CISRC::ParseAttribute(const std::string& Name, const std::str m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised isrc attribute: '" << Name << "'" << std::endl; -#endif } } @@ -119,9 +117,7 @@ void MusicBrainz5::CISRC::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised ISRC element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/ISRC.cc.silence-warnings b/src/ISRC.cc.silence-warnings deleted file mode 100644 index bd63a76..0000000 --- a/src/ISRC.cc.silence-warnings +++ /dev/null @@ -1,152 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/ISRC.h" - -#include "musicbrainz5/RecordingList.h" -#include "musicbrainz5/Recording.h" - -class MusicBrainz5::CISRCPrivate -{ - public: - CISRCPrivate() - : m_RecordingList(0) - { - } - - std::string m_ID; - CRecordingList *m_RecordingList; -}; - -MusicBrainz5::CISRC::CISRC(const XMLNode& Node) -: CEntity(), - m_d(new CISRCPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "ISRC node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CISRC::CISRC(const CISRC& Other) -: CEntity(), - m_d(new CISRCPrivate) -{ - *this=Other; -} - -MusicBrainz5::CISRC& MusicBrainz5::CISRC::operator =(const CISRC& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - - if (Other.m_d->m_RecordingList) - m_d->m_RecordingList=new CRecordingList(*Other.m_d->m_RecordingList); - } - - return *this; -} - -MusicBrainz5::CISRC::~CISRC() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CISRC::Cleanup() -{ - delete m_d->m_RecordingList; - m_d->m_RecordingList=0; -} - -MusicBrainz5::CISRC *MusicBrainz5::CISRC::Clone() -{ - return new CISRC(*this); -} - -void MusicBrainz5::CISRC::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised isrc attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CISRC::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("recording-list"==NodeName) - { - ProcessItem(Node,m_d->m_RecordingList); - } - else - { - std::cerr << "Unrecognised ISRC element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CISRC::GetElementName() -{ - return "isrc"; -} - -std::string MusicBrainz5::CISRC::ID() const -{ - return m_d->m_ID; -} - -MusicBrainz5::CRecordingList *MusicBrainz5::CISRC::RecordingList() const -{ - return m_d->m_RecordingList; -} - -std::ostream& MusicBrainz5::CISRC::Serialise(std::ostream& os) const -{ - os << "ISRC:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - - if (RecordingList()) - os << *RecordingList() << std::endl; - - return os; -} - diff --git a/src/ISWC.cc b/src/ISWC.cc index 1220d99..d8d75a4 100644 --- a/src/ISWC.cc +++ b/src/ISWC.cc @@ -92,20 +92,14 @@ MusicBrainz5::CISWC *MusicBrainz5::CISWC::Clone() void MusicBrainz5::CISWC::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised ISWC attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CISWC::ParseElement(const XMLNode& Node) { std::string NodeName=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised ISWC element: '" << NodeName << "'" << std::endl; -#endif } std::string MusicBrainz5::CISWC::GetElementName() diff --git a/src/ISWC.cc.silence-warnings b/src/ISWC.cc.silence-warnings deleted file mode 100644 index d8d75a4..0000000 --- a/src/ISWC.cc.silence-warnings +++ /dev/null @@ -1,124 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" - -#include "musicbrainz5/ISWC.h" - - -class MusicBrainz5::CISWCPrivate -{ - public: - CISWCPrivate() - { - } - - std::string m_ISWC; -}; - -MusicBrainz5::CISWC::CISWC(const XMLNode& Node) -: CEntity(), - m_d(new CISWCPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "ISWC node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - ProcessItem(Node,m_d->m_ISWC); - } -} - -MusicBrainz5::CISWC::CISWC(const CISWC& Other) -: CEntity(), - m_d(new CISWCPrivate) -{ - *this=Other; -} - -MusicBrainz5::CISWC& MusicBrainz5::CISWC::operator =(const CISWC& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ISWC=Other.m_d->m_ISWC; - } - - return *this; -} - -MusicBrainz5::CISWC::~CISWC() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CISWC::Cleanup() -{ -} - -MusicBrainz5::CISWC *MusicBrainz5::CISWC::Clone() -{ - return new CISWC(*this); -} - -void MusicBrainz5::CISWC::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised ISWC attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CISWC::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - std::cerr << "Unrecognised ISWC element: '" << NodeName << "'" << std::endl; -} - -std::string MusicBrainz5::CISWC::GetElementName() -{ - return "iswc"; -} - -std::string MusicBrainz5::CISWC::ISWC() const -{ - return m_d->m_ISWC; -} - -std::ostream& MusicBrainz5::CISWC::Serialise(std::ostream& os) const -{ - os << "ISWC:" << std::endl; - - CEntity::Serialise(os); - - os << "\tISWC: " << ISWC() << std::endl; - - return os; -} diff --git a/src/Label.cc b/src/Label.cc index 8007cdc..8add21c 100644 --- a/src/Label.cc +++ b/src/Label.cc @@ -197,9 +197,7 @@ void MusicBrainz5::CLabel::ParseAttribute(const std::string& Name, const std::st m_d->m_Type=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised label attribute: '" << Name << "'" << std::endl; -#endif } } @@ -269,9 +267,7 @@ void MusicBrainz5::CLabel::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised label element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Label.cc.silence-warnings b/src/Label.cc.silence-warnings deleted file mode 100644 index 8add21c..0000000 --- a/src/Label.cc.silence-warnings +++ /dev/null @@ -1,403 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Label.h" - -#include - -#include "musicbrainz5/Lifespan.h" -#include "musicbrainz5/IPI.h" -#include "musicbrainz5/Rating.h" -#include "musicbrainz5/UserRating.h" -#include "musicbrainz5/Alias.h" -#include "musicbrainz5/AliasList.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/Relation.h" -#include "musicbrainz5/RelationList.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/Tag.h" -#include "musicbrainz5/TagList.h" -#include "musicbrainz5/UserTag.h" -#include "musicbrainz5/UserTagList.h" - -class MusicBrainz5::CLabelPrivate -{ - public: - CLabelPrivate() - : m_LabelCode(0), - m_IPIList(0), - m_Lifespan(0), - m_AliasList(0), - m_ReleaseList(0), - m_RelationListList(0), - m_TagList(0), - m_UserTagList(0), - m_Rating(0), - m_UserRating(0) - { - } - - std::string m_ID; - std::string m_Type; - std::string m_Name; - std::string m_SortName; - int m_LabelCode; - CIPIList *m_IPIList; - std::string m_Disambiguation; - std::string m_Country; - CLifespan *m_Lifespan; - CAliasList *m_AliasList; - CReleaseList *m_ReleaseList; - CRelationListList *m_RelationListList; - CTagList *m_TagList; - CUserTagList *m_UserTagList; - CRating *m_Rating; - CUserRating *m_UserRating; -}; -MusicBrainz5::CLabel::CLabel(const XMLNode& Node) -: CEntity(), - m_d(new CLabelPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Label node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CLabel::CLabel(const CLabel& Other) -: CEntity(), - m_d(new CLabelPrivate) -{ - *this=Other; -} - -MusicBrainz5::CLabel& MusicBrainz5::CLabel::operator =(const CLabel& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Type=Other.m_d->m_Type; - m_d->m_Name=Other.m_d->m_Name; - m_d->m_SortName=Other.m_d->m_SortName; - m_d->m_LabelCode=Other.m_d->m_LabelCode; - - if (Other.m_d->m_IPIList) - m_d->m_IPIList=new CIPIList(*Other.m_d->m_IPIList); - - m_d->m_Disambiguation=Other.m_d->m_Disambiguation; - m_d->m_Country=Other.m_d->m_Country; - - if (Other.m_d->m_Lifespan) - m_d->m_Lifespan=new CLifespan(*Other.m_d->m_Lifespan); - - if (Other.m_d->m_AliasList) - m_d->m_AliasList=new CAliasList(*Other.m_d->m_AliasList); - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - - if (Other.m_d->m_RelationListList) - m_d->m_RelationListList=new CRelationListList(*Other.m_d->m_RelationListList); - - if (Other.m_d->m_TagList) - m_d->m_TagList=new CTagList(*Other.m_d->m_TagList); - - if (Other.m_d->m_UserTagList) - m_d->m_UserTagList=new CUserTagList(*Other.m_d->m_UserTagList); - - if (Other.m_d->m_Rating) - m_d->m_Rating=new CRating(*Other.m_d->m_Rating); - - if (Other.m_d->m_UserRating) - m_d->m_UserRating=new CUserRating(*Other.m_d->m_UserRating); - } - - return *this; -} - -MusicBrainz5::CLabel::~CLabel() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CLabel::Cleanup() -{ - delete m_d->m_IPIList; - m_d->m_IPIList=0; - - delete m_d->m_Lifespan; - m_d->m_Lifespan=0; - - delete m_d->m_AliasList; - m_d->m_AliasList=0; - - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; - - delete m_d->m_RelationListList; - m_d->m_RelationListList=0; - - delete m_d->m_TagList; - m_d->m_TagList=0; - - delete m_d->m_UserTagList; - m_d->m_UserTagList=0; - - delete m_d->m_Rating; - m_d->m_Rating=0; - - delete m_d->m_UserRating; - m_d->m_UserRating=0; -} - -MusicBrainz5::CLabel *MusicBrainz5::CLabel::Clone() -{ - return new CLabel(*this); -} - -void MusicBrainz5::CLabel::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else if ("type"==Name) - m_d->m_Type=Value; - else - { - std::cerr << "Unrecognised label attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CLabel::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else if ("sort-name"==NodeName) - { - ProcessItem(Node,m_d->m_SortName); - } - else if ("label-code"==NodeName) - { - ProcessItem(Node,m_d->m_LabelCode); - } - else if ("ipi"==NodeName) - { - //Ignore IPI - } - else if ("ipi-list"==NodeName) - { - ProcessItem(Node,m_d->m_IPIList); - } - else if ("disambiguation"==NodeName) - { - ProcessItem(Node,m_d->m_Disambiguation); - } - else if ("country"==NodeName) - { - ProcessItem(Node,m_d->m_Country); - } - else if ("life-span"==NodeName) - { - ProcessItem(Node,m_d->m_Lifespan); - } - else if ("alias-list"==NodeName) - { - ProcessItem(Node,m_d->m_AliasList); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else if ("relation-list"==NodeName) - { - ProcessRelationList(Node,m_d->m_RelationListList); - } - else if ("tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_TagList); - } - else if ("user-tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_UserTagList); - } - else if ("rating"==NodeName) - { - ProcessItem(Node,m_d->m_Rating); - } - else if ("user-rating"==NodeName) - { - ProcessItem(Node,m_d->m_UserRating); - } - else - { - std::cerr << "Unrecognised label element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CLabel::GetElementName() -{ - return "label"; -} - -std::string MusicBrainz5::CLabel::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CLabel::Type() const -{ - return m_d->m_Type; -} - -std::string MusicBrainz5::CLabel::Name() const -{ - return m_d->m_Name; -} - -std::string MusicBrainz5::CLabel::SortName() const -{ - return m_d->m_SortName; -} - -int MusicBrainz5::CLabel::LabelCode() const -{ - return m_d->m_LabelCode; -} - -MusicBrainz5::CIPIList *MusicBrainz5::CLabel::IPIList() const -{ - return m_d->m_IPIList; -} - -std::string MusicBrainz5::CLabel::Disambiguation() const -{ - return m_d->m_Disambiguation; -} - -std::string MusicBrainz5::CLabel::Country() const -{ - return m_d->m_Country; -} - -MusicBrainz5::CLifespan *MusicBrainz5::CLabel::Lifespan() const -{ - return m_d->m_Lifespan; -} - -MusicBrainz5::CAliasList *MusicBrainz5::CLabel::AliasList() const -{ - return m_d->m_AliasList; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CLabel::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -MusicBrainz5::CRelationListList *MusicBrainz5::CLabel::RelationListList() const -{ - return m_d->m_RelationListList; -} - -MusicBrainz5::CTagList *MusicBrainz5::CLabel::TagList() const -{ - return m_d->m_TagList; -} - -MusicBrainz5::CUserTagList *MusicBrainz5::CLabel::UserTagList() const -{ - return m_d->m_UserTagList; -} - -MusicBrainz5::CRating *MusicBrainz5::CLabel::Rating() const -{ - return m_d->m_Rating; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CLabel::UserRating() const -{ - return m_d->m_UserRating; -} - -std::ostream& MusicBrainz5::CLabel::Serialise(std::ostream& os) const -{ - os << "Label:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tType: " << Type() << std::endl; - os << "\tName: " << Name() << std::endl; - os << "\tSort name: " << SortName() << std::endl; - os << "\tLabel code: " << LabelCode() << std::endl; - - if (IPIList()) - os << *IPIList() << std::endl; - - os << "\tDisambiguation: " << Disambiguation() << std::endl; - os << "\tCountry: " << Country() << std::endl; - - if (Lifespan()) - os << *Lifespan() << std::endl; - - if (AliasList()) - os << *AliasList() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - if (RelationListList()) - os << *RelationListList() << std::endl; - - if (TagList()) - os << *TagList() << std::endl; - - if (UserTagList()) - os << *UserTagList() << std::endl; - - if (Rating()) - os << *Rating() << std::endl; - - if (UserRating()) - os << *UserRating() << std::endl; - - return os; -} - diff --git a/src/LabelInfo.cc b/src/LabelInfo.cc index 6c07bbc..ad04652 100644 --- a/src/LabelInfo.cc +++ b/src/LabelInfo.cc @@ -98,11 +98,7 @@ MusicBrainz5::CLabelInfo *MusicBrainz5::CLabelInfo::Clone() void MusicBrainz5::CLabelInfo::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised labelinfo attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CLabelInfo::ParseElement(const XMLNode& Node) @@ -119,9 +115,7 @@ void MusicBrainz5::CLabelInfo::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised label info element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/LabelInfo.cc.silence-warnings b/src/LabelInfo.cc.silence-warnings deleted file mode 100644 index ad04652..0000000 --- a/src/LabelInfo.cc.silence-warnings +++ /dev/null @@ -1,150 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/LabelInfo.h" - -#include "musicbrainz5/Label.h" - -class MusicBrainz5::CLabelInfoPrivate -{ - public: - CLabelInfoPrivate() - : m_Label(0) - { - } - - std::string m_CatalogNumber; - CLabel *m_Label; -}; - -MusicBrainz5::CLabelInfo::CLabelInfo(const XMLNode& Node) -: CEntity(), - m_d(new CLabelInfoPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Label info node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CLabelInfo::CLabelInfo(const CLabelInfo& Other) -: CEntity(), - m_d(new CLabelInfoPrivate) -{ - *this=Other; -} - -MusicBrainz5::CLabelInfo& MusicBrainz5::CLabelInfo::operator =(const CLabelInfo& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_CatalogNumber=Other.m_d->m_CatalogNumber; - - if (Other.m_d->m_Label) - m_d->m_Label=new CLabel(*Other.m_d->m_Label); - } - - return *this; -} - -MusicBrainz5::CLabelInfo::~CLabelInfo() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CLabelInfo::Cleanup() -{ - delete m_d->m_Label; - m_d->m_Label=0; -} - -MusicBrainz5::CLabelInfo *MusicBrainz5::CLabelInfo::Clone() -{ - return new CLabelInfo(*this); -} - -void MusicBrainz5::CLabelInfo::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised labelinfo attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CLabelInfo::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("catalog-number"==NodeName) - { - ProcessItem(Node,m_d->m_CatalogNumber); - } - else if ("label"==NodeName) - { - ProcessItem(Node,m_d->m_Label); - } - else - { - std::cerr << "Unrecognised label info element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CLabelInfo::GetElementName() -{ - return "label-info"; -} - -std::string MusicBrainz5::CLabelInfo::CatalogNumber() const -{ - return m_d->m_CatalogNumber; -} - -MusicBrainz5::CLabel *MusicBrainz5::CLabelInfo::Label() const -{ - return m_d->m_Label; -} - -std::ostream& MusicBrainz5::CLabelInfo::Serialise(std::ostream& os) const -{ - os << "Label info:" << std::endl; - - CEntity::Serialise(os); - - os << "\tCatalog number: " << CatalogNumber() << std::endl; - - if (Label()) - os << *Label() << std::endl; - - return os; -} - diff --git a/src/Lifespan.cc b/src/Lifespan.cc index a97aa8b..35b49d1 100644 --- a/src/Lifespan.cc +++ b/src/Lifespan.cc @@ -81,11 +81,7 @@ MusicBrainz5::CLifespan *MusicBrainz5::CLifespan::Clone() void MusicBrainz5::CLifespan::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised lifespan attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CLifespan::ParseElement(const XMLNode& Node) @@ -106,9 +102,7 @@ void MusicBrainz5::CLifespan::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised lifespan element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Lifespan.cc.silence-warnings b/src/Lifespan.cc.silence-warnings deleted file mode 100644 index 35b49d1..0000000 --- a/src/Lifespan.cc.silence-warnings +++ /dev/null @@ -1,140 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Lifespan.h" - -class MusicBrainz5::CLifespanPrivate -{ - public: - std::string m_Begin; - std::string m_End; - std::string m_Ended; -}; - -MusicBrainz5::CLifespan::CLifespan(const XMLNode& Node) -: CEntity(), - m_d(new CLifespanPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Lifespan node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CLifespan::CLifespan(const CLifespan& Other) -: CEntity(), - m_d(new CLifespanPrivate) -{ - *this=Other; -} - -MusicBrainz5::CLifespan& MusicBrainz5::CLifespan::operator =(const CLifespan& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Begin=Other.m_d->m_Begin; - m_d->m_End=Other.m_d->m_End; - m_d->m_Ended=Other.m_d->m_Ended; - } - - return *this; -} - -MusicBrainz5::CLifespan::~CLifespan() -{ - delete m_d; -} - -MusicBrainz5::CLifespan *MusicBrainz5::CLifespan::Clone() -{ - return new CLifespan(*this); -} - -void MusicBrainz5::CLifespan::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised lifespan attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CLifespan::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("begin"==NodeName) - { - ProcessItem(Node,m_d->m_Begin); - } - else if ("end"==NodeName) - { - ProcessItem(Node,m_d->m_End); - } - else if ("ended"==NodeName) - { - ProcessItem(Node,m_d->m_Ended); - } - else - { - std::cerr << "Unrecognised lifespan element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CLifespan::GetElementName() -{ - return "life-span"; -} - -std::string MusicBrainz5::CLifespan::Begin() const -{ - return m_d->m_Begin; -} - -std::string MusicBrainz5::CLifespan::End() const -{ - return m_d->m_End; -} - -std::string MusicBrainz5::CLifespan::Ended() const -{ - return m_d->m_Ended; -} - -std::ostream& MusicBrainz5::CLifespan::Serialise(std::ostream& os) const -{ - os << "Lifespan:" << std::endl; - - CEntity::Serialise(os); - - os << "\tBegin: " << Begin() << std::endl; - os << "\tEnd: " << End() << std::endl; - os << "\tEnded: " << Ended() << std::endl; - - return os; -} diff --git a/src/List.cc b/src/List.cc index 3bf1982..6a8a47c 100644 --- a/src/List.cc +++ b/src/List.cc @@ -109,9 +109,7 @@ void MusicBrainz5::CList::ParseAttribute(const std::string& Name, const std::str ProcessItem(Value,m_d->m_Count); else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised list attribute: '" << Name << "'" << std::endl; -#endif } } @@ -119,9 +117,7 @@ void MusicBrainz5::CList::ParseElement(const XMLNode& Node) { std::string NodeName=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised list element: '" << NodeName << "'" << std::endl; -#endif } std::string MusicBrainz5::CList::GetElementName() diff --git a/src/List.cc.silence-warnings b/src/List.cc.silence-warnings deleted file mode 100644 index 6a8a47c..0000000 --- a/src/List.cc.silence-warnings +++ /dev/null @@ -1,166 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/List.h" - -#include - -class MusicBrainz5::CListPrivate -{ -public: - CListPrivate() - : m_Offset(0), - m_Count(0) - { - } - - int m_Offset; - int m_Count; - std::vector m_Items; -}; - -MusicBrainz5::CList::CList() -: CEntity(), - m_d(new CListPrivate) -{ -} - -MusicBrainz5::CList::CList(const CList& Other) -: CEntity(), - m_d(new CListPrivate) -{ - *this=Other; -} - -MusicBrainz5::CList& MusicBrainz5::CList::operator =(const CList& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_Offset=Other.m_d->m_Offset; - m_d->m_Count=Other.m_d->m_Count; - - std::vector::const_iterator ThisItem=Other.m_d->m_Items.begin(); - while (ThisItem!=Other.m_d->m_Items.end()) - { - CEntity *Item=(*ThisItem); - m_d->m_Items.push_back(Item->Clone()); - ++ThisItem; - } - } - - return *this; -} - -MusicBrainz5::CList::~CList() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CList::Cleanup() -{ - while (!m_d->m_Items.empty()) - { - delete m_d->m_Items.back(); - m_d->m_Items.pop_back(); - } -} - -MusicBrainz5::CList *MusicBrainz5::CList::Clone() -{ - return new CList(*this); -} - -void MusicBrainz5::CList::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("offset"==Name) - ProcessItem(Value,m_d->m_Offset); - else if ("count"==Name) - ProcessItem(Value,m_d->m_Count); - else - { - std::cerr << "Unrecognised list attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CList::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - std::cerr << "Unrecognised list element: '" << NodeName << "'" << std::endl; -} - -std::string MusicBrainz5::CList::GetElementName() -{ - return ""; -} - -void MusicBrainz5::CList::AddItem(CEntity *Item) -{ - m_d->m_Items.push_back(Item); -} - -int MusicBrainz5::CList::NumItems() const -{ - return m_d->m_Items.size(); -} - -MusicBrainz5::CEntity *MusicBrainz5::CList::Item(int Item) const -{ - CEntity *Ret=0; - - if (Itemm_Items[Item]; - - return Ret; -} - -int MusicBrainz5::CList::Offset() const -{ - return m_d->m_Offset; -} - -int MusicBrainz5::CList::Count() const -{ - return m_d->m_Count; -} - -std::ostream& MusicBrainz5::CList::Serialise(std::ostream& os) const -{ - os << "List: " << std::endl; - os << "Offset: " << Offset() << std::endl; - os << "Count: " << Count() << std::endl; - - return os; -} - diff --git a/src/Medium.cc b/src/Medium.cc index e9495e3..03e27da 100644 --- a/src/Medium.cc +++ b/src/Medium.cc @@ -114,11 +114,7 @@ MusicBrainz5::CMedium *MusicBrainz5::CMedium::Clone() void MusicBrainz5::CMedium::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised medium attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CMedium::ParseElement(const XMLNode& Node) @@ -147,9 +143,7 @@ void MusicBrainz5::CMedium::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised medium element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Medium.cc.silence-warnings b/src/Medium.cc.silence-warnings deleted file mode 100644 index 03e27da..0000000 --- a/src/Medium.cc.silence-warnings +++ /dev/null @@ -1,215 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Medium.h" - -#include "musicbrainz5/Disc.h" -#include "musicbrainz5/DiscList.h" -#include "musicbrainz5/Track.h" -#include "musicbrainz5/TrackList.h" - -class MusicBrainz5::CMediumPrivate -{ - public: - CMediumPrivate() - : m_Position(0), - m_DiscList(0), - m_TrackList(0) - { - } - - std::string m_Title; - int m_Position; - std::string m_Format; - CDiscList *m_DiscList; - CTrackList *m_TrackList; -}; - -MusicBrainz5::CMedium::CMedium(const XMLNode& Node) -: CEntity(), - m_d(new CMediumPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Medium node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CMedium::CMedium(const CMedium& Other) -: CEntity(), - m_d(new CMediumPrivate) -{ - *this=Other; -} - -MusicBrainz5::CMedium& MusicBrainz5::CMedium::operator =(const CMedium& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Position=Other.m_d->m_Position; - m_d->m_Format=Other.m_d->m_Format; - - if (Other.m_d->m_DiscList) - m_d->m_DiscList=new CDiscList(*Other.m_d->m_DiscList); - - if (Other.m_d->m_TrackList) - m_d->m_TrackList=new CTrackList(*Other.m_d->m_TrackList); - } - - return *this; -} - -MusicBrainz5::CMedium::~CMedium() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CMedium::Cleanup() -{ - delete m_d->m_DiscList; - m_d->m_DiscList=0; - - delete m_d->m_TrackList; - m_d->m_TrackList=0; -} - -MusicBrainz5::CMedium *MusicBrainz5::CMedium::Clone() -{ - return new CMedium(*this); -} - -void MusicBrainz5::CMedium::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised medium attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CMedium::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("position"==NodeName) - { - ProcessItem(Node,m_d->m_Position); - } - else if ("format"==NodeName) - { - ProcessItem(Node,m_d->m_Format); - } - else if ("disc-list"==NodeName) - { - ProcessItem(Node,m_d->m_DiscList); - } - else if ("track-list"==NodeName) - { - ProcessItem(Node,m_d->m_TrackList); - } - else - { - std::cerr << "Unrecognised medium element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CMedium::GetElementName() -{ - return "medium"; -} - -std::string MusicBrainz5::CMedium::Title() const -{ - return m_d->m_Title; -} - -int MusicBrainz5::CMedium::Position() const -{ - return m_d->m_Position; -} - -std::string MusicBrainz5::CMedium::Format() const -{ - return m_d->m_Format; -} - -MusicBrainz5::CDiscList *MusicBrainz5::CMedium::DiscList() const -{ - return m_d->m_DiscList; -} - -MusicBrainz5::CTrackList *MusicBrainz5::CMedium::TrackList() const -{ - return m_d->m_TrackList; -} - -bool MusicBrainz5::CMedium::ContainsDiscID(const std::string& DiscID) const -{ - bool RetVal=false; - - if (m_d->m_DiscList) - { - for (int count=0;!RetVal && countm_DiscList->NumItems();count++) - { - CDisc *Disc=m_d->m_DiscList->Item(count); - - if (Disc->ID()==DiscID) - RetVal=true; - } - } - - return RetVal; -} - -std::ostream& MusicBrainz5::CMedium::Serialise(std::ostream& os) const -{ - os << "Medium:" << std::endl; - - CEntity::Serialise(os); - - os << "\tTitle: " << Title() << std::endl; - os << "\tPosition: " << Position() << std::endl; - os << "\tFormat: " << Format() << std::endl; - - if (DiscList()) - os << *DiscList() << std::endl; - - if (TrackList()) - os << *TrackList() << std::endl; - - return os; -} diff --git a/src/Message.cc b/src/Message.cc index cc283e0..63e034b 100644 --- a/src/Message.cc +++ b/src/Message.cc @@ -77,11 +77,7 @@ MusicBrainz5::CMessage *MusicBrainz5::CMessage::Clone() void MusicBrainz5::CMessage::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised message attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CMessage::ParseElement(const XMLNode& Node) @@ -92,9 +88,7 @@ void MusicBrainz5::CMessage::ParseElement(const XMLNode& Node) ProcessItem(Node,m_d->m_Text); else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised message element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Message.cc.silence-warnings b/src/Message.cc.silence-warnings deleted file mode 100644 index 63e034b..0000000 --- a/src/Message.cc.silence-warnings +++ /dev/null @@ -1,114 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Message.h" - -class MusicBrainz5::CMessagePrivate -{ -public: - std::string m_Text; -}; - -MusicBrainz5::CMessage::CMessage(const XMLNode& Node) -: CEntity(), - m_d(new CMessagePrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Message node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CMessage::CMessage(const CMessage& Other) -: CEntity(), - m_d(new CMessagePrivate) -{ - *this=Other; -} - -MusicBrainz5::CMessage& MusicBrainz5::CMessage::operator =(const CMessage& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Text=Other.m_d->m_Text; - } - - return *this; -} - -MusicBrainz5::CMessage::~CMessage() -{ - delete m_d; -} - -MusicBrainz5::CMessage *MusicBrainz5::CMessage::Clone() -{ - return new CMessage(*this); -} - -void MusicBrainz5::CMessage::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised message attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CMessage::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if (NodeName=="text") - ProcessItem(Node,m_d->m_Text); - else - { - std::cerr << "Unrecognised message element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CMessage::GetElementName() -{ - return "message"; -} - -std::string MusicBrainz5::CMessage::Text() const -{ - return m_d->m_Text; -} - -std::ostream& MusicBrainz5::CMessage::Serialise(std::ostream& os) const -{ - os << "Message:" << std::endl; - - CEntity::Serialise(os); - - os << "\tText: " << Text() << std::endl; - - return os; -} diff --git a/src/Metadata.cc b/src/Metadata.cc index 66d76cc..57b4732 100644 --- a/src/Metadata.cc +++ b/src/Metadata.cc @@ -362,9 +362,7 @@ void MusicBrainz5::CMetadata::ParseAttribute(const std::string& Name, const std: m_d->m_Created=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised metadata attribute: '" << Name << "'" << std::endl; -#endif } } @@ -482,9 +480,7 @@ void MusicBrainz5::CMetadata::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised metadata element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Metadata.cc.silence-warnings b/src/Metadata.cc.silence-warnings deleted file mode 100644 index 57b4732..0000000 --- a/src/Metadata.cc.silence-warnings +++ /dev/null @@ -1,746 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Metadata.h" - -#include "musicbrainz5/Artist.h" -#include "musicbrainz5/ArtistList.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/ReleaseGroup.h" -#include "musicbrainz5/ReleaseGroupList.h" -#include "musicbrainz5/Recording.h" -#include "musicbrainz5/RecordingList.h" -#include "musicbrainz5/Label.h" -#include "musicbrainz5/LabelList.h" -#include "musicbrainz5/Work.h" -#include "musicbrainz5/WorkList.h" -#include "musicbrainz5/PUID.h" -#include "musicbrainz5/ISRC.h" -#include "musicbrainz5/ISRCList.h" -#include "musicbrainz5/Disc.h" -#include "musicbrainz5/Rating.h" -#include "musicbrainz5/UserRating.h" -#include "musicbrainz5/Collection.h" -#include "musicbrainz5/CollectionList.h" -#include "musicbrainz5/Annotation.h" -#include "musicbrainz5/AnnotationList.h" -#include "musicbrainz5/CDStub.h" -#include "musicbrainz5/CDStubList.h" -#include "musicbrainz5/FreeDBDisc.h" -#include "musicbrainz5/FreeDBDiscList.h" -#include "musicbrainz5/Tag.h" -#include "musicbrainz5/TagList.h" -#include "musicbrainz5/UserTag.h" -#include "musicbrainz5/UserTagList.h" -#include "musicbrainz5/LabelInfo.h" -#include "musicbrainz5/LabelInfoList.h" -#include "musicbrainz5/Message.h" - -class MusicBrainz5::CMetadataPrivate -{ - public: - CMetadataPrivate() - : m_Artist(0), - m_Release(0), - m_ReleaseGroup(0), - m_Recording(0), - m_Label(0), - m_Work(0), - m_PUID(0), - m_ISRC(0), - m_Disc(0), - m_LabelInfoList(0), - m_Rating(0), - m_UserRating(0), - m_Collection(0), - m_ArtistList(0), - m_ReleaseList(0), - m_ReleaseGroupList(0), - m_RecordingList(0), - m_LabelList(0), - m_WorkList(0), - m_ISRCList(0), - m_AnnotationList(0), - m_CDStubList(0), - m_FreeDBDiscList(0), - m_TagList(0), - m_UserTagList(0), - m_CollectionList(0), - m_CDStub(0), - m_Message(0) - { - } - - std::string m_XMLNS; - std::string m_XMLNSExt; - std::string m_Generator; - std::string m_Created; - CArtist *m_Artist; - CRelease *m_Release; - CReleaseGroup *m_ReleaseGroup; - CRecording *m_Recording; - CLabel *m_Label; - CWork *m_Work; - CPUID *m_PUID; - CISRC *m_ISRC; - CDisc *m_Disc; - CLabelInfoList *m_LabelInfoList; - CRating *m_Rating; - CUserRating *m_UserRating; - CCollection *m_Collection; - CArtistList *m_ArtistList; - CReleaseList *m_ReleaseList; - CReleaseGroupList *m_ReleaseGroupList; - CRecordingList *m_RecordingList; - CLabelList *m_LabelList; - CWorkList *m_WorkList; - CISRCList *m_ISRCList; - CAnnotationList *m_AnnotationList; - CCDStubList *m_CDStubList; - CFreeDBDiscList *m_FreeDBDiscList; - CTagList *m_TagList; - CUserTagList *m_UserTagList; - CCollectionList *m_CollectionList; - CCDStub *m_CDStub; - CMessage *m_Message; -}; - -MusicBrainz5::CMetadata::CMetadata(const XMLNode& Node) -: CEntity(), - m_d(new CMetadataPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Metadata node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CMetadata::CMetadata(const CMetadata& Other) -: CEntity(), - m_d(new CMetadataPrivate) -{ - *this=Other; -} - -MusicBrainz5::CMetadata& MusicBrainz5::CMetadata::operator =(const CMetadata& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_XMLNS=Other.m_d->m_XMLNS; - m_d->m_XMLNSExt=Other.m_d->m_XMLNSExt; - m_d->m_Generator=Other.m_d->m_Generator; - m_d->m_Created=Other.m_d->m_Created; - - if (Other.m_d->m_Artist) - m_d->m_Artist=new CArtist(*Other.m_d->m_Artist); - - if (Other.m_d->m_Release) - m_d->m_Release=new CRelease(*Other.m_d->m_Release); - - if (Other.m_d->m_ReleaseGroup) - m_d->m_ReleaseGroup=new CReleaseGroup(*Other.m_d->m_ReleaseGroup); - - if (Other.m_d->m_Recording) - m_d->m_Recording=new CRecording(*Other.m_d->m_Recording); - - if (Other.m_d->m_Label) - m_d->m_Label=new CLabel(*Other.m_d->m_Label); - - if (Other.m_d->m_Work) - m_d->m_Work=new CWork(*Other.m_d->m_Work); - - if (Other.m_d->m_PUID) - m_d->m_PUID=new CPUID(*Other.m_d->m_PUID); - - if (Other.m_d->m_ISRC) - m_d->m_ISRC=new CISRC(*Other.m_d->m_ISRC); - - if (Other.m_d->m_Disc) - m_d->m_Disc=new CDisc(*Other.m_d->m_Disc); - - if (Other.m_d->m_LabelInfoList) - m_d->m_LabelInfoList=new CLabelInfoList(*Other.m_d->m_LabelInfoList); - - if (Other.m_d->m_Rating) - m_d->m_Rating=new CRating(*Other.m_d->m_Rating); - - if (Other.m_d->m_UserRating) - m_d->m_UserRating=new CUserRating(*Other.m_d->m_UserRating); - - if (Other.m_d->m_Collection) - m_d->m_Collection=new CCollection(*Other.m_d->m_Collection); - - if (Other.m_d->m_ArtistList) - m_d->m_ArtistList=new CArtistList(*Other.m_d->m_ArtistList); - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - - if (Other.m_d->m_ReleaseGroupList) - m_d->m_ReleaseGroupList=new CReleaseGroupList(*Other.m_d->m_ReleaseGroupList); - - if (Other.m_d->m_RecordingList) - m_d->m_RecordingList=new CRecordingList(*Other.m_d->m_RecordingList); - - if (Other.m_d->m_LabelList) - m_d->m_LabelList=new CLabelList(*Other.m_d->m_LabelList); - - if (Other.m_d->m_WorkList) - m_d->m_WorkList=new CWorkList(*Other.m_d->m_WorkList); - - if (Other.m_d->m_ISRCList) - m_d->m_ISRCList=new CISRCList(*Other.m_d->m_ISRCList); - - if (Other.m_d->m_AnnotationList) - m_d->m_AnnotationList=new CAnnotationList(*Other.m_d->m_AnnotationList); - - if (Other.m_d->m_CDStubList) - m_d->m_CDStubList=new CCDStubList(*Other.m_d->m_CDStubList); - - if (Other.m_d->m_FreeDBDiscList) - m_d->m_FreeDBDiscList=new CFreeDBDiscList(*Other.m_d->m_FreeDBDiscList); - - if (Other.m_d->m_TagList) - m_d->m_TagList=new CTagList(*Other.m_d->m_TagList); - - if (Other.m_d->m_UserTagList) - m_d->m_UserTagList=new CUserTagList(*Other.m_d->m_UserTagList); - - if (Other.m_d->m_CollectionList) - m_d->m_CollectionList=new CCollectionList(*Other.m_d->m_CollectionList); - - if (Other.m_d->m_CDStub) - m_d->m_CDStub=new CCDStub(*Other.m_d->m_CDStub); - - if (Other.m_d->m_Message) - m_d->m_Message=new CMessage(*Other.m_d->m_Message); - } - - return *this; -} - -MusicBrainz5::CMetadata::~CMetadata() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CMetadata::Cleanup() -{ - delete m_d->m_Artist; - m_d->m_Artist=0; - - delete m_d->m_Release; - m_d->m_Release=0; - - delete m_d->m_ReleaseGroup; - m_d->m_ReleaseGroup=0; - - delete m_d->m_Recording; - m_d->m_Recording=0; - - delete m_d->m_Label; - m_d->m_Label=0; - - delete m_d->m_Work; - m_d->m_Work=0; - - delete m_d->m_PUID; - m_d->m_PUID=0; - - delete m_d->m_ISRC; - m_d->m_ISRC=0; - - delete m_d->m_Disc; - m_d->m_Disc=0; - - delete m_d->m_LabelInfoList; - m_d->m_LabelInfoList=0; - - delete m_d->m_Rating; - m_d->m_Rating=0; - - delete m_d->m_UserRating; - m_d->m_UserRating=0; - - delete m_d->m_Collection; - m_d->m_Collection=0; - - delete m_d->m_ArtistList; - m_d->m_ArtistList=0; - - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; - - delete m_d->m_ReleaseGroupList; - m_d->m_ReleaseGroupList=0; - - delete m_d->m_RecordingList; - m_d->m_RecordingList=0; - - delete m_d->m_LabelList; - m_d->m_LabelList=0; - - delete m_d->m_WorkList; - m_d->m_WorkList=0; - - delete m_d->m_ISRCList; - m_d->m_ISRCList=0; - - delete m_d->m_AnnotationList; - m_d->m_AnnotationList=0; - - delete m_d->m_CDStubList; - m_d->m_CDStubList=0; - - delete m_d->m_FreeDBDiscList; - m_d->m_FreeDBDiscList=0; - - delete m_d->m_TagList; - m_d->m_TagList=0; - - delete m_d->m_UserTagList; - m_d->m_UserTagList=0; - - delete m_d->m_CollectionList; - m_d->m_CollectionList=0; - - delete m_d->m_CDStub; - m_d->m_CDStub=0; - - delete m_d->m_Message; - m_d->m_Message=0; -} - -MusicBrainz5::CMetadata *MusicBrainz5::CMetadata::Clone() -{ - return new CMetadata(*this); -} - -void MusicBrainz5::CMetadata::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("xmlns"==Name) - m_d->m_XMLNS=Value; - else if ("xmlns:ext"==Name) - m_d->m_XMLNSExt=Value; - else if ("generator"==Name) - m_d->m_Generator=Value; - else if ("created"==Name) - m_d->m_Created=Value; - else - { - std::cerr << "Unrecognised metadata attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CMetadata::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("artist"==NodeName) - { - ProcessItem(Node,m_d->m_Artist); - } - else if ("release"==NodeName) - { - ProcessItem(Node,m_d->m_Release); - } - else if ("release-group"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseGroup); - } - else if ("recording"==NodeName) - { - ProcessItem(Node,m_d->m_Recording); - } - else if ("label"==NodeName) - { - ProcessItem(Node,m_d->m_Label); - } - else if ("work"==NodeName) - { - ProcessItem(Node,m_d->m_Work); - } - else if ("puid"==NodeName) - { - ProcessItem(Node,m_d->m_PUID); - } - else if ("isrc"==NodeName) - { - ProcessItem(Node,m_d->m_ISRC); - } - else if ("disc"==NodeName) - { - ProcessItem(Node,m_d->m_Disc); - } - else if ("rating"==NodeName) - { - ProcessItem(Node,m_d->m_Rating); - } - else if ("user-rating"==NodeName) - { - ProcessItem(Node,m_d->m_UserRating); - } - else if ("collection"==NodeName) - { - ProcessItem(Node,m_d->m_Collection); - } - else if ("artist-list"==NodeName) - { - ProcessItem(Node,m_d->m_ArtistList); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else if ("release-group-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseGroupList); - } - else if ("recording-list"==NodeName) - { - ProcessItem(Node,m_d->m_RecordingList); - } - else if ("label-list"==NodeName) - { - ProcessItem(Node,m_d->m_LabelList); - } - else if ("work-list"==NodeName) - { - ProcessItem(Node,m_d->m_WorkList); - } - else if ("isrc-list"==NodeName) - { - ProcessItem(Node,m_d->m_ISRCList); - } - else if ("annotation-list"==NodeName) - { - ProcessItem(Node,m_d->m_AnnotationList); - } - else if ("cdstub-list"==NodeName) - { - ProcessItem(Node,m_d->m_CDStubList); - } - else if ("freedb-disc-list"==NodeName) - { - ProcessItem(Node,m_d->m_FreeDBDiscList); - } - else if ("tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_TagList); - } - else if ("user-tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_UserTagList); - } - else if ("collection-list"==NodeName) - { - ProcessItem(Node,m_d->m_CollectionList); - } - else if ("cdstub"==NodeName) - { - ProcessItem(Node,m_d->m_CDStub); - } - else if ("message"==NodeName) - { - ProcessItem(Node,m_d->m_Message); - } - else - { - std::cerr << "Unrecognised metadata element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CMetadata::GetElementName() -{ - return "metadata"; -} - -std::string MusicBrainz5::CMetadata::XMLNS() const -{ - return m_d->m_XMLNS; -} - -std::string MusicBrainz5::CMetadata::XMLNSExt() const -{ - return m_d->m_XMLNSExt; -} - -std::string MusicBrainz5::CMetadata::Generator() const -{ - return m_d->m_Generator; -} - -std::string MusicBrainz5::CMetadata::Created() const -{ - return m_d->m_Created; -} - -MusicBrainz5::CArtist *MusicBrainz5::CMetadata::Artist() const -{ - return m_d->m_Artist; -} - -MusicBrainz5::CRelease *MusicBrainz5::CMetadata::Release() const -{ - return m_d->m_Release; -} - -MusicBrainz5::CReleaseGroup *MusicBrainz5::CMetadata::ReleaseGroup() const -{ - return m_d->m_ReleaseGroup; -} - -MusicBrainz5::CRecording *MusicBrainz5::CMetadata::Recording() const -{ - return m_d->m_Recording; -} - -MusicBrainz5::CLabel *MusicBrainz5::CMetadata::Label() const -{ - return m_d->m_Label; -} - -MusicBrainz5::CWork *MusicBrainz5::CMetadata::Work() const -{ - return m_d->m_Work; -} - -MusicBrainz5::CPUID *MusicBrainz5::CMetadata::PUID() const -{ - return m_d->m_PUID; -} - -MusicBrainz5::CISRC *MusicBrainz5::CMetadata::ISRC() const -{ - return m_d->m_ISRC; -} - -MusicBrainz5::CDisc *MusicBrainz5::CMetadata::Disc() const -{ - return m_d->m_Disc; -} - -MusicBrainz5::CLabelInfoList *MusicBrainz5::CMetadata::LabelInfoList() const -{ - return m_d->m_LabelInfoList; -} - -MusicBrainz5::CRating *MusicBrainz5::CMetadata::Rating() const -{ - return m_d->m_Rating; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CMetadata::UserRating() const -{ - return m_d->m_UserRating; -} - -MusicBrainz5::CCollection *MusicBrainz5::CMetadata::Collection() const -{ - return m_d->m_Collection; -} - -MusicBrainz5::CArtistList *MusicBrainz5::CMetadata::ArtistList() const -{ - return m_d->m_ArtistList; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CMetadata::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -MusicBrainz5::CReleaseGroupList *MusicBrainz5::CMetadata::ReleaseGroupList() const -{ - return m_d->m_ReleaseGroupList; -} - -MusicBrainz5::CRecordingList *MusicBrainz5::CMetadata::RecordingList() const -{ - return m_d->m_RecordingList; -} - -MusicBrainz5::CLabelList *MusicBrainz5::CMetadata::LabelList() const -{ - return m_d->m_LabelList; -} - -MusicBrainz5::CWorkList *MusicBrainz5::CMetadata::WorkList() const -{ - return m_d->m_WorkList; -} - -MusicBrainz5::CISRCList *MusicBrainz5::CMetadata::ISRCList() const -{ - return m_d->m_ISRCList; -} - -MusicBrainz5::CAnnotationList *MusicBrainz5::CMetadata::AnnotationList() const -{ - return m_d->m_AnnotationList; -} - -MusicBrainz5::CCDStubList *MusicBrainz5::CMetadata::CDStubList() const -{ - return m_d->m_CDStubList; -} - -MusicBrainz5::CFreeDBDiscList *MusicBrainz5::CMetadata::FreeDBDiscList() const -{ - return m_d->m_FreeDBDiscList; -} - -MusicBrainz5::CTagList *MusicBrainz5::CMetadata::TagList() const -{ - return m_d->m_TagList; -} - -MusicBrainz5::CUserTagList *MusicBrainz5::CMetadata::UserTagList() const -{ - return m_d->m_UserTagList; -} - -MusicBrainz5::CCollectionList *MusicBrainz5::CMetadata::CollectionList() const -{ - return m_d->m_CollectionList; -} - -MusicBrainz5::CCDStub *MusicBrainz5::CMetadata::CDStub() const -{ - return m_d->m_CDStub; -} - -MusicBrainz5::CMessage *MusicBrainz5::CMetadata::Message() const -{ - return m_d->m_Message; -} - -std::ostream& MusicBrainz5::CMetadata::Serialise(std::ostream& os) const -{ - os << "Metadata:" << std::endl; - - CEntity::Serialise(os); - - os << "XMLNS: " << XMLNS() << std::endl; - os << "XMLNS-Ext: " << XMLNSExt() << std::endl; - os << "Generator: " << Generator() << std::endl; - os << "Created: " << Created() << std::endl; - - if (Artist()) - os << *Artist() << std::endl; - - if (Release()) - os << *Release() << std::endl; - - if (ReleaseGroup()) - os << *ReleaseGroup() << std::endl; - - if (Recording()) - os << *Recording() << std::endl; - - if (Label()) - os << *Label() << std::endl; - - if (Work()) - os << *Work() << std::endl; - - if (PUID()) - os << *PUID() << std::endl; - - if (ISRC()) - os << *ISRC() << std::endl; - - if (Disc()) - os << *Disc() << std::endl; - - if (LabelInfoList()) - os << *LabelInfoList() << std::endl; - - if (UserRating()) - os << *UserRating() << std::endl; - - if (Collection()) - os << *Collection() << std::endl; - - if (ArtistList()) - os << *ArtistList() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - if (ReleaseGroupList()) - os << *ReleaseGroupList() << std::endl; - - if (RecordingList()) - os << *RecordingList() << std::endl; - - if (LabelList()) - os << *LabelList() << std::endl; - - if (WorkList()) - os << *WorkList() << std::endl; - - if (ISRCList()) - os << *ISRCList() << std::endl; - - if (AnnotationList()) - os << *AnnotationList() << std::endl; - - if (CDStubList()) - os << *CDStubList() << std::endl; - - if (FreeDBDiscList()) - os << *FreeDBDiscList() << std::endl; - - if (TagList()) - os << *TagList() << std::endl; - - if (UserTagList()) - os << *UserTagList() << std::endl; - - if (CollectionList()) - os << *CollectionList() << std::endl; - - if (CDStub()) - os << *CDStub() << std::endl; - - if (Message()) - os << *Message() << std::endl; - - return os; -} - diff --git a/src/NameCredit.cc b/src/NameCredit.cc index cdeb401..f587caa 100644 --- a/src/NameCredit.cc +++ b/src/NameCredit.cc @@ -104,9 +104,7 @@ void MusicBrainz5::CNameCredit::ParseAttribute(const std::string& Name, const st m_d->m_JoinPhrase=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised namecredit attribute: '" << Name << "'" << std::endl; -#endif } } @@ -124,9 +122,7 @@ void MusicBrainz5::CNameCredit::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised name credit element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/NameCredit.cc.silence-warnings b/src/NameCredit.cc.silence-warnings deleted file mode 100644 index f587caa..0000000 --- a/src/NameCredit.cc.silence-warnings +++ /dev/null @@ -1,164 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/NameCredit.h" - -#include "musicbrainz5/Artist.h" - -class MusicBrainz5::CNameCreditPrivate -{ - public: - CNameCreditPrivate() - : m_Artist(0) - { - } - - std::string m_JoinPhrase; - std::string m_Name; - CArtist *m_Artist; -}; - -MusicBrainz5::CNameCredit::CNameCredit(const XMLNode& Node) -: CEntity(), - m_d(new CNameCreditPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Name credit node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CNameCredit::CNameCredit(const CNameCredit& Other) -: CEntity(), - m_d(new CNameCreditPrivate) -{ - *this=Other; -} - -MusicBrainz5::CNameCredit& MusicBrainz5::CNameCredit::operator =(const CNameCredit& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_JoinPhrase=Other.m_d->m_JoinPhrase; - m_d->m_Name=Other.m_d->m_Name; - - if (Other.m_d->m_Artist) - m_d->m_Artist=new CArtist(*Other.m_d->m_Artist); - } - - return *this; -} - -MusicBrainz5::CNameCredit::~CNameCredit() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CNameCredit::Cleanup() -{ - delete m_d->m_Artist; - m_d->m_Artist=0; -} - -MusicBrainz5::CNameCredit *MusicBrainz5::CNameCredit::Clone() -{ - return new CNameCredit(*this); -} - -void MusicBrainz5::CNameCredit::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("joinphrase"==Name) - m_d->m_JoinPhrase=Value; - else - { - std::cerr << "Unrecognised namecredit attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CNameCredit::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else if ("artist"==NodeName) - { - ProcessItem(Node,m_d->m_Artist); - } - else - { - std::cerr << "Unrecognised name credit element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CNameCredit::GetElementName() -{ - return "name-credit"; -} - -std::string MusicBrainz5::CNameCredit::JoinPhrase() const -{ - return m_d->m_JoinPhrase; -} - -std::string MusicBrainz5::CNameCredit::Name() const -{ - return m_d->m_Name; -} - -MusicBrainz5::CArtist *MusicBrainz5::CNameCredit::Artist() const -{ - return m_d->m_Artist; -} - -std::ostream& MusicBrainz5::CNameCredit::Serialise(std::ostream& os) const -{ - os << "Name credit:" << std::endl; - - CEntity::Serialise(os); - - os << "\tJoin phrase: " << JoinPhrase() << std::endl; - os << "\tName: " << Name() << std::endl; - - if (Artist()) - os << *Artist() << std::endl; - - return os; -} - - diff --git a/src/NonMBTrack.cc b/src/NonMBTrack.cc index b47ec48..0bd6367 100644 --- a/src/NonMBTrack.cc +++ b/src/NonMBTrack.cc @@ -86,11 +86,7 @@ MusicBrainz5::CNonMBTrack *MusicBrainz5::CNonMBTrack::Clone() void MusicBrainz5::CNonMBTrack::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised non MB track attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CNonMBTrack::ParseElement(const XMLNode& Node) @@ -111,9 +107,7 @@ void MusicBrainz5::CNonMBTrack::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised non MB track element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/NonMBTrack.cc.silence-warnings b/src/NonMBTrack.cc.silence-warnings deleted file mode 100644 index 0bd6367..0000000 --- a/src/NonMBTrack.cc.silence-warnings +++ /dev/null @@ -1,145 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/NonMBTrack.h" - -class MusicBrainz5::CNonMBTrackPrivate -{ - public: - CNonMBTrackPrivate() - : m_Length(0) - { - } - - std::string m_Title; - std::string m_Artist; - int m_Length; -}; - -MusicBrainz5::CNonMBTrack::CNonMBTrack(const XMLNode& Node) -: CEntity(), - m_d(new CNonMBTrackPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "NonMBTrack node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CNonMBTrack::CNonMBTrack(const CNonMBTrack& Other) -: CEntity(), - m_d(new CNonMBTrackPrivate) -{ - *this=Other; -} - -MusicBrainz5::CNonMBTrack& MusicBrainz5::CNonMBTrack::operator =(const CNonMBTrack& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Artist=Other.m_d->m_Artist; - m_d->m_Length=Other.m_d->m_Length; - } - - return *this; -} - -MusicBrainz5::CNonMBTrack::~CNonMBTrack() -{ - delete m_d; -} - -MusicBrainz5::CNonMBTrack *MusicBrainz5::CNonMBTrack::Clone() -{ - return new CNonMBTrack(*this); -} - -void MusicBrainz5::CNonMBTrack::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised non MB track attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CNonMBTrack::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("artist"==NodeName) - { - ProcessItem(Node,m_d->m_Artist); - } - else if ("length"==NodeName) - { - ProcessItem(Node,m_d->m_Length); - } - else - { - std::cerr << "Unrecognised non MB track element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CNonMBTrack::GetElementName() -{ - return "track"; -} - -std::string MusicBrainz5::CNonMBTrack::Title() const -{ - return m_d->m_Title; -} - -std::string MusicBrainz5::CNonMBTrack::Artist() const -{ - return m_d->m_Artist; -} - -int MusicBrainz5::CNonMBTrack::Length() const -{ - return m_d->m_Length; -} - -std::ostream& MusicBrainz5::CNonMBTrack::Serialise(std::ostream& os) const -{ - os << "NonMBTrack:" << std::endl; - - CEntity::Serialise(os); - - os << "\tTitle: " << Title() << std::endl; - os << "\tArtist: " << Artist() << std::endl; - os << "\tLength: " << Length() << std::endl; - - return os; -} diff --git a/src/PUID.cc b/src/PUID.cc index 18289ef..153d13a 100644 --- a/src/PUID.cc +++ b/src/PUID.cc @@ -103,9 +103,7 @@ void MusicBrainz5::CPUID::ParseAttribute(const std::string& Name, const std::str m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised puid attribute: '" << Name << "'" << std::endl; -#endif } } @@ -119,9 +117,7 @@ void MusicBrainz5::CPUID::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised PUID element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/PUID.cc.silence-warnings b/src/PUID.cc.silence-warnings deleted file mode 100644 index 153d13a..0000000 --- a/src/PUID.cc.silence-warnings +++ /dev/null @@ -1,152 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/PUID.h" - -#include "musicbrainz5/RecordingList.h" -#include "musicbrainz5/Recording.h" - -class MusicBrainz5::CPUIDPrivate -{ - public: - CPUIDPrivate() - : m_RecordingList(0) - { - } - - std::string m_ID; - CRecordingList *m_RecordingList; -}; - -MusicBrainz5::CPUID::CPUID(const XMLNode& Node) -: CEntity(), - m_d(new CPUIDPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "PUID node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CPUID::CPUID(const CPUID& Other) -: CEntity(), - m_d(new CPUIDPrivate) -{ - *this=Other; -} - -MusicBrainz5::CPUID& MusicBrainz5::CPUID::operator =(const CPUID& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - - if (Other.m_d->m_RecordingList) - m_d->m_RecordingList=new CRecordingList(*Other.m_d->m_RecordingList); - } - - return *this; -} - -MusicBrainz5::CPUID::~CPUID() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CPUID::Cleanup() -{ - delete m_d->m_RecordingList; - m_d->m_RecordingList=0; -} - -MusicBrainz5::CPUID *MusicBrainz5::CPUID::Clone() -{ - return new CPUID(*this); -} - -void MusicBrainz5::CPUID::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised puid attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CPUID::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("recording-list"==NodeName) - { - ProcessItem(Node,m_d->m_RecordingList); - } - else - { - std::cerr << "Unrecognised PUID element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CPUID::GetElementName() -{ - return "puid"; -} - -std::string MusicBrainz5::CPUID::ID() const -{ - return m_d->m_ID; -} - -MusicBrainz5::CRecordingList *MusicBrainz5::CPUID::RecordingList() const -{ - return m_d->m_RecordingList; -} - -std::ostream& MusicBrainz5::CPUID::Serialise(std::ostream& os) const -{ - os << "PUID:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - - if (RecordingList()) - os << *RecordingList() << std::endl; - - return os; -} - diff --git a/src/Rating.cc b/src/Rating.cc index 2c6708c..2e6e754 100644 --- a/src/Rating.cc +++ b/src/Rating.cc @@ -96,9 +96,7 @@ void MusicBrainz5::CRating::ParseAttribute(const std::string& Name, const std::s } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised rating attribute: '" << Name << "'" << std::endl; -#endif } } @@ -106,9 +104,7 @@ void MusicBrainz5::CRating::ParseElement(const XMLNode& Node) { std::string NodeName=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised rating attribute: '" << NodeName << "'" << std::endl; -#endif } std::string MusicBrainz5::CRating::GetElementName() diff --git a/src/Rating.cc.silence-warnings b/src/Rating.cc.silence-warnings deleted file mode 100644 index 2e6e754..0000000 --- a/src/Rating.cc.silence-warnings +++ /dev/null @@ -1,135 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Rating.h" - -class MusicBrainz5::CRatingPrivate -{ - public: - CRatingPrivate() - : m_VotesCount(0), - m_Rating(0.0) - { - } - - int m_VotesCount; - double m_Rating; -}; - -MusicBrainz5::CRating::CRating(const XMLNode& Node) -: CEntity(), - m_d(new CRatingPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Rating node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - { - ProcessItem(Node,m_d->m_Rating); - } - } -} - -MusicBrainz5::CRating::CRating(const CRating& Other) -: CEntity(), - m_d(new CRatingPrivate) -{ - *this=Other; -} - -MusicBrainz5::CRating& MusicBrainz5::CRating::operator =(const CRating& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_VotesCount=Other.m_d->m_VotesCount; - m_d->m_Rating=Other.m_d->m_Rating; - } - - return *this; -} - -MusicBrainz5::CRating::~CRating() -{ - delete m_d; -} - -MusicBrainz5::CRating *MusicBrainz5::CRating::Clone() -{ - return new CRating(*this); -} - -void MusicBrainz5::CRating::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("votes-count"==Name) - { - ProcessItem(Value,m_d->m_VotesCount); - } - else - { - std::cerr << "Unrecognised rating attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CRating::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - std::cerr << "Unrecognised rating attribute: '" << NodeName << "'" << std::endl; -} - -std::string MusicBrainz5::CRating::GetElementName() -{ - return "rating"; -} - -int MusicBrainz5::CRating::VotesCount() const -{ - return m_d->m_VotesCount; -} - -double MusicBrainz5::CRating::Rating() const -{ - return m_d->m_Rating; -} - -std::ostream& MusicBrainz5::CRating::Serialise(std::ostream& os) const -{ - os << "Rating:" << std::endl; - - CEntity::Serialise(os); - - os << "\tVotes count: " << VotesCount() << std::endl; - os << "\tRating: " << Rating() << std::endl; - - return os; -} diff --git a/src/Recording.cc b/src/Recording.cc index 2eb2dbd..76536f3 100644 --- a/src/Recording.cc +++ b/src/Recording.cc @@ -157,9 +157,7 @@ void MusicBrainz5::CRecording::ParseAttribute(const std::string& Name, const std m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised recording attribute: '" << Name << "'" << std::endl; -#endif } } @@ -217,9 +215,7 @@ void MusicBrainz5::CRecording::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised recording element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Recording.cc.silence-warnings b/src/Recording.cc.silence-warnings deleted file mode 100644 index 76536f3..0000000 --- a/src/Recording.cc.silence-warnings +++ /dev/null @@ -1,361 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Recording.h" - -#include "musicbrainz5/ArtistCredit.h" -#include "musicbrainz5/Rating.h" -#include "musicbrainz5/UserRating.h" -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/PUIDList.h" -#include "musicbrainz5/PUID.h" -#include "musicbrainz5/ISRCList.h" -#include "musicbrainz5/ISRC.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/Relation.h" -#include "musicbrainz5/TagList.h" -#include "musicbrainz5/Tag.h" -#include "musicbrainz5/UserTagList.h" -#include "musicbrainz5/UserTag.h" - -class MusicBrainz5::CRecordingPrivate -{ - public: - CRecordingPrivate() - : m_Length(0), - m_ArtistCredit(0), - m_ReleaseList(0), - m_PUIDList(0), - m_ISRCList(0), - m_RelationListList(0), - m_TagList(0), - m_UserTagList(0), - m_Rating(0), - m_UserRating(0) - { - } - - std::string m_ID; - std::string m_Title; - int m_Length; - std::string m_Disambiguation; - CArtistCredit *m_ArtistCredit; - CReleaseList *m_ReleaseList; - CPUIDList *m_PUIDList; - CISRCList *m_ISRCList; - CRelationListList *m_RelationListList; - CTagList *m_TagList; - CUserTagList *m_UserTagList; - CRating *m_Rating; - CUserRating *m_UserRating; -}; - -MusicBrainz5::CRecording::CRecording(const XMLNode& Node) -: CEntity(), - m_d(new CRecordingPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Recording node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CRecording::CRecording(const CRecording& Other) -: CEntity(), - m_d(new CRecordingPrivate) -{ - *this=Other; -} - -MusicBrainz5::CRecording& MusicBrainz5::CRecording::operator =(const CRecording& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Length=Other.m_d->m_Length; - m_d->m_Disambiguation=Other.m_d->m_Disambiguation; - - if (Other.m_d->m_ArtistCredit) - m_d->m_ArtistCredit=new CArtistCredit(*Other.m_d->m_ArtistCredit); - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - - if (Other.m_d->m_PUIDList) - m_d->m_PUIDList=new CPUIDList(*Other.m_d->m_PUIDList); - - if (Other.m_d->m_ISRCList) - m_d->m_ISRCList=new CISRCList(*Other.m_d->m_ISRCList); - - if (Other.m_d->m_RelationListList) - m_d->m_RelationListList=new CRelationListList(*Other.m_d->m_RelationListList); - - if (Other.m_d->m_TagList) - m_d->m_TagList=new CTagList(*Other.m_d->m_TagList); - - if (Other.m_d->m_UserTagList) - m_d->m_UserTagList=new CUserTagList(*Other.m_d->m_UserTagList); - - if (Other.m_d->m_Rating) - m_d->m_Rating=new CRating(*Other.m_d->m_Rating); - - if (Other.m_d->m_UserRating) - m_d->m_UserRating=new CUserRating(*Other.m_d->m_UserRating); - } - - return *this; -} - -MusicBrainz5::CRecording::~CRecording() -{ - Cleanup(); - - delete m_d; -} - -MusicBrainz5::CRecording *MusicBrainz5::CRecording::Clone() -{ - return new CRecording(*this); -} - -void MusicBrainz5::CRecording::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised recording attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CRecording::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("length"==NodeName) - { - ProcessItem(Node,m_d->m_Length); - } - else if ("disambiguation"==NodeName) - { - ProcessItem(Node,m_d->m_Disambiguation); - } - else if ("artist-credit"==NodeName) - { - ProcessItem(Node,m_d->m_ArtistCredit); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else if ("puid-list"==NodeName) - { - ProcessItem(Node,m_d->m_PUIDList); - } - else if ("isrc-list"==NodeName) - { - ProcessItem(Node,m_d->m_ISRCList); - } - else if ("relation-list"==NodeName) - { - ProcessRelationList(Node,m_d->m_RelationListList); - } - else if ("tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_TagList); - } - else if ("user-tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_UserTagList); - } - else if ("rating"==NodeName) - { - ProcessItem(Node,m_d->m_Rating); - } - else if ("user-rating"==NodeName) - { - ProcessItem(Node,m_d->m_UserRating); - } - else - { - std::cerr << "Unrecognised recording element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CRecording::GetElementName() -{ - return "recording"; -} - -void MusicBrainz5::CRecording::Cleanup() -{ - delete m_d->m_ArtistCredit; - m_d->m_ArtistCredit=0; - - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; - - delete m_d->m_PUIDList; - m_d->m_PUIDList=0; - - delete m_d->m_ISRCList; - m_d->m_ISRCList=0; - - delete m_d->m_RelationListList; - m_d->m_RelationListList=0; - - delete m_d->m_TagList; - m_d->m_TagList=0; - - delete m_d->m_UserTagList; - m_d->m_UserTagList=0; - - delete m_d->m_Rating; - m_d->m_Rating=0; - - delete m_d->m_UserRating; - m_d->m_UserRating=0; -} - -std::string MusicBrainz5::CRecording::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CRecording::Title() const -{ - return m_d->m_Title; -} - -int MusicBrainz5::CRecording::Length() const -{ - return m_d->m_Length; -} - -std::string MusicBrainz5::CRecording::Disambiguation() const -{ - return m_d->m_Disambiguation; -} - -MusicBrainz5::CArtistCredit *MusicBrainz5::CRecording::ArtistCredit() const -{ - return m_d->m_ArtistCredit; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CRecording::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -MusicBrainz5::CPUIDList *MusicBrainz5::CRecording::PUIDList() const -{ - return m_d->m_PUIDList; -} - -MusicBrainz5::CISRCList *MusicBrainz5::CRecording::ISRCList() const -{ - return m_d->m_ISRCList; -} - -MusicBrainz5::CRelationListList *MusicBrainz5::CRecording::RelationListList() const -{ - return m_d->m_RelationListList; -} - -MusicBrainz5::CTagList *MusicBrainz5::CRecording::TagList() const -{ - return m_d->m_TagList; -} - -MusicBrainz5::CUserTagList *MusicBrainz5::CRecording::UserTagList() const -{ - return m_d->m_UserTagList; -} - -MusicBrainz5::CRating *MusicBrainz5::CRecording::Rating() const -{ - return m_d->m_Rating; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CRecording::UserRating() const -{ - return m_d->m_UserRating; -} - -std::ostream& MusicBrainz5::CRecording::Serialise(std::ostream& os) const -{ - os << "Recording:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tTitle: " << Title() << std::endl; - os << "\tLength: " << Length() << std::endl; - os << "\tDisambiguation: " << Disambiguation() << std::endl; - - if (ArtistCredit()) - os << *ArtistCredit() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - if (PUIDList()) - os << *PUIDList() << std::endl; - - if (ISRCList()) - os << *ISRCList() << std::endl; - - if (RelationListList()) - os << *RelationListList() << std::endl; - - if (TagList()) - os << *TagList() << std::endl; - - if (UserTagList()) - os << *UserTagList() << std::endl; - - if (Rating()) - os << *Rating() << std::endl; - - if (UserRating()) - os << *UserRating() << std::endl; - - return os; -} diff --git a/src/Relation.cc b/src/Relation.cc index 789c317..df044c7 100644 --- a/src/Relation.cc +++ b/src/Relation.cc @@ -168,9 +168,7 @@ void MusicBrainz5::CRelation::ParseAttribute(const std::string& Name, const std: m_d->m_Type=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised relation attribute: '" << Name << "'" << std::endl; -#endif } } @@ -228,9 +226,7 @@ void MusicBrainz5::CRelation::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised relation element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Relation.cc.silence-warnings b/src/Relation.cc.silence-warnings deleted file mode 100644 index df044c7..0000000 --- a/src/Relation.cc.silence-warnings +++ /dev/null @@ -1,339 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Relation.h" - -#include "musicbrainz5/Artist.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/ReleaseGroup.h" -#include "musicbrainz5/Recording.h" -#include "musicbrainz5/Label.h" -#include "musicbrainz5/Work.h" -#include "musicbrainz5/AttributeList.h" -#include "musicbrainz5/Attribute.h" - -class MusicBrainz5::CRelationPrivate -{ - public: - CRelationPrivate() - : m_AttributeList(0), - m_Artist(0), - m_Release(0), - m_ReleaseGroup(0), - m_Recording(0), - m_Label(0), - m_Work(0) - { - } - - std::string m_Type; - std::string m_Target; - std::string m_Direction; - CAttributeList *m_AttributeList; - std::string m_Begin; - std::string m_End; - std::string m_Ended; - CArtist *m_Artist; - CRelease *m_Release; - CReleaseGroup *m_ReleaseGroup; - CRecording *m_Recording; - CLabel *m_Label; - CWork *m_Work; -}; - -MusicBrainz5::CRelation::CRelation(const XMLNode& Node) -: CEntity(), - m_d(new CRelationPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Relation node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CRelation::CRelation(const CRelation& Other) -: CEntity(), - m_d(new CRelationPrivate) -{ - *this=Other; -} - -MusicBrainz5::CRelation& MusicBrainz5::CRelation::operator =(const CRelation& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_Type=Other.m_d->m_Type; - m_d->m_Target=Other.m_d->m_Target; - m_d->m_Direction=Other.m_d->m_Direction; - - if (Other.m_d->m_AttributeList) - m_d->m_AttributeList=new CAttributeList(*Other.m_d->m_AttributeList); - - m_d->m_Begin=Other.m_d->m_Begin; - m_d->m_End=Other.m_d->m_End; - m_d->m_Ended=Other.m_d->m_Ended; - - if (Other.m_d->m_Artist) - m_d->m_Artist=new CArtist(*Other.m_d->m_Artist); - - if (Other.m_d->m_Release) - m_d->m_Release=new CRelease(*Other.m_d->m_Release); - - if (Other.m_d->m_ReleaseGroup) - m_d->m_ReleaseGroup=new CReleaseGroup(*Other.m_d->m_ReleaseGroup); - - if (Other.m_d->m_Recording) - m_d->m_Recording=new CRecording(*Other.m_d->m_Recording); - - if (Other.m_d->m_Label) - m_d->m_Label=new CLabel(*Other.m_d->m_Label); - - if (Other.m_d->m_Work) - m_d->m_Work=new CWork(*Other.m_d->m_Work); - } - - return *this; -} - -MusicBrainz5::CRelation::~CRelation() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CRelation::Cleanup() -{ - delete m_d->m_AttributeList; - m_d->m_AttributeList=0; - - delete m_d->m_Artist; - m_d->m_Artist=0; - - delete m_d->m_Release; - m_d->m_Release=0; - - delete m_d->m_ReleaseGroup; - m_d->m_ReleaseGroup=0; - - delete m_d->m_Recording; - m_d->m_Recording=0; - - delete m_d->m_Label; - m_d->m_Label=0; - - delete m_d->m_Work; - m_d->m_Work=0; -} - -MusicBrainz5::CRelation *MusicBrainz5::CRelation::Clone() -{ - return new CRelation(*this); -} - -void MusicBrainz5::CRelation::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("type"==Name) - m_d->m_Type=Value; - else - { - std::cerr << "Unrecognised relation attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CRelation::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("target"==NodeName) - { - ProcessItem(Node,m_d->m_Target); - } - else if ("direction"==NodeName) - { - ProcessItem(Node,m_d->m_Direction); - } - else if ("attribute-list"==NodeName) - { - ProcessItem(Node,m_d->m_AttributeList); - } - else if ("begin"==NodeName) - { - ProcessItem(Node,m_d->m_Begin); - } - else if ("end"==NodeName) - { - ProcessItem(Node,m_d->m_End); - } - else if ("ended"==NodeName) - { - ProcessItem(Node,m_d->m_Ended); - } - else if ("artist"==NodeName) - { - ProcessItem(Node,m_d->m_Artist); - } - else if ("release"==NodeName) - { - ProcessItem(Node,m_d->m_Release); - } - else if ("release-group"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseGroup); - } - else if ("recording"==NodeName) - { - ProcessItem(Node,m_d->m_Recording); - } - else if ("label"==NodeName) - { - ProcessItem(Node,m_d->m_Label); - } - else if ("work"==NodeName) - { - ProcessItem(Node,m_d->m_Work); - } - else - { - std::cerr << "Unrecognised relation element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CRelation::GetElementName() -{ - return "relation"; -} - -std::string MusicBrainz5::CRelation::Type() const -{ - return m_d->m_Type; -} - -std::string MusicBrainz5::CRelation::Target() const -{ - return m_d->m_Target; -} - -std::string MusicBrainz5::CRelation::Direction() const -{ - return m_d->m_Direction; -} - -MusicBrainz5::CAttributeList *MusicBrainz5::CRelation::AttributeList() const -{ - return m_d->m_AttributeList; -} - -std::string MusicBrainz5::CRelation::Begin() const -{ - return m_d->m_Begin; -} - -std::string MusicBrainz5::CRelation::End() const -{ - return m_d->m_End; -} - -std::string MusicBrainz5::CRelation::Ended() const -{ - return m_d->m_Ended; -} - -MusicBrainz5::CArtist *MusicBrainz5::CRelation::Artist() const -{ - return m_d->m_Artist; -} - -MusicBrainz5::CRelease *MusicBrainz5::CRelation::Release() const -{ - return m_d->m_Release; -} - -MusicBrainz5::CReleaseGroup *MusicBrainz5::CRelation::ReleaseGroup() const -{ - return m_d->m_ReleaseGroup; -} - -MusicBrainz5::CRecording *MusicBrainz5::CRelation::Recording() const -{ - return m_d->m_Recording; -} - -MusicBrainz5::CLabel *MusicBrainz5::CRelation::Label() const -{ - return m_d->m_Label; -} - -MusicBrainz5::CWork *MusicBrainz5::CRelation::Work() const -{ - return m_d->m_Work; -} - -std::ostream& MusicBrainz5::CRelation::Serialise(std::ostream& os) const -{ - os << "Relation:" << std::endl; - - CEntity::Serialise(os); - - os << "\tType: " << Type() << std::endl; - os << "\tTarget: " << Target() << std::endl; - os << "\tDirection: " << Direction() << std::endl; - - if (AttributeList()) - os << *AttributeList() << std::endl; - - os << "\tBegin: " << Begin() << std::endl; - os << "\tEnd: " << End() << std::endl; - os << "\tEnded: " << Ended() << std::endl; - - if (Artist()) - os << *Artist() << std::endl; - - if (Release()) - os << *Release() << std::endl; - - if (ReleaseGroup()) - os << *ReleaseGroup() << std::endl; - - if (Recording()) - os << *Recording() << std::endl; - - if (Label()) - os << *Label() << std::endl; - - if (Work()) - os << *Work() << std::endl; - - return os; -} diff --git a/src/Release.cc b/src/Release.cc index e98886f..59a58b5 100644 --- a/src/Release.cc +++ b/src/Release.cc @@ -180,9 +180,7 @@ void MusicBrainz5::CRelease::ParseAttribute(const std::string& Name, const std:: m_d->m_ID=Value; else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised release attribute: '" << Name << "'" << std::endl; -#endif } } @@ -256,9 +254,7 @@ void MusicBrainz5::CRelease::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised release element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Release.cc.silence-warnings b/src/Release.cc.silence-warnings deleted file mode 100644 index 59a58b5..0000000 --- a/src/Release.cc.silence-warnings +++ /dev/null @@ -1,409 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Release.h" - -#include - -#include "musicbrainz5/TextRepresentation.h" -#include "musicbrainz5/ArtistCredit.h" -#include "musicbrainz5/ReleaseGroup.h" -#include "musicbrainz5/Medium.h" -#include "musicbrainz5/LabelInfoList.h" -#include "musicbrainz5/LabelInfo.h" -#include "musicbrainz5/RelationList.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/Relation.h" -#include "musicbrainz5/MediumList.h" -#include "musicbrainz5/Medium.h" -#include "musicbrainz5/Collection.h" -#include "musicbrainz5/CollectionList.h" - -class MusicBrainz5::CReleasePrivate -{ - public: - CReleasePrivate() - : m_TextRepresentation(0), - m_ArtistCredit(0), - m_ReleaseGroup(0), - m_LabelInfoList(0), - m_MediumList(0), - m_RelationListList(0), - m_CollectionList(0) - { - } - - std::string m_ID; - std::string m_Title; - std::string m_Status; - std::string m_Quality; - std::string m_Disambiguation; - std::string m_Packaging; - CTextRepresentation *m_TextRepresentation; - CArtistCredit *m_ArtistCredit; - CReleaseGroup *m_ReleaseGroup; - std::string m_Date; - std::string m_Country; - std::string m_Barcode; - std::string m_ASIN; - CLabelInfoList *m_LabelInfoList; - CMediumList *m_MediumList; - CRelationListList *m_RelationListList; - CCollectionList *m_CollectionList; -}; - -MusicBrainz5::CRelease::CRelease(const XMLNode& Node) -: CEntity(), - m_d(new CReleasePrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Release node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CRelease::CRelease(const CRelease& Other) -: CEntity(), - m_d(new CReleasePrivate) -{ - *this=Other; -} - -MusicBrainz5::CRelease& MusicBrainz5::CRelease::operator =(const CRelease& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Status=Other.m_d->m_Status; - m_d->m_Quality=Other.m_d->m_Quality; - m_d->m_Disambiguation=Other.m_d->m_Disambiguation; - m_d->m_Packaging=Other.m_d->m_Packaging; - - if (Other.m_d->m_TextRepresentation) - m_d->m_TextRepresentation=new CTextRepresentation(*Other.m_d->m_TextRepresentation); - - if (Other.m_d->m_ArtistCredit) - m_d->m_ArtistCredit=new CArtistCredit(*Other.m_d->m_ArtistCredit); - - if (Other.m_d->m_ReleaseGroup) - m_d->m_ReleaseGroup=new CReleaseGroup(*Other.m_d->m_ReleaseGroup); - - m_d->m_Date=Other.m_d->m_Date; - m_d->m_Country=Other.m_d->m_Country; - m_d->m_Barcode=Other.m_d->m_Barcode; - m_d->m_ASIN=Other.m_d->m_ASIN; - - if (Other.m_d->m_LabelInfoList) - m_d->m_LabelInfoList=new CLabelInfoList(*Other.m_d->m_LabelInfoList); - - if (Other.m_d->m_MediumList) - m_d->m_MediumList=new CMediumList(*Other.m_d->m_MediumList); - - if (Other.m_d->m_RelationListList) - m_d->m_RelationListList=new CRelationListList(*Other.m_d->m_RelationListList); - - if (Other.m_d->m_CollectionList) - m_d->m_CollectionList=new CCollectionList(*Other.m_d->m_CollectionList); - } - - return *this; -} - -MusicBrainz5::CRelease::~CRelease() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CRelease::Cleanup() -{ - delete m_d->m_TextRepresentation; - m_d->m_TextRepresentation=0; - - delete m_d->m_ArtistCredit; - m_d->m_ArtistCredit=0; - - delete m_d->m_ReleaseGroup; - m_d->m_ReleaseGroup=0; - - delete m_d->m_LabelInfoList; - m_d->m_LabelInfoList=0; - - delete m_d->m_MediumList; - m_d->m_MediumList=0; - - delete m_d->m_RelationListList; - m_d->m_RelationListList=0; -} - -MusicBrainz5::CRelease *MusicBrainz5::CRelease::Clone() -{ - return new CRelease(*this); -} - -void MusicBrainz5::CRelease::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else - { - std::cerr << "Unrecognised release attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CRelease::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("status"==NodeName) - { - ProcessItem(Node,m_d->m_Status); - } - else if ("quality"==NodeName) - { - ProcessItem(Node,m_d->m_Quality); - } - else if ("disambiguation"==NodeName) - { - ProcessItem(Node,m_d->m_Disambiguation); - } - else if ("packaging"==NodeName) - { - ProcessItem(Node,m_d->m_Packaging); - } - else if ("text-representation"==NodeName) - { - ProcessItem(Node,m_d->m_TextRepresentation); - } - else if ("artist-credit"==NodeName) - { - ProcessItem(Node,m_d->m_ArtistCredit); - } - else if ("release-group"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseGroup); - } - else if ("date"==NodeName) - { - ProcessItem(Node,m_d->m_Date); - } - else if ("country"==NodeName) - { - ProcessItem(Node,m_d->m_Country); - } - else if ("barcode"==NodeName) - { - ProcessItem(Node,m_d->m_Barcode); - } - else if ("asin"==NodeName) - { - ProcessItem(Node,m_d->m_ASIN); - } - else if ("label-info-list"==NodeName) - { - ProcessItem(Node,m_d->m_LabelInfoList); - } - else if ("medium-list"==NodeName) - { - ProcessItem(Node,m_d->m_MediumList); - } - else if ("relation-list"==NodeName) - { - ProcessRelationList(Node,m_d->m_RelationListList); - } - else if ("collection-list"==NodeName) - { - ProcessItem(Node,m_d->m_CollectionList); - } - else - { - std::cerr << "Unrecognised release element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CRelease::GetElementName() -{ - return "release"; -} - -std::string MusicBrainz5::CRelease::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CRelease::Title() const -{ - return m_d->m_Title; -} - -std::string MusicBrainz5::CRelease::Status() const -{ - return m_d->m_Status; -} - -std::string MusicBrainz5::CRelease::Quality() const -{ - return m_d->m_Quality; -} - -std::string MusicBrainz5::CRelease::Disambiguation() const -{ - return m_d->m_Disambiguation; -} - -std::string MusicBrainz5::CRelease::Packaging() const -{ - return m_d->m_Packaging; -} - -MusicBrainz5::CTextRepresentation *MusicBrainz5::CRelease::TextRepresentation() const -{ - return m_d->m_TextRepresentation; -} - -MusicBrainz5::CArtistCredit *MusicBrainz5::CRelease::ArtistCredit() const -{ - return m_d->m_ArtistCredit; -} - -MusicBrainz5::CReleaseGroup *MusicBrainz5::CRelease::ReleaseGroup() const -{ - return m_d->m_ReleaseGroup; -} - -std::string MusicBrainz5::CRelease::Date() const -{ - return m_d->m_Date; -} - -std::string MusicBrainz5::CRelease::Country() const -{ - return m_d->m_Country; -} - -std::string MusicBrainz5::CRelease::Barcode() const -{ - return m_d->m_Barcode; -} - -std::string MusicBrainz5::CRelease::ASIN() const -{ - return m_d->m_ASIN; -} - -MusicBrainz5::CLabelInfoList *MusicBrainz5::CRelease::LabelInfoList() const -{ - return m_d->m_LabelInfoList; -} - -MusicBrainz5::CMediumList *MusicBrainz5::CRelease::MediumList() const -{ - return m_d->m_MediumList; -} - -MusicBrainz5::CRelationListList *MusicBrainz5::CRelease::RelationListList() const -{ - return m_d->m_RelationListList; -} - -MusicBrainz5::CCollectionList *MusicBrainz5::CRelease::CollectionList() const -{ - return m_d->m_CollectionList; -} - -MusicBrainz5::CMediumList MusicBrainz5::CRelease::MediaMatchingDiscID(const std::string& DiscID) const -{ - MusicBrainz5::CMediumList Ret; - - if (m_d->m_MediumList) - { - for (int count=0;countm_MediumList->NumItems();count++) - { - MusicBrainz5::CMedium *Medium=m_d->m_MediumList->Item(count); - - if (Medium->ContainsDiscID(DiscID)) - Ret.AddItem(new MusicBrainz5::CMedium(*Medium)); - } - } - - return Ret; -} - -std::ostream& MusicBrainz5::CRelease::Serialise(std::ostream& os) const -{ - os << "Release:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tTitle: " << Title() << std::endl; - os << "\tStatus: " << Status() << std::endl; - os << "\tQuality: " << Quality() << std::endl; - os << "\tDisambiguation: " << Disambiguation() << std::endl; - os << "\tPackaging: " << Packaging() << std::endl; - - if (TextRepresentation()) - os << *TextRepresentation(); - - if (ArtistCredit()) - os << *ArtistCredit() << std::endl; - - if (ReleaseGroup()) - os << *ReleaseGroup() << std::endl; - - os << "\tDate: " << Date() << std::endl; - os << "\tCountry: " << Country() << std::endl; - os << "\tBarcode: " << Barcode() << std::endl; - os << "\tASIN: " << ASIN() << std::endl; - - if (LabelInfoList()) - os << *LabelInfoList() << std::endl; - - if (MediumList()) - os << *MediumList() << std::endl; - - if (RelationListList()) - os << *RelationListList() << std::endl; - - if (CollectionList()) - os << *CollectionList() << std::endl; - - return os; -} diff --git a/src/ReleaseGroup.cc b/src/ReleaseGroup.cc index 0dbd563..a8c4edd 100644 --- a/src/ReleaseGroup.cc +++ b/src/ReleaseGroup.cc @@ -183,9 +183,7 @@ void MusicBrainz5::CReleaseGroup::ParseAttribute(const std::string& Name, const } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised releasegroup attribute: '" << Name << "'" << std::endl; -#endif } } @@ -243,9 +241,7 @@ void MusicBrainz5::CReleaseGroup::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised release group element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/ReleaseGroup.cc.silence-warnings b/src/ReleaseGroup.cc.silence-warnings deleted file mode 100644 index a8c4edd..0000000 --- a/src/ReleaseGroup.cc.silence-warnings +++ /dev/null @@ -1,356 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/ReleaseGroup.h" - -#include "musicbrainz5/ArtistCredit.h" -#include "musicbrainz5/Rating.h" -#include "musicbrainz5/UserRating.h" -#include "musicbrainz5/ReleaseList.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/RelationList.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/Relation.h" -#include "musicbrainz5/TagList.h" -#include "musicbrainz5/Tag.h" -#include "musicbrainz5/UserTagList.h" -#include "musicbrainz5/UserTag.h" -#include "musicbrainz5/SecondaryTypeList.h" -#include "musicbrainz5/SecondaryType.h" - -class MusicBrainz5::CReleaseGroupPrivate -{ - public: - CReleaseGroupPrivate() - : m_ArtistCredit(0), - m_ReleaseList(0), - m_RelationListList(0), - m_TagList(0), - m_UserTagList(0), - m_Rating(0), - m_UserRating(0), - m_SecondaryTypeList(0) - { - } - - std::string m_ID; - std::string m_PrimaryType; - std::string m_Title; - std::string m_Disambiguation; - std::string m_FirstReleaseDate; - CArtistCredit *m_ArtistCredit; - CReleaseList *m_ReleaseList; - CRelationListList *m_RelationListList; - CTagList *m_TagList; - CUserTagList *m_UserTagList; - CRating *m_Rating; - CUserRating *m_UserRating; - CSecondaryTypeList *m_SecondaryTypeList; -}; - -MusicBrainz5::CReleaseGroup::CReleaseGroup(const XMLNode& Node) -: CEntity(), - m_d(new CReleaseGroupPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Name credit node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CReleaseGroup::CReleaseGroup(const CReleaseGroup& Other) -: CEntity(), - m_d(new CReleaseGroupPrivate) -{ - *this=Other; -} - -MusicBrainz5::CReleaseGroup& MusicBrainz5::CReleaseGroup::operator =(const CReleaseGroup& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_PrimaryType=Other.m_d->m_PrimaryType; - m_d->m_Title=Other.m_d->m_Title; - m_d->m_Disambiguation=Other.m_d->m_Disambiguation; - m_d->m_FirstReleaseDate=Other.m_d->m_FirstReleaseDate; - - if (Other.m_d->m_ArtistCredit) - m_d->m_ArtistCredit=new CArtistCredit(*Other.m_d->m_ArtistCredit); - - if (Other.m_d->m_ReleaseList) - m_d->m_ReleaseList=new CReleaseList(*Other.m_d->m_ReleaseList); - - if (Other.m_d->m_RelationListList) - m_d->m_RelationListList=new CRelationListList(*Other.m_d->m_RelationListList); - - if (Other.m_d->m_TagList) - m_d->m_TagList=new CTagList(*Other.m_d->m_TagList); - - if (Other.m_d->m_UserTagList) - m_d->m_UserTagList=new CUserTagList(*Other.m_d->m_UserTagList); - - if (Other.m_d->m_Rating) - m_d->m_Rating=new CRating(*Other.m_d->m_Rating); - - if (Other.m_d->m_UserRating) - m_d->m_UserRating=new CUserRating(*Other.m_d->m_UserRating); - - if (Other.m_d->m_SecondaryTypeList) - m_d->m_SecondaryTypeList=new CSecondaryTypeList(*Other.m_d->m_SecondaryTypeList); - } - - return *this; -} - -MusicBrainz5::CReleaseGroup::~CReleaseGroup() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CReleaseGroup::Cleanup() -{ - delete m_d->m_ArtistCredit; - m_d->m_ArtistCredit=0; - - delete m_d->m_ReleaseList; - m_d->m_ReleaseList=0; - - delete m_d->m_RelationListList; - m_d->m_RelationListList=0; - - delete m_d->m_TagList; - m_d->m_TagList=0; - - delete m_d->m_UserTagList; - m_d->m_UserTagList=0; - - delete m_d->m_Rating; - m_d->m_Rating=0; - - delete m_d->m_UserRating; - m_d->m_UserRating=0; - - delete m_d->m_SecondaryTypeList; - m_d->m_SecondaryTypeList=0; -} - -MusicBrainz5::CReleaseGroup *MusicBrainz5::CReleaseGroup::Clone() -{ - return new CReleaseGroup(*this); -} - -void MusicBrainz5::CReleaseGroup::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else if ("type"==Name) - { - //Ignore type - } - else - { - std::cerr << "Unrecognised releasegroup attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CReleaseGroup::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("primary-type"==NodeName) - { - ProcessItem(Node,m_d->m_PrimaryType); - } - else if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("disambiguation"==NodeName) - { - ProcessItem(Node,m_d->m_Disambiguation); - } - else if ("first-release-date"==NodeName) - { - ProcessItem(Node,m_d->m_FirstReleaseDate); - } - else if ("artist-credit"==NodeName) - { - ProcessItem(Node,m_d->m_ArtistCredit); - } - else if ("release-list"==NodeName) - { - ProcessItem(Node,m_d->m_ReleaseList); - } - else if ("relation-list"==NodeName) - { - ProcessRelationList(Node,m_d->m_RelationListList); - } - else if ("tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_TagList); - } - else if ("user-tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_UserTagList); - } - else if ("rating"==NodeName) - { - ProcessItem(Node,m_d->m_Rating); - } - else if ("user-rating"==NodeName) - { - ProcessItem(Node,m_d->m_UserRating); - } - else if ("secondary-type-list"==NodeName) - { - ProcessItem(Node,m_d->m_SecondaryTypeList); - } - else - { - std::cerr << "Unrecognised release group element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CReleaseGroup::GetElementName() -{ - return "release-group"; -} - -std::string MusicBrainz5::CReleaseGroup::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CReleaseGroup::PrimaryType() const -{ - return m_d->m_PrimaryType; -} - -std::string MusicBrainz5::CReleaseGroup::Title() const -{ - return m_d->m_Title; -} - -std::string MusicBrainz5::CReleaseGroup::Disambiguation() const -{ - return m_d->m_Disambiguation; -} - -std::string MusicBrainz5::CReleaseGroup::FirstReleaseDate() const -{ - return m_d->m_FirstReleaseDate; -} - -MusicBrainz5::CArtistCredit *MusicBrainz5::CReleaseGroup::ArtistCredit() const -{ - return m_d->m_ArtistCredit; -} - -MusicBrainz5::CReleaseList *MusicBrainz5::CReleaseGroup::ReleaseList() const -{ - return m_d->m_ReleaseList; -} - -MusicBrainz5::CRelationListList *MusicBrainz5::CReleaseGroup::RelationListList() const -{ - return m_d->m_RelationListList; -} - -MusicBrainz5::CTagList *MusicBrainz5::CReleaseGroup::TagList() const -{ - return m_d->m_TagList; -} - -MusicBrainz5::CUserTagList *MusicBrainz5::CReleaseGroup::UserTagList() const -{ - return m_d->m_UserTagList; -} - -MusicBrainz5::CRating *MusicBrainz5::CReleaseGroup::Rating() const -{ - return m_d->m_Rating; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CReleaseGroup::UserRating() const -{ - return m_d->m_UserRating; -} - -MusicBrainz5::CSecondaryTypeList *MusicBrainz5::CReleaseGroup::SecondaryTypeList() const -{ - return m_d->m_SecondaryTypeList; -} - -std::ostream& MusicBrainz5::CReleaseGroup::Serialise(std::ostream& os) const -{ - os << "Release group:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tPrimaryType: " << PrimaryType() << std::endl; - os << "\tTitle: " << Title() << std::endl; - os << "\tDisambiguation: " << Disambiguation() << std::endl; - os << "\tFirst release date: " << FirstReleaseDate() << std::endl; - - if (ArtistCredit()) - os << *ArtistCredit() << std::endl; - - if (ReleaseList()) - os << *ReleaseList() << std::endl; - - if (RelationListList()) - os << *RelationListList() << std::endl; - - if (TagList()) - os << *TagList() << std::endl; - - if (UserTagList()) - os << *UserTagList() << std::endl; - - if (Rating()) - os << *Rating() << std::endl; - - if (UserRating()) - os << *UserRating() << std::endl; - - if (SecondaryTypeList()) - os << *SecondaryTypeList() << std::endl; - - return os; -} - diff --git a/src/SecondaryType.cc b/src/SecondaryType.cc index 094f549..46db98d 100644 --- a/src/SecondaryType.cc +++ b/src/SecondaryType.cc @@ -93,20 +93,14 @@ MusicBrainz5::CSecondaryType *MusicBrainz5::CSecondaryType::Clone() void MusicBrainz5::CSecondaryType::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised secondary type attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CSecondaryType::ParseElement(const XMLNode& Node) { std::string NodeName=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised secondary type element: '" << NodeName << "'" << std::endl; -#endif } std::string MusicBrainz5::CSecondaryType::GetElementName() diff --git a/src/SecondaryType.cc.silence-warnings b/src/SecondaryType.cc.silence-warnings deleted file mode 100644 index 46db98d..0000000 --- a/src/SecondaryType.cc.silence-warnings +++ /dev/null @@ -1,125 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/SecondaryType.h" - - -class MusicBrainz5::CSecondaryTypePrivate -{ - public: - CSecondaryTypePrivate() - { - } - - std::string m_SecondaryType; -}; - -MusicBrainz5::CSecondaryType::CSecondaryType(const XMLNode& Node) -: CEntity(), - m_d(new CSecondaryTypePrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "SecondaryType node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - ProcessItem(Node,m_d->m_SecondaryType); - } -} - -MusicBrainz5::CSecondaryType::CSecondaryType(const CSecondaryType& Other) -: CEntity(), - m_d(new CSecondaryTypePrivate) -{ - *this=Other; -} - -MusicBrainz5::CSecondaryType& MusicBrainz5::CSecondaryType::operator =(const CSecondaryType& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_SecondaryType=Other.m_d->m_SecondaryType; - } - - return *this; -} - -MusicBrainz5::CSecondaryType::~CSecondaryType() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CSecondaryType::Cleanup() -{ -} - -MusicBrainz5::CSecondaryType *MusicBrainz5::CSecondaryType::Clone() -{ - return new CSecondaryType(*this); -} - -void MusicBrainz5::CSecondaryType::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised secondary type attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CSecondaryType::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - std::cerr << "Unrecognised secondary type element: '" << NodeName << "'" << std::endl; -} - -std::string MusicBrainz5::CSecondaryType::GetElementName() -{ - return "secondary-type"; -} - -std::string MusicBrainz5::CSecondaryType::SecondaryType() const -{ - return m_d->m_SecondaryType; -} - -std::ostream& MusicBrainz5::CSecondaryType::Serialise(std::ostream& os) const -{ - os << "Secondary Type:" << std::endl; - - CEntity::Serialise(os); - - os << "\tSecondaryType: " << SecondaryType() << std::endl; - - return os; -} diff --git a/src/Tag.cc b/src/Tag.cc index e8d4017..e9f2d6b 100644 --- a/src/Tag.cc +++ b/src/Tag.cc @@ -90,9 +90,7 @@ void MusicBrainz5::CTag::ParseAttribute(const std::string& Name, const std::stri } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised tag attribute: '" << Name << "'" << std::endl; -#endif } } @@ -106,9 +104,7 @@ void MusicBrainz5::CTag::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised tag element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Tag.cc.silence-warnings b/src/Tag.cc.silence-warnings deleted file mode 100644 index e9f2d6b..0000000 --- a/src/Tag.cc.silence-warnings +++ /dev/null @@ -1,136 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Tag.h" - -class MusicBrainz5::CTagPrivate -{ - public: - CTagPrivate() - : m_Count(0) - { - } - - int m_Count; - std::string m_Name; -}; - -MusicBrainz5::CTag::CTag(const XMLNode& Node) -: CEntity(), - m_d(new CTagPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Tag node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CTag::CTag(const CTag& Other) -: CEntity(), - m_d(new CTagPrivate) -{ - *this=Other; -} - -MusicBrainz5::CTag& MusicBrainz5::CTag::operator =(const CTag& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Count=Other.m_d->m_Count; - m_d->m_Name=Other.m_d->m_Name; - } - - return *this; -} - -MusicBrainz5::CTag::~CTag() -{ - delete m_d; -} - -MusicBrainz5::CTag *MusicBrainz5::CTag::Clone() -{ - return new CTag(*this); -} - -void MusicBrainz5::CTag::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("count"==Name) - { - ProcessItem(Value,m_d->m_Count); - } - else - { - std::cerr << "Unrecognised tag attribute: '" << Name << "'" << std::endl; - } -} - -void MusicBrainz5::CTag::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else - { - std::cerr << "Unrecognised tag element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CTag::GetElementName() -{ - return "tag"; -} - -int MusicBrainz5::CTag::Count() const -{ - return m_d->m_Count; -} - -std::string MusicBrainz5::CTag::Name() const -{ - return m_d->m_Name; -} - -std::ostream& MusicBrainz5::CTag::Serialise(std::ostream& os) const -{ - os << "Tag:" << std::endl; - - CEntity::Serialise(os); - - os << "\tCount: " << Count() << std::endl; - os << "\tName: " << Name() << std::endl; - - return os; -} diff --git a/src/TextRepresentation.cc b/src/TextRepresentation.cc index cc4e1be..0d08414 100644 --- a/src/TextRepresentation.cc +++ b/src/TextRepresentation.cc @@ -79,11 +79,7 @@ MusicBrainz5::CTextRepresentation *MusicBrainz5::CTextRepresentation::Clone() void MusicBrainz5::CTextRepresentation::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised textrepresentation attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CTextRepresentation::ParseElement(const XMLNode& Node) @@ -100,9 +96,7 @@ void MusicBrainz5::CTextRepresentation::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised textrepresentation element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/TextRepresentation.cc.silence-warnings b/src/TextRepresentation.cc.silence-warnings deleted file mode 100644 index 0d08414..0000000 --- a/src/TextRepresentation.cc.silence-warnings +++ /dev/null @@ -1,129 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/TextRepresentation.h" - -class MusicBrainz5::CTextRepresentationPrivate -{ - public: - std::string m_Language; - std::string m_Script; -}; - -MusicBrainz5::CTextRepresentation::CTextRepresentation(const XMLNode& Node) -: CEntity(), - m_d(new CTextRepresentationPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Text representation node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CTextRepresentation::CTextRepresentation(const CTextRepresentation& Other) -: CEntity(), - m_d(new CTextRepresentationPrivate) -{ - *this=Other; -} - -MusicBrainz5::CTextRepresentation& MusicBrainz5::CTextRepresentation::operator =(const CTextRepresentation& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Language=Other.m_d->m_Language; - m_d->m_Script=Other.m_d->m_Script; - } - - return *this; -} - -MusicBrainz5::CTextRepresentation::~CTextRepresentation() -{ - delete m_d; -} - -MusicBrainz5::CTextRepresentation *MusicBrainz5::CTextRepresentation::Clone() -{ - return new CTextRepresentation(*this); -} - -void MusicBrainz5::CTextRepresentation::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised textrepresentation attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CTextRepresentation::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("language"==NodeName) - { - ProcessItem(Node,m_d->m_Language); - } - else if ("script"==NodeName) - { - ProcessItem(Node,m_d->m_Script); - } - else - { - std::cerr << "Unrecognised textrepresentation element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CTextRepresentation::GetElementName() -{ - return "text-representation"; -} - -std::string MusicBrainz5::CTextRepresentation::Language() const -{ - return m_d->m_Language; -} - -std::string MusicBrainz5::CTextRepresentation::Script() const -{ - return m_d->m_Script; -} - -std::ostream& MusicBrainz5::CTextRepresentation::Serialise(std::ostream& os) const -{ - os << "\tText Representation:" << std::endl; - - CEntity::Serialise(os); - - os << "\t\tLanguage: " << Language() << std::endl; - os << "\t\tScript: " << Script() << std::endl; - - return os; -} - diff --git a/src/Track.cc b/src/Track.cc index 5459efa..a1b0730 100644 --- a/src/Track.cc +++ b/src/Track.cc @@ -117,11 +117,7 @@ MusicBrainz5::CTrack *MusicBrainz5::CTrack::Clone() void MusicBrainz5::CTrack::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised track attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CTrack::ParseElement(const XMLNode& Node) @@ -154,9 +150,7 @@ void MusicBrainz5::CTrack::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised track element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Track.cc.silence-warnings b/src/Track.cc.silence-warnings deleted file mode 100644 index a1b0730..0000000 --- a/src/Track.cc.silence-warnings +++ /dev/null @@ -1,212 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Track.h" - -#include "musicbrainz5/Recording.h" -#include "musicbrainz5/ArtistCredit.h" - -class MusicBrainz5::CTrackPrivate -{ - public: - CTrackPrivate() - : m_Position(0), - m_Recording(0), - m_Length(0), - m_ArtistCredit(0) - { - } - - int m_Position; - std::string m_Title; - CRecording *m_Recording; - int m_Length; - CArtistCredit *m_ArtistCredit; - std::string m_Number; -}; - -MusicBrainz5::CTrack::CTrack(const XMLNode& Node) -: CEntity(), - m_d(new CTrackPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Track node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CTrack::CTrack(const CTrack& Other) -: CEntity(), - m_d(new CTrackPrivate) -{ - *this=Other; -} - -MusicBrainz5::CTrack& MusicBrainz5::CTrack::operator =(const CTrack& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_Position=Other.m_d->m_Position; - m_d->m_Title=Other.m_d->m_Title; - - if (Other.m_d->m_Recording) - m_d->m_Recording=new CRecording(*Other.m_d->m_Recording); - - m_d->m_Length=Other.m_d->m_Length; - - if (Other.m_d->m_ArtistCredit) - m_d->m_ArtistCredit=new CArtistCredit(*Other.m_d->m_ArtistCredit); - - m_d->m_Number=Other.m_d->m_Number; - } - - return *this; -} - -MusicBrainz5::CTrack::~CTrack() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CTrack::Cleanup() -{ - delete m_d->m_Recording; - m_d->m_Recording=0; - - delete m_d->m_ArtistCredit; - m_d->m_ArtistCredit=0; -} - -MusicBrainz5::CTrack *MusicBrainz5::CTrack::Clone() -{ - return new CTrack(*this); -} - -void MusicBrainz5::CTrack::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised track attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CTrack::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("position"==NodeName) - { - ProcessItem(Node,m_d->m_Position); - } - else if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("recording"==NodeName) - { - ProcessItem(Node,m_d->m_Recording); - } - else if ("length"==NodeName) - { - ProcessItem(Node,m_d->m_Length); - } - else if ("artist-credit"==NodeName) - { - ProcessItem(Node,m_d->m_ArtistCredit); - } - else if ("number"==NodeName) - { - ProcessItem(Node,m_d->m_Number); - } - else - { - std::cerr << "Unrecognised track element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CTrack::GetElementName() -{ - return "track"; -} - -int MusicBrainz5::CTrack::Position() const -{ - return m_d->m_Position; -} - -std::string MusicBrainz5::CTrack::Title() const -{ - return m_d->m_Title; -} - -MusicBrainz5::CRecording *MusicBrainz5::CTrack::Recording() const -{ - return m_d->m_Recording; -} - -int MusicBrainz5::CTrack::Length() const -{ - return m_d->m_Length; -} - -MusicBrainz5::CArtistCredit *MusicBrainz5::CTrack::ArtistCredit() const -{ - return m_d->m_ArtistCredit; -} - -std::string MusicBrainz5::CTrack::Number() const -{ - return m_d->m_Number; -} - -std::ostream& MusicBrainz5::CTrack::Serialise(std::ostream& os) const -{ - os << "Track:" << std::endl; - - CEntity::Serialise(os); - - os << "\tPosition: " << Position() << std::endl; - os << "\tTitle: " << Title() << std::endl; - - if (Recording()) - os << *Recording() << std::endl; - - os << "\tLength: " << Length() << std::endl; - - if (ArtistCredit()) - os << *ArtistCredit() << std::endl; - - os << "\tNumber: " << Number() << std::endl; - - return os; -} diff --git a/src/UserRating.cc b/src/UserRating.cc index 2b29ae2..8890786 100644 --- a/src/UserRating.cc +++ b/src/UserRating.cc @@ -87,20 +87,14 @@ MusicBrainz5::CUserRating *MusicBrainz5::CUserRating::Clone() void MusicBrainz5::CUserRating::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised userrating attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CUserRating::ParseElement(const XMLNode& Node) { std::string Name=Node.getName(); -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised userrating element: '" << Name << "'" << std::endl; -#endif } std::string MusicBrainz5::CUserRating::GetElementName() diff --git a/src/UserRating.cc.silence-warnings b/src/UserRating.cc.silence-warnings deleted file mode 100644 index 8890786..0000000 --- a/src/UserRating.cc.silence-warnings +++ /dev/null @@ -1,119 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/UserRating.h" - -class MusicBrainz5::CUserRatingPrivate -{ - public: - CUserRatingPrivate() - : m_UserRating(0) - { - } - - int m_UserRating; -}; - -MusicBrainz5::CUserRating::CUserRating(const XMLNode& Node) -: CEntity(), - m_d(new CUserRatingPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "User rating node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - - if (Node.getText()) - { - ProcessItem(Node,m_d->m_UserRating); - } - } -} - -MusicBrainz5::CUserRating::CUserRating(const CUserRating& Other) -: CEntity(), - m_d(new CUserRatingPrivate) -{ - *this=Other; -} - -MusicBrainz5::CUserRating& MusicBrainz5::CUserRating::operator =(const CUserRating& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_UserRating=Other.m_d->m_UserRating; - } - - return *this; -} - -MusicBrainz5::CUserRating::~CUserRating() -{ - delete m_d; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CUserRating::Clone() -{ - return new CUserRating(*this); -} - -void MusicBrainz5::CUserRating::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised userrating attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CUserRating::ParseElement(const XMLNode& Node) -{ - std::string Name=Node.getName(); - - std::cerr << "Unrecognised userrating element: '" << Name << "'" << std::endl; -} - -std::string MusicBrainz5::CUserRating::GetElementName() -{ - return "user-rating"; -} - -int MusicBrainz5::CUserRating::UserRating() const -{ - return m_d->m_UserRating; -} - -std::ostream& MusicBrainz5::CUserRating::Serialise(std::ostream& os) const -{ - os << "User rating:" << std::endl; - - CEntity::Serialise(os); - - os << "\tRating: " << UserRating() << std::endl; - - return os; -} diff --git a/src/UserTag.cc b/src/UserTag.cc index 9acb49c..157a31f 100644 --- a/src/UserTag.cc +++ b/src/UserTag.cc @@ -77,11 +77,7 @@ MusicBrainz5::CUserTag *MusicBrainz5::CUserTag::Clone() void MusicBrainz5::CUserTag::ParseAttribute(const std::string& Name, const std::string& /*Value*/) { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised usertag attribute: '" << Name << "'" << std::endl; -#else - (void)Name; -#endif } void MusicBrainz5::CUserTag::ParseElement(const XMLNode& Node) @@ -94,9 +90,7 @@ void MusicBrainz5::CUserTag::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised UserTag element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/UserTag.cc.silence-warnings b/src/UserTag.cc.silence-warnings deleted file mode 100644 index 157a31f..0000000 --- a/src/UserTag.cc.silence-warnings +++ /dev/null @@ -1,116 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/UserTag.h" - -class MusicBrainz5::CUserTagPrivate -{ - public: - std::string m_Name; -}; - -MusicBrainz5::CUserTag::CUserTag(const XMLNode& Node) -: CEntity(), - m_d(new CUserTagPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "UserTag node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CUserTag::CUserTag(const CUserTag& Other) -: CEntity(), - m_d(new CUserTagPrivate) -{ - *this=Other; -} - -MusicBrainz5::CUserTag& MusicBrainz5::CUserTag::operator =(const CUserTag& Other) -{ - if (this!=&Other) - { - CEntity::operator =(Other); - - m_d->m_Name=Other.m_d->m_Name; - } - - return *this; -} - -MusicBrainz5::CUserTag::~CUserTag() -{ - delete m_d; -} - -MusicBrainz5::CUserTag *MusicBrainz5::CUserTag::Clone() -{ - return new CUserTag(*this); -} - -void MusicBrainz5::CUserTag::ParseAttribute(const std::string& Name, const std::string& /*Value*/) -{ - std::cerr << "Unrecognised usertag attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CUserTag::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("name"==NodeName) - { - ProcessItem(Node,m_d->m_Name); - } - else - { - std::cerr << "Unrecognised UserTag element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CUserTag::GetElementName() -{ - return "user-tag"; -} - -std::string MusicBrainz5::CUserTag::Name() const -{ - return m_d->m_Name; -} - -std::ostream& MusicBrainz5::CUserTag::Serialise(std::ostream& os) const -{ - os << "UserTag:" << std::endl; - - CEntity::Serialise(os); - - os << "\tName: " << Name() << std::endl; - - return os; -} diff --git a/src/Work.cc b/src/Work.cc index df4ca13..3dd8683 100644 --- a/src/Work.cc +++ b/src/Work.cc @@ -181,11 +181,7 @@ void MusicBrainz5::CWork::ParseAttribute(const std::string& Name, const std::str else if ("type"==Name) m_d->m_Type=Value; else - { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised work attribute: '" << Name << "'" << std::endl; -#endif - } } void MusicBrainz5::CWork::ParseElement(const XMLNode& Node) @@ -238,9 +234,7 @@ void MusicBrainz5::CWork::ParseElement(const XMLNode& Node) } else { -#ifdef _MB5_DEBUG_ std::cerr << "Unrecognised work element: '" << NodeName << "'" << std::endl; -#endif } } diff --git a/src/Work.cc.silence-warnings b/src/Work.cc.silence-warnings deleted file mode 100644 index 3dd8683..0000000 --- a/src/Work.cc.silence-warnings +++ /dev/null @@ -1,351 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include "config.h" -#include "musicbrainz5/defines.h" - -#include "musicbrainz5/Work.h" - -#include "musicbrainz5/ArtistCredit.h" -#include "musicbrainz5/AliasList.h" -#include "musicbrainz5/Alias.h" -#include "musicbrainz5/RelationList.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/TagList.h" -#include "musicbrainz5/Tag.h" -#include "musicbrainz5/UserTagList.h" -#include "musicbrainz5/UserTag.h" -#include "musicbrainz5/Rating.h" -#include "musicbrainz5/UserRating.h" -#include "musicbrainz5/ISWC.h" -#include "musicbrainz5/ISWCList.h" - -class MusicBrainz5::CWorkPrivate -{ - public: - CWorkPrivate() - : m_ArtistCredit(0), - m_ISWCList(0), - m_AliasList(0), - m_RelationListList(0), - m_TagList(0), - m_UserTagList(0), - m_Rating(0), - m_UserRating(0) - { - } - - std::string m_ID; - std::string m_Type; - std::string m_Title; - CArtistCredit *m_ArtistCredit; - CISWCList *m_ISWCList; - std::string m_Disambiguation; - CAliasList *m_AliasList; - CRelationListList *m_RelationListList; - CTagList *m_TagList; - CUserTagList *m_UserTagList; - CRating *m_Rating; - CUserRating *m_UserRating; - std::string m_Language; -}; - -MusicBrainz5::CWork::CWork(const XMLNode& Node) -: CEntity(), - m_d(new CWorkPrivate) -{ - if (!Node.isEmpty()) - { - //std::cout << "Work node: " << std::endl << Node.createXMLString(true) << std::endl; - - Parse(Node); - } -} - -MusicBrainz5::CWork::CWork(const CWork& Other) -: CEntity(), - m_d(new CWorkPrivate) -{ - *this=Other; -} - -MusicBrainz5::CWork& MusicBrainz5::CWork::operator =(const CWork& Other) -{ - if (this!=&Other) - { - Cleanup(); - - CEntity::operator =(Other); - - m_d->m_ID=Other.m_d->m_ID; - m_d->m_Type=Other.m_d->m_Type; - m_d->m_Title=Other.m_d->m_Title; - - if (Other.m_d->m_ArtistCredit) - m_d->m_ArtistCredit=new CArtistCredit(*Other.m_d->m_ArtistCredit); - - if (Other.m_d->m_ISWCList) - m_d->m_ISWCList=new CISWCList(*Other.m_d->m_ISWCList); - - m_d->m_Disambiguation=Other.m_d->m_Disambiguation; - - if (Other.m_d->m_AliasList) - m_d->m_AliasList=new CAliasList(*Other.m_d->m_AliasList); - - if (Other.m_d->m_RelationListList) - m_d->m_RelationListList=new CRelationListList(*Other.m_d->m_RelationListList); - - if (Other.m_d->m_TagList) - m_d->m_TagList=new CTagList(*Other.m_d->m_TagList); - - if (Other.m_d->m_UserTagList) - m_d->m_UserTagList=new CUserTagList(*Other.m_d->m_UserTagList); - - if (Other.m_d->m_Rating) - m_d->m_Rating=new CRating(*Other.m_d->m_Rating); - - if (Other.m_d->m_UserRating) - m_d->m_UserRating=new CUserRating(*Other.m_d->m_UserRating); - - m_d->m_Language=Other.m_d->m_Language; - } - - return *this; -} - -MusicBrainz5::CWork::~CWork() -{ - Cleanup(); - - delete m_d; -} - -void MusicBrainz5::CWork::Cleanup() -{ - delete m_d->m_ArtistCredit; - m_d->m_ArtistCredit=0; - - delete m_d->m_ISWCList; - m_d->m_ISWCList=0; - - delete m_d->m_AliasList; - m_d->m_AliasList=0; - - delete m_d->m_RelationListList; - m_d->m_RelationListList=0; - - delete m_d->m_TagList; - m_d->m_TagList=0; - - delete m_d->m_UserTagList; - m_d->m_UserTagList=0; - - delete m_d->m_Rating; - m_d->m_Rating=0; - - delete m_d->m_UserRating; - m_d->m_UserRating=0; -} - -MusicBrainz5::CWork *MusicBrainz5::CWork::Clone() -{ - return new CWork(*this); -} - -void MusicBrainz5::CWork::ParseAttribute(const std::string& Name, const std::string& Value) -{ - if ("id"==Name) - m_d->m_ID=Value; - else if ("type"==Name) - m_d->m_Type=Value; - else - std::cerr << "Unrecognised work attribute: '" << Name << "'" << std::endl; -} - -void MusicBrainz5::CWork::ParseElement(const XMLNode& Node) -{ - std::string NodeName=Node.getName(); - - if ("title"==NodeName) - { - ProcessItem(Node,m_d->m_Title); - } - else if ("artist-credit"==NodeName) - { - ProcessItem(Node,m_d->m_ArtistCredit); - } - else if ("iswc-list"==NodeName) - { - ProcessItem(Node,m_d->m_ISWCList); - } - else if ("disambiguation"==NodeName) - { - ProcessItem(Node,m_d->m_Disambiguation); - } - else if ("alias-list"==NodeName) - { - ProcessItem(Node,m_d->m_AliasList); - } - else if ("relation-list"==NodeName) - { - ProcessRelationList(Node,m_d->m_RelationListList); - } - else if ("tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_TagList); - } - else if ("user-tag-list"==NodeName) - { - ProcessItem(Node,m_d->m_UserTagList); - } - else if ("rating"==NodeName) - { - ProcessItem(Node,m_d->m_Rating); - } - else if ("user-rating"==NodeName) - { - ProcessItem(Node,m_d->m_UserRating); - } - else if ("language"==NodeName) - { - ProcessItem(Node,m_d->m_Language); - } - else - { - std::cerr << "Unrecognised work element: '" << NodeName << "'" << std::endl; - } -} - -std::string MusicBrainz5::CWork::GetElementName() -{ - return "work"; -} - -std::string MusicBrainz5::CWork::ID() const -{ - return m_d->m_ID; -} - -std::string MusicBrainz5::CWork::Type() const -{ - return m_d->m_Type; -} - -std::string MusicBrainz5::CWork::Title() const -{ - return m_d->m_Title; -} - -MusicBrainz5::CArtistCredit *MusicBrainz5::CWork::ArtistCredit() const -{ - return m_d->m_ArtistCredit; -} - -MusicBrainz5::CISWCList *MusicBrainz5::CWork::ISWCList() const -{ - return m_d->m_ISWCList; -} - -std::string MusicBrainz5::CWork::Disambiguation() const -{ - return m_d->m_Disambiguation; -} - -MusicBrainz5::CAliasList *MusicBrainz5::CWork::AliasList() const -{ - return m_d->m_AliasList; -} - -MusicBrainz5::CRelationListList *MusicBrainz5::CWork::RelationListList() const -{ - return m_d->m_RelationListList; -} - -MusicBrainz5::CTagList *MusicBrainz5::CWork::TagList() const -{ - return m_d->m_TagList; -} - -MusicBrainz5::CUserTagList *MusicBrainz5::CWork::UserTagList() const -{ - return m_d->m_UserTagList; -} - -MusicBrainz5::CRating *MusicBrainz5::CWork::Rating() const -{ - return m_d->m_Rating; -} - -MusicBrainz5::CUserRating *MusicBrainz5::CWork::UserRating() const -{ - return m_d->m_UserRating; -} - -std::string MusicBrainz5::CWork::Language() const -{ - return m_d->m_Language; -} - -std::ostream& MusicBrainz5::CWork::Serialise(std::ostream& os) const -{ - os << "Work:" << std::endl; - - CEntity::Serialise(os); - - os << "\tID: " << ID() << std::endl; - os << "\tWork: " << Type() << std::endl; - os << "\tTitle: " << Title() << std::endl; - - if (ArtistCredit()) - os << *ArtistCredit() << std::endl; - - if (ISWCList()) - os << *ISWCList() << std::endl; - - os << "\tDisambiguation: " << Disambiguation() << std::endl; - - if (AliasList()) - os << *AliasList() << std::endl; - - if (RelationListList()) - os << *RelationListList() << std::endl; - - if (TagList()) - os << *TagList() << std::endl; - - if (UserTagList()) - os << *UserTagList() << std::endl; - - if (Rating()) - os << *Rating() << std::endl; - - if (UserRating()) - os << *UserRating() << std::endl; - - os << "\tLanguage: " << Language() << std::endl; - - return os; -} - diff --git a/tests/mbtest.cc b/tests/mbtest.cc index 8725d11..99b9258 100644 --- a/tests/mbtest.cc +++ b/tests/mbtest.cc @@ -66,7 +66,7 @@ void PrintRelationList(MusicBrainz5::CRelationList *RelationList) int main(int argc, const char *argv[]) { - MusicBrainz5::CQuery MB2("MBTest/v1.0","musicbrainz.org"); + MusicBrainz5::CQuery MB2("MBTest/v1.0","test.musicbrainz.org"); MusicBrainz5::CQuery::tParamMap Params5; Params5["inc"]="aliases"; @@ -83,11 +83,11 @@ int main(int argc, const char *argv[]) } } -// return 0; + return 0; MusicBrainz5::CMetadata Metadata8=MB2.Query("release-group","2eefe885-f050-426d-93f0-29c5eb8b4f9a"); std::cout << Metadata8 << std::endl; -// return 0; + return 0; MusicBrainz5::CMetadata Metadata7=MB2.Query("artist","4b585938-f271-45e2-b19a-91c634b5e396"); Artist=Metadata7.Artist(); @@ -107,7 +107,7 @@ int main(int argc, const char *argv[]) } } -// return 0; + return 0; MusicBrainz5::CMetadata Metadata6=MB2.Query("release-group","2eefe885-f050-426d-93f0-29c5eb8b4f9a"); MusicBrainz5::CReleaseGroup *ReleaseGroup=Metadata6.ReleaseGroup(); @@ -133,7 +133,7 @@ int main(int argc, const char *argv[]) } } -// return 0; + return 0; MusicBrainz5::CMetadata Metadata4=MB2.Query("work","b0d17375-5593-390e-a936-1a65ce74c630"); @@ -192,7 +192,7 @@ int main(int argc, const char *argv[]) } } -// return 0; + return 0; MusicBrainz5::CQuery MB("MBTest/v1.0"); @@ -222,7 +222,7 @@ int main(int argc, const char *argv[]) } } -// return 0; + return 0; MusicBrainz5::CQuery::tParamMap Params; Params["inc"]="artists labels recordings release-groups url-rels discids recording-level-rels work-level-rels work-rels artist-rels"; @@ -271,7 +271,7 @@ int main(int argc, const char *argv[]) } } -// return 0; + return 0; MusicBrainz5::CMetadata Metadata=MB.Query("collection"); MusicBrainz5::CCollectionList *CollectionList=Metadata.CollectionList(); @@ -298,7 +298,7 @@ int main(int argc, const char *argv[]) MB.Query("collection",Collection->ID(),"releases"); } -// return 0; + return 0; std::string DiscID="arIS30RPWowvwNEqsqdDnZzDGhk-"; diff --git a/tests/mbtest.cc.silence-warnings b/tests/mbtest.cc.silence-warnings deleted file mode 100644 index 99b9258..0000000 --- a/tests/mbtest.cc.silence-warnings +++ /dev/null @@ -1,337 +0,0 @@ -/* -------------------------------------------------------------------------- - - libmusicbrainz5 - Client library to access MusicBrainz - - Copyright (C) 2012 Andrew Hawkins - - This file is part of libmusicbrainz5. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - libmusicbrainz5 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this library. If not, see . - - $Id$ - -----------------------------------------------------------------------------*/ - -#include - -#include - -#include "musicbrainz5/Query.h" -#include "musicbrainz5/Release.h" -#include "musicbrainz5/ReleaseGroup.h" -#include "musicbrainz5/Medium.h" -#include "musicbrainz5/MediumList.h" -#include "musicbrainz5/NameCredit.h" -#include "musicbrainz5/ArtistCredit.h" -#include "musicbrainz5/Artist.h" -#include "musicbrainz5/Alias.h" -#include "musicbrainz5/HTTPFetch.h" -#include "musicbrainz5/Track.h" -#include "musicbrainz5/Recording.h" -#include "musicbrainz5/Collection.h" -#include "musicbrainz5/CollectionList.h" -#include "musicbrainz5/RelationListList.h" -#include "musicbrainz5/RelationList.h" -#include "musicbrainz5/Relation.h" -#include "musicbrainz5/Work.h" -#include "musicbrainz5/ISWC.h" -#include "musicbrainz5/ISWCList.h" -#include "musicbrainz5/SecondaryType.h" -#include "musicbrainz5/SecondaryTypeList.h" -#include "musicbrainz5/IPI.h" -#include "musicbrainz5/IPIList.h" -#include "musicbrainz5/Lifespan.h" - -void PrintRelationList(MusicBrainz5::CRelationList *RelationList) -{ - std::cout << "Target type: '" << RelationList->TargetType() << "'" << std::endl; - - for (int count=0;countNumItems();count++) - { - MusicBrainz5::CRelation *Relation=RelationList->Item(count); - std::cout << "Relation: " << count << " - Type '" << Relation->Type() << "', Target '" << Relation->Target() << "'" << std::endl; - } -} - -int main(int argc, const char *argv[]) -{ - MusicBrainz5::CQuery MB2("MBTest/v1.0","test.musicbrainz.org"); - - MusicBrainz5::CQuery::tParamMap Params5; - Params5["inc"]="aliases"; - MusicBrainz5::CMetadata Metadata5=MB2.Query("artist","4b585938-f271-45e2-b19a-91c634b5e396","",Params5); - MusicBrainz5::CArtist *Artist=Metadata5.Artist(); - if (Artist) - { - MusicBrainz5::CLifespan *Lifespan=Artist->Lifespan(); - if (Lifespan) - { - std::cout << "Begin: " << Lifespan->Begin() << std::endl; - std::cout << "End: " << Lifespan->End() << std::endl; - std::cout << "Ended: " << Lifespan->Ended() << std::endl; - } - } - - return 0; - - MusicBrainz5::CMetadata Metadata8=MB2.Query("release-group","2eefe885-f050-426d-93f0-29c5eb8b4f9a"); - std::cout << Metadata8 << std::endl; - return 0; - - MusicBrainz5::CMetadata Metadata7=MB2.Query("artist","4b585938-f271-45e2-b19a-91c634b5e396"); - Artist=Metadata7.Artist(); - if (Artist) - { - MusicBrainz5::CIPIList *IPIList=Artist->IPIList(); - if (IPIList) - { - for (int count=0;countNumItems();count++) - { - MusicBrainz5::CIPI *IPI=IPIList->Item(count); - if (IPI) - { - std::cout << "IPI " << count << ": " << IPI->IPI() << std::endl; - } - } - } - } - - return 0; - - MusicBrainz5::CMetadata Metadata6=MB2.Query("release-group","2eefe885-f050-426d-93f0-29c5eb8b4f9a"); - MusicBrainz5::CReleaseGroup *ReleaseGroup=Metadata6.ReleaseGroup(); - if (ReleaseGroup) - { - std::cout << "ID: " << ReleaseGroup->ID() << std::endl; - std::cout << "PrimaryType: " << ReleaseGroup->PrimaryType() << std::endl; - std::cout << "Title: " << ReleaseGroup->Title() << std::endl; - std::cout << "Disambiguation: " << ReleaseGroup->Disambiguation() << std::endl; - std::cout << "FirstReleaseDate: " << ReleaseGroup->FirstReleaseDate() << std::endl; - - MusicBrainz5::CSecondaryTypeList *SecondaryTypeList=ReleaseGroup->SecondaryTypeList(); - if (SecondaryTypeList) - { - for (int count=0;countNumItems();count++) - { - MusicBrainz5::CSecondaryType *SecondaryType=SecondaryTypeList->Item(count); - if (SecondaryType) - { - std::cout << "Secondary type " << count << " = " << SecondaryType->SecondaryType() << std::endl; - } - } - } - } - - return 0; - - MusicBrainz5::CMetadata Metadata4=MB2.Query("work","b0d17375-5593-390e-a936-1a65ce74c630"); - - MusicBrainz5::CWork *ThisWork=Metadata4.Work(); - if (ThisWork) - { - std::cout << "ID: '" << ThisWork->ID() << "'" << std::endl; - std::cout << "Title: '" << ThisWork->Title() << "'" << std::endl; - - MusicBrainz5::CISWCList *ISWCList=ThisWork->ISWCList(); - if (ISWCList) - { - for (int count=0;countNumItems();count++) - { - MusicBrainz5::CISWC *ISWC=ISWCList->Item(count); - std::cout << "ISWC " << count << " - '" << ISWC->ISWC() << "'" << std::endl; - } - } - - std::cout << "Disambiguation: '" << ThisWork->Disambiguation() << "'" << std::endl; - std::cout << "Language: '" << ThisWork->Language() << "'" << std::endl; - } - - MusicBrainz5::CQuery::tParamMap Params3; - Params3["inc"]="media recordings"; - - Metadata4=MB2.Query("release","ae050d13-7f86-495e-9918-10d8c0ac58e8","",Params3); - MusicBrainz5::CRelease *Release2=Metadata4.Release(); - if (Release2) - { - MusicBrainz5::CMediumList *MediumList=Release2->MediumList(); - if (MediumList) - { - for (int count=0;countNumItems();count++) - { - MusicBrainz5::CMedium *Medium=MediumList->Item(count); - if (Medium) - { - MusicBrainz5::CTrackList *TrackList=Medium->TrackList(); - if (TrackList) - { - for (int track=0;trackNumItems();track++) - { - MusicBrainz5::CTrack *Track=TrackList->Item(track); - if (Track) - { - std::cout << "Position: " << Track->Position() << std::endl; - std::cout << "Title: " << Track->Title() << std::endl; - std::cout << "Length: " << Track->Length() << std::endl; - std::cout << "Number: " << Track->Number() << std::endl; - } - } - } - } - } - } - } - - return 0; - - MusicBrainz5::CQuery MB("MBTest/v1.0"); - - if (argc>1) - { - std::cout << "Setting username: '" << argv[1] << "'" << std::endl; - MB.SetUserName(argv[1]); - } - - if (argc>2) - { - std::cout << "Setting password: '" << argv[2] << "'" << std::endl; - MB.SetPassword(argv[2]); - } - - MusicBrainz5::CQuery::tParamMap Params2; - Params2["inc"]="artists release-groups url-rels work-level-rels work-rels artist-rels"; - MusicBrainz5::CMetadata Metadata3=MB.Query("recording","3631f569-520d-40ff-a1ee-076604723275","",Params2); - MusicBrainz5::CRecording *Recording=Metadata3.Recording(); - if (Recording) - { - MusicBrainz5::CRelationListList *RelationListList=Recording->RelationListList(); - for (int count=0;countNumItems();count++) - { - MusicBrainz5::CRelationList *RelationList=RelationListList->Item(count); - PrintRelationList(RelationList); - } - } - - return 0; - - MusicBrainz5::CQuery::tParamMap Params; - Params["inc"]="artists labels recordings release-groups url-rels discids recording-level-rels work-level-rels work-rels artist-rels"; - - MusicBrainz5::CMetadata Metadata2=MB.Query("release","ef4596f0-5554-443a-aea9-247d2e250f61","",Params); - - MusicBrainz5::CRelease *Release=Metadata2.Release(); - if (Release) - { - MusicBrainz5::CMediumList *MediumList=Release->MediumList(); - - if (MediumList) - { - for (int MediumNum=0;MediumNumNumItems();MediumNum++) - { - MusicBrainz5::CMedium *Medium=MediumList->Item(MediumNum); - if (Medium) - { - MusicBrainz5::CTrackList *TrackList=Medium->TrackList(); - if (TrackList) - { - for (int TrackNum=0;TrackNumNumItems();TrackNum++) - { - MusicBrainz5::CTrack *Track=TrackList->Item(TrackNum); - if (Track) - { - MusicBrainz5::CRecording *Recording=Track->Recording(); - if (Recording) - { - MusicBrainz5::CRelationListList *RelationListList=Recording->RelationListList(); - if (RelationListList) - { - std::cout << RelationListList->NumItems() << " items" << std::endl; - for (int RelationListNum=0;RelationListNumNumItems();RelationListNum++) - { - MusicBrainz5::CRelationList *RelationList=RelationListList->Item(RelationListNum); - PrintRelationList(RelationList); - } - } - } - } - } - } - } - } - } - } - - return 0; - - MusicBrainz5::CMetadata Metadata=MB.Query("collection"); - MusicBrainz5::CCollectionList *CollectionList=Metadata.CollectionList(); - if (CollectionList && 0!=CollectionList->NumItems()) - { - MusicBrainz5::CCollection *Collection=CollectionList->Item(0); - std::cout << "ID is " << Collection->ID() << std::endl; - - MB.Query("collection",Collection->ID(),"releases"); - - std::vector Releases; - Releases.push_back("b5748ac9-f38e-48f7-a8a4-8b43cab025bc"); - Releases.push_back("f6335672-c521-4129-86c3-490d20533e08"); - bool Ret=MB.AddCollectionEntries(Collection->ID(),Releases); - std::cout << "AddCollectionEntries returns " << std::boolalpha << Ret << std::endl; - - MB.Query("collection",Collection->ID(),"releases"); - - Releases.clear(); - Releases.push_back("b5748ac9-f38e-48f7-a8a4-8b43cab025bc"); - Ret=MB.DeleteCollectionEntries(Collection->ID(),Releases); - std::cout << "DeleteCollectionEntries returns " << std::boolalpha << Ret << std::endl; - - MB.Query("collection",Collection->ID(),"releases"); - } - - return 0; - - std::string DiscID="arIS30RPWowvwNEqsqdDnZzDGhk-"; - - if (argc==2) - DiscID=argv[1]; - - MusicBrainz5::CReleaseList ReleaseList=MB.LookupDiscID(DiscID); - - for (int count=0;countID()); - - std::cout << "Full release: " << std::endl; - - std::cout << FullRelease << std::endl; - - std::cout << "Release group title: '" << FullRelease.ReleaseGroup()->Title() << "'" << std::endl; - - std::cout << std::endl << std::endl << "Media matching " << DiscID << ":" << std::endl; - - MusicBrainz5::CMediumList MediaList=FullRelease.MediaMatchingDiscID(DiscID); - - for (int count=0;count