1 /*
2     This file is part of KDE Schema Parser.
3 
4     Copyright (c) 2013 David Faure <david.faure@kdab.com>
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU Lesser General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     GNU Lesser General Public License for more details.
15 
16     You should have received a copy of the GNU Lesser General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20 
21 #include "group.h"
22 
23 namespace XSD
24 {
25 
26 class Group::Private
27 {
28 public:
29     QName mReference;
30     Element::List mElements;
31 };
32 
Group()33 Group::Group()
34     : XmlElement(), d(new Private)
35 {
36 }
37 
Group(const Group & other)38 Group::Group(const Group &other)
39     : XmlElement(other), d(new Private)
40 {
41     *d = *other.d;
42 }
43 
~Group()44 Group::~Group()
45 {
46     delete d;
47 }
48 
operator =(const Group & other)49 Group &Group::operator=(const Group &other)
50 {
51     if (this == &other) {
52         return *this;
53     }
54 
55     *d = *other.d;
56 
57     return *this;
58 }
59 
setReference(const QName & reference)60 void Group::setReference(const QName &reference)
61 {
62     d->mReference = reference;
63 }
64 
reference() const65 QName Group::reference() const
66 {
67     return d->mReference;
68 }
69 
setElements(const Element::List & elements)70 void Group::setElements(const Element::List &elements)
71 {
72     d->mElements = elements;
73 }
74 
elements() const75 Element::List Group::elements() const
76 {
77     return d->mElements;
78 }
79 
isResolved() const80 bool Group::isResolved() const
81 {
82     return !d->mElements.isEmpty() || d->mReference.isEmpty();
83 }
84 
85 }
86 
operator <<(QDebug dbg,const XSD::Group & group)87 QDebug operator<<(QDebug dbg, const XSD::Group &group)
88 {
89     dbg << group.qualifiedName();
90     return dbg;
91 }
92