1
/* --------------------------------------------------------------------------
3
libmusicbrainz4 - Client library to access MusicBrainz
5
Copyright (C) 2011 Andrew Hawkins
7
This file is part of libmusicbrainz4.
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
libmusicbrainz4 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/>.
21
$Id: TextRepresentation.cc 13254 2011-08-09 09:29:20Z adhawkins $
23
----------------------------------------------------------------------------*/
25
#include "musicbrainz4/TextRepresentation.h"
27
class MusicBrainz4::CTextRepresentationPrivate
30
std::string m_Language;
34
MusicBrainz4::CTextRepresentation::CTextRepresentation(const XMLNode& Node)
36
m_d(new CTextRepresentationPrivate)
40
//std::cout << "Text representation node: " << std::endl << Node.createXMLString(true) << std::endl;
46
MusicBrainz4::CTextRepresentation::CTextRepresentation(const CTextRepresentation& Other)
48
m_d(new CTextRepresentationPrivate)
53
MusicBrainz4::CTextRepresentation& MusicBrainz4::CTextRepresentation::operator =(const CTextRepresentation& Other)
57
CEntity::operator =(Other);
59
m_d->m_Language=Other.m_d->m_Language;
60
m_d->m_Script=Other.m_d->m_Script;
66
MusicBrainz4::CTextRepresentation::~CTextRepresentation()
71
MusicBrainz4::CTextRepresentation *MusicBrainz4::CTextRepresentation::Clone()
73
return new CTextRepresentation(*this);
76
bool MusicBrainz4::CTextRepresentation::ParseAttribute(const std::string& Name, const std::string& /*Value*/)
80
std::cerr << "Unrecognised textrepresentation attribute: '" << Name << "'" << std::endl;
86
bool MusicBrainz4::CTextRepresentation::ParseElement(const XMLNode& Node)
90
std::string NodeName=Node.getName();
92
if ("language"==NodeName)
94
RetVal=ProcessItem(Node,m_d->m_Language);
96
else if ("script"==NodeName)
98
RetVal=ProcessItem(Node,m_d->m_Script);
102
std::cerr << "Unrecognised textrepresentation element: '" << NodeName << "'" << std::endl;
109
std::string MusicBrainz4::CTextRepresentation::GetElementName()
111
return "text-representation";
114
std::string MusicBrainz4::CTextRepresentation::Language() const
116
return m_d->m_Language;
119
std::string MusicBrainz4::CTextRepresentation::Script() const
121
return m_d->m_Script;
124
std::ostream& MusicBrainz4::CTextRepresentation::Serialise(std::ostream& os) const
126
os << "\tText Representation:" << std::endl;
128
CEntity::Serialise(os);
130
os << "\t\tLanguage: " << Language() << std::endl;
131
os << "\t\tScript: " << Script() << std::endl;