diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp index 31054b339b7904e1780e215f832072c79aca3e5e..947628ba823cc91ee7ac1e3dea230f979a575dbc 100644 --- a/src/plugins/projectexplorer/task.cpp +++ b/src/plugins/projectexplorer/task.cpp @@ -32,31 +32,19 @@ namespace ProjectExplorer { -Task::Task() : type(Unknown), line(-1) -{ } +unsigned int Task::s_nextId = 0; + +Task::Task() : taskId(s_nextId), type(Unknown), line(-1) +{ + ++s_nextId; +} Task::Task(TaskType type_, const QString &description_, const QString &file_, int line_, const QString &category_) : - type(type_), description(description_), file(file_), line(line_), category(category_) -{ } - -Task::Task(const Task &source) : - type(source.type), description(source.description), file(source.file), - line(source.line), category(source.category), formats(source.formats) -{ } - -Task::~Task() -{ } - -Task &Task::operator=(const Task &source) + taskId(s_nextId), type(type_), description(description_), file(file_), + line(line_), category(category_) { - type = source.type; - description = source.description; - file = source.file; - line = source.line; - category = source.category; - formats = source.formats; - return *this; + ++s_nextId; } // @@ -64,19 +52,12 @@ Task &Task::operator=(const Task &source) // bool operator==(const Task &t1, const Task &t2) { - return t1.type == t2.type - && t1.line == t2.line - && t1.description == t2.description - && t1.file == t2.file - && t1.category == t2.category; + return t1.taskId == t2.taskId; } uint qHash(const Task &task) { - return static_cast<int>(task.type) + - task.line + - qHash(task.file) + - qHash(task.category); + return task.taskId; } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/task.h b/src/plugins/projectexplorer/task.h index e91c629e2c96d786d73487939cf6e9eb3a2700c1..db6fa228e09bd897b90c69e707f21a078a2baf5c 100644 --- a/src/plugins/projectexplorer/task.h +++ b/src/plugins/projectexplorer/task.h @@ -51,11 +51,8 @@ public: Task(); Task(TaskType type_, const QString &description_, const QString &file_, int line_, const QString &category_); - Task(const Task &source); - ~Task(); - - Task &operator=(const Task &source); + unsigned int taskId; TaskType type; QString description; QString file; @@ -70,6 +67,8 @@ public: // doesn't work if you split it up, nor are our parsers // anywhere near being that good QList<QTextLayout::FormatRange> formats; +private: + static unsigned int s_nextId; }; bool operator==(const Task &t1, const Task &t2);