00001 #ifndef USER_H 00002 #define USER_H 00003 00004 #include "storabledata.h" 00005 00006 #include <tools/global.h> 00007 00008 class QString; 00009 template <typename T> 00010 class QList; 00011 00012 namespace domain 00013 { 00014 00015 class Task; 00016 class UserType; 00017 class Reservation; 00018 class Invitation; 00019 00020 struct UserPrivate; 00021 00038 class DOMAIN_EXPORT User : public StorableData 00039 { 00040 Q_OBJECT 00041 00042 friend class TaskManagerData; 00043 friend class Reservation; 00044 friend class Task; 00045 friend class Invitation; 00046 00047 public: 00048 00052 UserType* userType() const; 00053 00057 const QString& name() const; 00058 00062 QList<const Task*> tasks() const; 00063 00067 QList<const Invitation*> invitations() const; 00068 00076 virtual bool isAdmin() const; 00077 00078 protected: 00079 00085 User(UserType* type, const QString& name); 00086 00092 virtual ~User(); 00093 00094 private: 00095 00096 User(const User& other); 00097 User& operator=(const User& other); 00098 00099 void addTask(Task* task); 00100 void removeTask(Task* task); 00101 00102 void addInvitation(Invitation* invitation); 00103 void removeInvitation(Invitation* invitation); 00104 00110 QList<StorableData*> dependentData() const; 00111 00112 UserPrivate* const d; 00113 }; 00114 00120 class DOMAIN_EXPORT AdminUser : public User 00121 { 00122 Q_OBJECT 00123 00124 friend class TaskManagerData; 00125 00126 private: 00127 00128 AdminUser(); 00129 ~AdminUser(); 00130 00134 bool isAdmin() const; 00135 }; 00136 00137 } 00138 00139 #endif