1
/* --------------------------------------------------------------------------
3
libmusicbrainz5 - Client library to access MusicBrainz
5
Copyright (C) 2012 Andrew Hawkins
7
This file is part of libmusicbrainz5.
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of v2 of the GNU Lesser General Public
11
License as published by the Free Software Foundation.
13
libmusicbrainz5 is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this library. If not, see <http://www.gnu.org/licenses/>.
23
----------------------------------------------------------------------------*/
26
#include "musicbrainz5/defines.h"
28
#include "musicbrainz5/Rating.h"
30
class MusicBrainz5::CRatingPrivate
43
MusicBrainz5::CRating::CRating(const XMLNode& Node)
45
m_d(new CRatingPrivate)
49
//std::cout << "Rating node: " << std::endl << Node.createXMLString(true) << std::endl;
55
ProcessItem(Node,m_d->m_Rating);
60
MusicBrainz5::CRating::CRating(const CRating& Other)
62
m_d(new CRatingPrivate)
67
MusicBrainz5::CRating& MusicBrainz5::CRating::operator =(const CRating& Other)
71
CEntity::operator =(Other);
73
m_d->m_VotesCount=Other.m_d->m_VotesCount;
74
m_d->m_Rating=Other.m_d->m_Rating;
80
MusicBrainz5::CRating::~CRating()
85
MusicBrainz5::CRating *MusicBrainz5::CRating::Clone()
87
return new CRating(*this);
90
void MusicBrainz5::CRating::ParseAttribute(const std::string& Name, const std::string& Value)
92
if ("votes-count"==Name)
94
ProcessItem(Value,m_d->m_VotesCount);
98
std::cerr << "Unrecognised rating attribute: '" << Name << "'" << std::endl;
102
void MusicBrainz5::CRating::ParseElement(const XMLNode& Node)
104
std::string NodeName=Node.getName();
106
std::cerr << "Unrecognised rating attribute: '" << NodeName << "'" << std::endl;
109
std::string MusicBrainz5::CRating::GetElementName()
114
int MusicBrainz5::CRating::VotesCount() const
116
return m_d->m_VotesCount;
119
double MusicBrainz5::CRating::Rating() const
121
return m_d->m_Rating;
124
std::ostream& MusicBrainz5::CRating::Serialise(std::ostream& os) const
126
os << "Rating:" << std::endl;
128
CEntity::Serialise(os);
130
os << "\tVotes count: " << VotesCount() << std::endl;
131
os << "\tRating: " << Rating() << std::endl;