Add club-master.xml r/o file for distributed courses. User added courses go to club...
[scorecard] / src / data.h
index 4ab4e61..01d01ef 100644 (file)
@@ -19,102 +19,101 @@ enum { TotalOut, TotalIn, Total };
 
 
 class Hole {
- public:
-  Hole(const QXmlAttributes &attrs);
-  Hole(const QDomElement node);
-  Hole(int num, QString &shots);
-  Hole(int num, QString &par, QString &hcp);
-  QDomElement toElement(QDomDocument doc);
-  QString getShots();
-  void setShots(QString& shots);
-  QString getHcp();
-  void setHcp(QString& shots);
-  QString getPar();
-  void setPar(QString& shots);
-  void dump();
-
- private:
-  QString num, shots, putts, hcp, length, par;
+public:
+    Hole(const QXmlAttributes &attrs);
+    Hole(const QDomElement node);
+    Hole(int num, QString &shots);
+    Hole(int num, QString &par, QString &hcp);
+    QDomElement toElement(QDomDocument doc);
+    QString getShots();
+    void setShots(QString& shots);
+    QString getHcp();
+    void setHcp(QString& shots);
+    QString getPar();
+    void setPar(QString& shots);
+    void dump();
+
+private:
+    QString num, shots, putts, hcp, length, par;
 };
 
 class Score {
- public:
-
-  Score(const QXmlAttributes &attrs);
-  Score(QString &iClub, QString &iCourse, QString &iDate);
-  Score(const QDomElement node);
-  Score(QVector<QString> scores, QString &club, QString &course, QString &date);
-
-  bool operator< (const Score& val) const 
-  { 
-    return date < val.getDate();
-  }
-
-  bool operator> (const Score& val) const 
-  { 
-    return date > val.getDate();
-  }
-
-  QDomElement toElement(QDomDocument doc);
-  int update(QVector<QString> &scores);
-  void addHole(Hole *iHole);
-  QString getScore(int i) const;
-  QString getTotal(int what) const;
-  const QString& getClubName() const;
-  const QString& getCourseName() const;
-  const QString& getDate() const;
-  void dump();
-
- private:
-  QList <Hole *> holeList;
-  QString club, course, date;
+public:
+    Score(const QXmlAttributes &attrs);
+    Score(QString &iClub, QString &iCourse, QString &iDate);
+    Score(const QDomElement node);
+    Score(QVector<QString> scores, QString &club, QString &course, QString &date);
+
+    bool operator< (const Score& val) const 
+    { 
+        return date < val.getDate();
+    }
+    
+    bool operator> (const Score& val) const 
+    { 
+        return date > val.getDate();
+    }
+
+    QDomElement toElement(QDomDocument doc);
+    int update(QVector<QString> &scores);
+    void addHole(Hole *iHole);
+    QString getScore(int i) const;
+    QString getTotal(int what) const;
+    const QString& getClubName() const;
+    const QString& getCourseName() const;
+    const QString& getDate() const;
+    void dump();
+
+private:
+    QList <Hole *> holeList;
+    QString club, course, date;
 };
 
 class Club;
 
 class Course {
- public:
-  Course(const QXmlAttributes &attrs);
-  Course(const QDomElement node, Club * parent = 0);
-  Course(QString &name, QVector<QString> &, QVector<QString> &);
-  QDomElement toElement(QDomDocument doc);
-  int update(QVector<QString> &, QVector<QString> &, QVector<QString> &);
-  void addHole(Hole *iHole);
-  QString getPar(int i);
-  QString getHcp(int i);
-  QString& getName();
-  QString getTotal(int what);
-  void dump();
-  Club * parent();
-  void setParent(Club *parent);
-
- private:
-  QList <Hole *> holeList;
-  QString name;
-  Club *club;
+public:
+    Course(const QXmlAttributes &attrs);
+    Course(const QDomElement node, Club * parent = 0);
+    Course(QString &name, QVector<QString> &, QVector<QString> &);
+    QDomElement toElement(QDomDocument doc);
+    int update(QVector<QString> &, QVector<QString> &, QVector<QString> &);
+    void addHole(Hole *iHole);
+    QString getPar(int i);
+    QString getHcp(int i);
+    QString& getName();
+    QString getTotal(int what);
+    void dump();
+    Club * parent();
+    void setParent(Club *parent);
+
+private:
+    QList <Hole *> holeList;
+    QString name;
+    Club *club;
 };
 
 class Club {
- public:
-
-  Club(const QXmlAttributes &attrs);
-  Club(const QDomElement node);
-  Club(QString &name);
-
-  QDomElement toElement(QDomDocument doc);
-  void addCourse(Course *iCourse);
-  void delCourse(Course *iCourse);
-  void dump();
-  QString& getName();
-  Course *getCourse(int pos);
-  Course *getCourse(const QString &courseName);
-  bool isEmpty();
-
-  QList <Course *> getCourseList() { return courseList; } // HACK: fixme
-
- private:
-  QList <Course *> courseList;
-  QString name;
-
+public:
+    Club(const QXmlAttributes &attrs, bool readOnly = false);
+    Club(const QDomElement node, bool readOnly = false);
+    Club(QString &name, bool readOnly = false);
+
+    QDomElement toElement(QDomDocument doc);
+    void addCourse(Course *iCourse);
+    void delCourse(Course *iCourse);
+    void dump();
+    QString& getName();
+    Course *getCourse(int pos);
+    Course *getCourse(const QString &courseName);
+    bool isEmpty();
+    bool isReadOnly();
+
+    QList <Course *> getCourseList() { return courseList; } // HACK: fixme
+
+private:
+    bool m_readOnly;
+    QList <Course *> courseList;
+    QString name;
 };
 #endif