From 8ecfc19a5fff07065d893145b55921752754a708 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 9 Jan 2013 05:03:10 +0100 Subject: Disabling generating traces for task switches, and adding a move constructor for exceptions. --- includes/Exceptions.h | 5 +++-- includes/Task.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'includes') diff --git a/includes/Exceptions.h b/includes/Exceptions.h index d7856fe..5cdb232 100644 --- a/includes/Exceptions.h +++ b/includes/Exceptions.h @@ -10,9 +10,10 @@ namespace Balau { class GeneralException { public: - GeneralException(const char * msg, const char * details = NULL) : m_msg(::strdup(msg)) { setDetails(details); genTrace(); } - GeneralException(const String & msg, const char * details = NULL) : m_msg(msg.strdup()) { setDetails(details); genTrace(); } + GeneralException(const char * msg, const char * details = NULL, bool notrace = false) : m_msg(::strdup(msg)) { setDetails(details); if (!notrace) genTrace(); } + GeneralException(const String & msg, const char * details = NULL, bool notrace = false) : m_msg(msg.strdup()) { setDetails(details); if (!notrace) genTrace(); } GeneralException(const GeneralException & e) : m_msg(strdup(e.m_msg)), m_trace(e.m_trace) { setDetails(e.m_details); } + GeneralException(GeneralException && e) : m_msg(e.m_msg), m_trace(e.m_trace), m_details(e.m_details) { e.m_msg = e.m_details = NULL; } ~GeneralException() { if (m_msg) free(m_msg); } const char * getMsg() const { return m_msg; } const char * getDetails() const { return m_details; } diff --git a/includes/Task.h b/includes/Task.h index 86bbce1..b7931e6 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -15,7 +15,7 @@ namespace Events { class BaseEvent; }; class EAgain : public GeneralException { public: - EAgain(Events::BaseEvent * evt) : GeneralException("Try Again"), m_evt(evt) { } + EAgain(Events::BaseEvent * evt) : GeneralException("Try Again", NULL, true), m_evt(evt) { } Events::BaseEvent * getEvent() { return m_evt; } private: Events::BaseEvent * m_evt; @@ -23,7 +23,7 @@ class EAgain : public GeneralException { class TaskSwitch : public GeneralException { public: - TaskSwitch() : GeneralException("Task Switch") { } + TaskSwitch() : GeneralException("Task Switch", NULL, true) { } }; class TaskMan; -- cgit v1.2.3