+/*
+ * Copyright (C) 2009 Sakari Poussa
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ */
+
#include "data.h"
////////////////////////////////////////////////////////////////////////
void Score::dump()
{
- qDebug() << club << " " << course << " " << date ;
+ qDebug() << club << course << date ;
for (int i=0; i<holeList.size(); i++)
holeList.at(i)->dump();
}
name = attrs.value("name");
}
-Course::Course(const QDomElement node) {
- name = node.attribute("name", "");
+Course::Course(const QDomElement node, Club * parent)
+ : club(parent)
+{
+ name = node.attribute("name", "");
}
Course::Course(QString &name,
}
}
+Club * Course::parent()
+{
+ return club;
+}
+
+void Course::setParent(Club *parent)
+{
+ club = parent;
+}
+
QDomElement Course::toElement(QDomDocument doc)
{
QDomElement node = doc.createElement("course");
QVector<QString> &hcp,
QVector<QString> &len)
{
+ Q_UNUSED(len);
for (int i = 0; i < par.size(); i++) {
Hole *hole = holeList.at(i);
if (hole->getPar() != par[i])
void Club::addCourse(Course *iCourse) {
courseList << iCourse;
+ iCourse->setParent(this);
+}
+
+void Club::delCourse(Course * course) {
+ int index = courseList.indexOf(course);
+
+ if (index != -1)
+ courseList.removeAt(index);
+}
+
+bool Club::isEmpty()
+{
+ bool rc = false;
+ if (courseList.count() == 0)
+ rc = true;
+ return rc;
}
QDomElement Club::toElement(QDomDocument doc)