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;
43 Score(const QXmlAttributes &attrs);
44 Score(QString &iClub, QString &iCourse, QString &iDate);
45 Score(const QDomElement node);
46 Score(QVector<QString> scores, QString &club, QString &course, QString &date);
48 bool operator< (const Score& val) const
50 return date < val.getDate();
53 bool operator> (const Score& val) const
55 return date > val.getDate();
58 QDomElement toElement(QDomDocument doc);
59 int update(QVector<QString> &scores);
60 void addHole(Hole *iHole);
61 QString getScore(int i) const;
62 QString getTotal(int what) const;
63 const QString& getClubName() const;
64 const QString& getCourseName() const;
65 const QString& getDate() const;
69 QList <Hole *> holeList;
70 QString club, course, date;
77 Course(const QXmlAttributes &attrs);
78 Course(const QDomElement node, Club * parent = 0);
79 Course(QString &name, QVector<QString> &, QVector<QString> &);
80 QDomElement toElement(QDomDocument doc);
81 int update(QVector<QString> &, QVector<QString> &, QVector<QString> &);
82 void addHole(Hole *iHole);
83 QString getPar(int i);
84 QString getHcp(int i);
86 QString getTotal(int what);
89 void setParent(Club *parent);
92 QList <Hole *> holeList;
100 Club(const QXmlAttributes &attrs);
101 Club(const QDomElement node);
104 QDomElement toElement(QDomDocument doc);
105 void addCourse(Course *iCourse);
106 void delCourse(Course *iCourse);
109 Course *getCourse(int pos);
110 Course *getCourse(const QString &courseName);
113 QList <Course *> getCourseList() { return courseList; } // HACK: fixme
116 QList <Course *> courseList;