- Timestamp:
- 12/29/09 18:04:41 (13 years ago)
- Branches:
- master, qt5
- Children:
- 20a6010
- Parents:
- e5bc908
- Location:
- src/model
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/model/event.cpp
re5bc908 r5a73d27 1 1 #include "event.h" 2 2 3 Event Event::getById(int id, int conferenceId) 4 { 5 Event newEvent; 6 return newEvent; 7 } 3 QStringList const Event::sColNames = QStringList() 4 << "id" << "xid_conference" << "start" << "duration" << "xid_activity" << "type" << "language"; 5 6 QString const Event::sTableName = QString("event"); -
src/model/event.h
re5bc908 r5a73d27 3 3 4 4 #include <QDateTime> 5 #include <QVector> 6 #include <QStringList> 5 7 6 class Event 8 #include <ormrecord.h> 9 10 11 /** 12 NoSuchEventException is thrown when required event does not exist. 13 */ 14 class NoSuchEventException 15 { 16 }; 17 18 class Event : public OrmRecord <Event> 7 19 { 8 20 public: 9 static Event getById(int id, int conferenceId); 21 // column definition 22 enum Column 23 { 24 Id = 0, 25 Conference, 26 Start, 27 Duration, 28 Activity, 29 Type, 30 Language 31 }; 32 33 static QStringList const sColNames; 34 35 static QString const sTableName; 10 36 11 37 public: 12 int id() const { return mId; } 13 int conferenceId() const { return mConferenceId; } 14 QDateTime start() const { return mStart; } 15 int duration() const { return mDuration; } 16 int activityId() const { return mActivityId; } 17 int typeId() const { return mTypeId; } 18 int languageId() const { return mLanguageId; } 38 static Event getById(int id, int conferenceId) { return Event(); } //EventTable::selectOne("id=1"); } 19 39 20 private: 21 Event() {}; // private constructor, use static methods to access instances 40 public: 41 int id() const { return value(Id).toInt(); } 42 int conferenceId() const { return value(Conference).toInt(); } 43 QDateTime start() const { return value(Start).toDateTime(); } 44 int duration() const { return value(Duration).toInt(); } 45 int activityId() const { return value(Activity).toInt(); } 46 int typeId() const { return value(Type).toInt(); } 47 int languageId() const { return value(Language).toInt(); } 22 48 23 private: 24 int mId; 25 int mConferenceId; 26 QDateTime mStart; 27 int mDuration; 28 int mActivityId; 29 int mTypeId; 30 int mLanguageId; 49 void setId(int id) { setValue(Id, id); } 50 void setConferenceId(int conferenceId) { setValue(Conference, conferenceId); } 51 void setStart(const QDateTime& start) { setValue(Start, start); } 52 void setDuration(int duration) { setValue(Duration, duration); } 53 void setActivityId(int activityId) { setValue(Activity, activityId); } 54 void setTypeId(int typeId) { setValue(Type, typeId); } 55 void setLanguageId(int languageId) { setValue(Language, languageId); } 31 56 }; 32 57 58 59 33 60 #endif // EVENT_H -
src/model/model.pro
re5bc908 r5a73d27 3 3 DESTDIR = ../bin 4 4 CONFIG += static 5 QT += sql 5 6 6 7 # module dependencies 7 DEPENDPATH += . 8 LIBS += -L$$DESTDIR -lorm 9 INCLUDEPATH += ../orm 10 DEPENDPATH += . ../orm 11 TARGETDEPS += $$DESTDIR/liborm.a 8 12 9 13 HEADERS += event.h
Note: See TracChangeset
for help on using the changeset viewer.