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: ListImpl.h 13259 2011-08-10 12:02:50Z adhawkins $
23
----------------------------------------------------------------------------*/
25
#ifndef _MUSICBRAINZ4_LIST_IMPL_H
26
#define _MUSICBRAINZ4_LIST_IMPL_H
28
#include "musicbrainz4/List.h"
30
namespace MusicBrainz4
33
class CListImpl: public CList
36
CListImpl(const XMLNode& Node=XMLNode::emptyNode())
41
//std::cout << T::GetElementName() << " List node: " << std::endl << Node.createXMLString(true) << std::endl;
47
CListImpl(const CListImpl<T>& Other)
53
MusicBrainz4::CListImpl<T>& operator =(const CListImpl<T>& Other)
57
CList::operator =(Other);
69
return new CListImpl<T>(*this);
72
virtual std::ostream& Serialise(std::ostream& os) const
74
os << T::GetElementName() << " List (impl):" << std::endl;
78
for (int count=0;count<NumItems();count++)
80
T *ThisItem=Item(count);
82
os << *ThisItem << std::endl;
88
static std::string GetElementName()
93
T *Item(int Item) const
95
return dynamic_cast<T *>(CList::Item(Item));
100
CList::AddItem(Item);
104
bool ParseElement(const XMLNode& Node)
108
std::string NodeName=Node.getName();
110
if (T::GetElementName()==NodeName)
114
RetVal=ProcessItem(Node,Item);
119
RetVal=CList::ParseElement(Node);