2 * Copyright (C) 2009 Sakari Poussa
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 2.
10 #define __SCORE_DATA_H
14 #include <QXmlAttributes>
15 #include <QDomElement>
16 #include <QDomDocument>
18 enum { TotalOut, TotalIn, Total };
23 Hole(const QXmlAttributes &attrs);
24 Hole(const QDomElement node);
25 Hole(int num, QString &shots);
26 Hole(int num, QString &par, QString &hcp);
27 QDomElement toElement(QDomDocument doc);
29 void setShots(QString& shots);
31 void setHcp(QString& shots);
33 void setPar(QString& shots);
37 QString num, shots, putts, hcp, length, par;
42 Score(const QXmlAttributes &attrs);
43 Score(QString &iClub, QString &iCourse, QString &iDate);
44 Score(const QDomElement node);
45 Score(QVector<QString> scores, QString &club, QString &course, QString &date);
47 bool operator< (const Score& val) const
49 return date < val.getDate();
52 bool operator> (const Score& val) const
54 return date > val.getDate();
57 QDomElement toElement(QDomDocument doc);
58 int update(QVector<QString> &scores);
59 void addHole(Hole *iHole);
60 QString getScore(int i) const;
61 QString getTotal(int what) const;
62 const QString& getClubName() const;
63 const QString& getCourseName() const;
64 const QString& getDate() const;
68 QList <Hole *> holeList;
69 QString club, course, date;
76 Course(const QXmlAttributes &attrs);
77 Course(const QDomElement node, Club * parent = 0);
78 Course(QString &name, QVector<QString> &, QVector<QString> &);
79 QDomElement toElement(QDomDocument doc);
80 int update(QVector<QString> &, QVector<QString> &, QVector<QString> &);
81 void addHole(Hole *iHole);
82 QString getPar(int i);
83 QString getHcp(int i);
85 QString getTotal(int what);
88 void setParent(Club *parent);
91 QList <Hole *> holeList;
98 Club(const QXmlAttributes &attrs, bool readOnly = false);
99 Club(const QDomElement node, bool readOnly = false);
100 Club(QString &name, bool readOnly = false);
102 QDomElement toElement(QDomDocument doc);
103 void addCourse(Course *iCourse);
104 void delCourse(Course *iCourse);
107 Course *getCourse(int pos);
108 Course *getCourse(const QString &courseName);
111 void setHomeClub(bool value) { m_homeClub = value; }
112 bool isHomeClub() { return m_homeClub; }
114 QList <Course *> getCourseList() { return courseList; } // HACK: fixme
119 QList <Course *> courseList;