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 QDomElement toElement(QDomDocument doc);
54 int update(QVector<QString> &scores);
55 void addHole(Hole *iHole);
56 QString getScore(int i) const;
57 QString getTotal(int what) const;
58 const QString& getClubName() const;
59 const QString& getCourseName() const;
60 const QString& getDate() const;
64 QList <Hole *> holeList;
65 QString club, course, date;
70 Course(const QXmlAttributes &attrs);
71 Course(const QDomElement node);
72 Course(QString &name, QVector<QString> &, QVector<QString> &);
73 QDomElement toElement(QDomDocument doc);
74 int update(QVector<QString> &, QVector<QString> &, QVector<QString> &);
75 void addHole(Hole *iHole);
76 QString getPar(int i);
77 QString getHcp(int i);
79 QString getTotal(int what);
83 QList <Hole *> holeList;
90 Club(const QXmlAttributes &attrs);
91 Club(const QDomElement node);
94 QDomElement toElement(QDomDocument doc);
95 void addCourse(Course *iCourse);
98 Course *getCourse(int pos);
99 Course *getCourse(const QString &courseName);
101 QList <Course *> getCourseList() { return courseList; } // HACK: fixme
104 QList <Course *> courseList;