ArtMOO
|
00001 #ifndef TASKENTRY_H 00002 #define TASKENTRY_H 00003 00004 #include <QString> 00005 00006 #include "mooglobal.h" 00007 00008 class QDataStream; 00009 00010 class TaskEntry 00011 { 00012 public: 00013 TaskEntry( void ); 00014 00015 TaskEntry( const QString &pCommand, ConnectionId pConnectionId, ObjectId pPlayerId = OBJECT_NONE ); 00016 00017 void save( QDataStream &pData ) const; 00018 void load( QDataStream &pData ); 00019 00020 inline TaskId id( void ) const 00021 { 00022 return( mId ); 00023 } 00024 00025 inline qint64 timestamp( void ) const 00026 { 00027 return( mTimeStamp ); 00028 } 00029 00030 inline const QString &command( void ) const 00031 { 00032 return( mCommand ); 00033 } 00034 00035 inline ObjectId playerid( void ) const 00036 { 00037 return( mPlayerId ); 00038 } 00039 00040 inline ConnectionId connectionid( void ) const 00041 { 00042 return( mConnectionId ); 00043 } 00044 00045 inline void setTimeStamp( qint64 pTimeStamp ) 00046 { 00047 mTimeStamp = pTimeStamp; 00048 } 00049 00050 static bool lessThan( const TaskEntry &s1, const TaskEntry &s2 ) 00051 { 00052 return s1.mTimeStamp < s2.mTimeStamp; 00053 } 00054 00055 private: 00056 TaskId mId; // the task id 00057 qint64 mTimeStamp; // when the task was created 00058 QString mCommand; // the command 00059 ObjectId mPlayerId; // the player who typed the command 00060 ConnectionId mConnectionId; 00061 }; 00062 00063 #endif // TASKENTRY_H