diff --git a/ChangeLog b/ChangeLog index 04f7e4dc..e890dfbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-06-20 Tatsuhiro Tsujikawa + + Added separete *.cc files for exception classes. + * src/DlAbortEx.cc + * src/DlAbortEx.h + * src/DlRetryEx.cc + * src/DlRetryEx.h + * src/DownloadFailureException.cc + * src/DownloadFailureException.h + * src/FatalException.cc + * src/FatalException.h + * src/Makefile.am + * src/RecoverableException.cc + * src/RecoverableException.h + 2010-06-20 Tatsuhiro Tsujikawa Moved non-trivial functions to *.cc file diff --git a/src/DlAbortEx.cc b/src/DlAbortEx.cc new file mode 100644 index 00000000..2dd847f7 --- /dev/null +++ b/src/DlAbortEx.cc @@ -0,0 +1,59 @@ +/* */ +#include "DlAbortEx.h" + +namespace aria2 { + +SharedHandle DlAbortEx::copy() const +{ + SharedHandle e(new DlAbortEx(*this)); + return e; +} + +DlAbortEx::DlAbortEx(const char* file, int line, const std::string& msg): + RecoverableException(file, line, msg) {} + +DlAbortEx::DlAbortEx(const char* file, int line, const std::string& msg, + const Exception& cause): + RecoverableException(file, line, msg, cause) {} + +DlAbortEx::DlAbortEx(const char* file, int line, const RecoverableException& e): + RecoverableException(file, line, e) {} + +DlAbortEx::DlAbortEx(const char* file, int line, const std::string& msg, + downloadresultcode::RESULT code): + RecoverableException(file, line, msg, code) {} + +} // namespace aria2 diff --git a/src/DlAbortEx.h b/src/DlAbortEx.h index 8c0c76ee..520ebecc 100644 --- a/src/DlAbortEx.h +++ b/src/DlAbortEx.h @@ -40,22 +40,17 @@ namespace aria2 { class DlAbortEx:public RecoverableException { protected: - virtual SharedHandle copy() const - { - SharedHandle e(new DlAbortEx(*this)); - return e; - } + virtual SharedHandle copy() const; public: - DlAbortEx(const char* file, int line, const std::string& msg): - RecoverableException(file, line, msg) {} + DlAbortEx(const char* file, int line, const std::string& msg); + DlAbortEx(const char* file, int line, const std::string& msg, - const Exception& cause): - RecoverableException(file, line, msg, cause) {} - DlAbortEx(const char* file, int line, const RecoverableException& e): - RecoverableException(file, line, e) {} + const Exception& cause); + + DlAbortEx(const char* file, int line, const RecoverableException& e); + DlAbortEx(const char* file, int line, const std::string& msg, - downloadresultcode::RESULT code): - RecoverableException(file, line, msg, code) {} + downloadresultcode::RESULT code); }; #define DL_ABORT_EX(arg) DlAbortEx(__FILE__, __LINE__, arg) diff --git a/src/DlRetryEx.cc b/src/DlRetryEx.cc new file mode 100644 index 00000000..11a8eab5 --- /dev/null +++ b/src/DlRetryEx.cc @@ -0,0 +1,57 @@ +/* */ +#include "DlRetryEx.h" + +namespace aria2 { + +SharedHandle DlRetryEx::copy() const +{ + SharedHandle e(new DlRetryEx(*this)); + return e; +} + +DlRetryEx::DlRetryEx(const char* file, int line, const std::string& msg): + RecoverableException(file, line, msg) {} + +DlRetryEx::DlRetryEx(const char* file, int line, const std::string& msg, + const Exception& cause): + RecoverableException(file, line, msg, cause) {} +DlRetryEx::DlRetryEx(const char* file, int line, const DlRetryEx& e): + RecoverableException(file, line, e) {} +DlRetryEx::DlRetryEx(const char* file, int line, const std::string& msg, + downloadresultcode::RESULT code): + RecoverableException(file, line, msg, code) {} + +} // namespace aria2 diff --git a/src/DlRetryEx.h b/src/DlRetryEx.h index 4b48aa96..75ddfeae 100644 --- a/src/DlRetryEx.h +++ b/src/DlRetryEx.h @@ -40,22 +40,17 @@ namespace aria2 { class DlRetryEx:public RecoverableException { protected: - virtual SharedHandle copy() const - { - SharedHandle e(new DlRetryEx(*this)); - return e; - } + virtual SharedHandle copy() const; public: - DlRetryEx(const char* file, int line, const std::string& msg): - RecoverableException(file, line, msg) {} + DlRetryEx(const char* file, int line, const std::string& msg); + DlRetryEx(const char* file, int line, const std::string& msg, - const Exception& cause): - RecoverableException(file, line, msg, cause) {} - DlRetryEx(const char* file, int line, const DlRetryEx& e): - RecoverableException(file, line, e) {} + const Exception& cause); + + DlRetryEx(const char* file, int line, const DlRetryEx& e); + DlRetryEx(const char* file, int line, const std::string& msg, - downloadresultcode::RESULT code): - RecoverableException(file, line, msg, code) {} + downloadresultcode::RESULT code); }; #define DL_RETRY_EX(arg) DlRetryEx(__FILE__, __LINE__, arg) diff --git a/src/DownloadFailureException.cc b/src/DownloadFailureException.cc new file mode 100644 index 00000000..417fa285 --- /dev/null +++ b/src/DownloadFailureException.cc @@ -0,0 +1,65 @@ +/* */ +#include "DownloadFailureException.h" + +namespace aria2 { + +SharedHandle DownloadFailureException::copy() const +{ + SharedHandle e(new DownloadFailureException(*this)); + return e; +} + +DownloadFailureException::DownloadFailureException +(const char* file, int line, const std::string& msg): + RecoverableException(file, line, msg) {} + +DownloadFailureException::DownloadFailureException +(const char* file, int line, const std::string& msg, + const Exception& cause): + RecoverableException(file, line, msg, cause) {} + +DownloadFailureException::DownloadFailureException +(const char* file, int line, + const DownloadFailureException& e): + RecoverableException(file, line, e) {} + +DownloadFailureException::DownloadFailureException +(const char* file, int line, + const std::string& msg, + downloadresultcode::RESULT code): + RecoverableException(file, line, msg, code) {} + +} // namespace aria2 diff --git a/src/DownloadFailureException.h b/src/DownloadFailureException.h index 3dc57600..adb3c7a2 100644 --- a/src/DownloadFailureException.h +++ b/src/DownloadFailureException.h @@ -44,24 +44,19 @@ namespace aria2 { */ class DownloadFailureException:public RecoverableException { protected: - virtual SharedHandle copy() const - { - SharedHandle e(new DownloadFailureException(*this)); - return e; - } + virtual SharedHandle copy() const; public: - DownloadFailureException(const char* file, int line, const std::string& msg): - RecoverableException(file, line, msg) {} + DownloadFailureException(const char* file, int line, const std::string& msg); + DownloadFailureException(const char* file, int line, const std::string& msg, - const Exception& cause): - RecoverableException(file, line, msg, cause) {} + const Exception& cause); + DownloadFailureException(const char* file, int line, - const DownloadFailureException& e): - RecoverableException(file, line, e) {} + const DownloadFailureException& e); + DownloadFailureException(const char* file, int line, const std::string& msg, - downloadresultcode::RESULT code): - RecoverableException(file, line, msg, code) {} + downloadresultcode::RESULT code); }; #define DOWNLOAD_FAILURE_EXCEPTION(arg) \ diff --git a/src/FatalException.cc b/src/FatalException.cc new file mode 100644 index 00000000..826929b0 --- /dev/null +++ b/src/FatalException.cc @@ -0,0 +1,56 @@ +/* */ +#include "FatalException.h" + +namespace aria2 { + +SharedHandle FatalException::copy() const +{ + SharedHandle e(new FatalException(*this)); + return e; +} + +FatalException::FatalException +(const char* file, int line, const std::string& msg): + Exception(file, line, msg) {} + +FatalException::FatalException +(const char* file, int line, const std::string& msg, + const Exception& cause): + Exception(file, line, msg, cause) {} + +FatalException::FatalException(const FatalException& e):Exception(e) {} + +} // namespace aria2 diff --git a/src/FatalException.h b/src/FatalException.h index aa27fd91..9e1c9a91 100644 --- a/src/FatalException.h +++ b/src/FatalException.h @@ -40,18 +40,14 @@ namespace aria2 { class FatalException:public Exception { protected: - virtual SharedHandle copy() const - { - SharedHandle e(new FatalException(*this)); - return e; - } + virtual SharedHandle copy() const; public: - FatalException(const char* file, int line, const std::string& msg): - Exception(file, line, msg) {} + FatalException(const char* file, int line, const std::string& msg); + FatalException(const char* file, int line, const std::string& msg, - const Exception& cause): - Exception(file, line, msg, cause) {} - FatalException(const FatalException& e):Exception(e) {} + const Exception& cause); + + FatalException(const FatalException& e); }; #define FATAL_EXCEPTION(arg) \ diff --git a/src/Makefile.am b/src/Makefile.am index ad4835f6..8b1c475c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,11 +34,11 @@ SRCS = Socket.h\ common.h\ message.h\ Exception.cc Exception.h\ - FatalException.h\ - RecoverableException.h\ - DlAbortEx.h\ - DlRetryEx.h\ - DownloadFailureException.h\ + FatalException.cc FatalException.h\ + RecoverableException.cc RecoverableException.h\ + DlAbortEx.cc DlAbortEx.h\ + DlRetryEx.cc DlRetryEx.h\ + DownloadFailureException.cc DownloadFailureException.h\ Logger.cc Logger.h\ SimpleLogger.cc SimpleLogger.h\ DiskWriter.h\ diff --git a/src/RecoverableException.cc b/src/RecoverableException.cc new file mode 100644 index 00000000..933c9284 --- /dev/null +++ b/src/RecoverableException.cc @@ -0,0 +1,67 @@ +/* */ +#include "RecoverableException.h" + +namespace aria2 { + +SharedHandle RecoverableException::copy() const +{ + SharedHandle e(new RecoverableException(*this)); + return e; +} + +RecoverableException::RecoverableException +(const char* file, int line, const std::string& msg): + Exception(file, line, msg), + _code(downloadresultcode::UNKNOWN_ERROR) {} + +RecoverableException::RecoverableException +(const char* file, int line, const std::string& msg, + const Exception& cause): + Exception(file, line, msg, cause), + _code(downloadresultcode::UNKNOWN_ERROR) {} + +RecoverableException::RecoverableException +(const char* file, int line, + const RecoverableException& e): + Exception(file, line, e), + _code(downloadresultcode::UNKNOWN_ERROR) {} + +RecoverableException::RecoverableException +(const char* file, int line, const std::string& msg, + downloadresultcode::RESULT result): + Exception(file, line, msg), _code(result) {} + +} // namespace aria2 diff --git a/src/RecoverableException.h b/src/RecoverableException.h index b22b52d0..25dcc735 100644 --- a/src/RecoverableException.h +++ b/src/RecoverableException.h @@ -44,29 +44,18 @@ private: downloadresultcode::RESULT _code; protected: - virtual SharedHandle copy() const - { - SharedHandle e(new RecoverableException(*this)); - return e; - } + virtual SharedHandle copy() const; public: - RecoverableException(const char* file, int line, const std::string& msg): - Exception(file, line, msg), - _code(downloadresultcode::UNKNOWN_ERROR) {} + RecoverableException(const char* file, int line, const std::string& msg); RecoverableException(const char* file, int line, const std::string& msg, - const Exception& cause): - Exception(file, line, msg, cause), - _code(downloadresultcode::UNKNOWN_ERROR) {} + const Exception& cause); RecoverableException(const char* file, int line, - const RecoverableException& e): - Exception(file, line, e), - _code(downloadresultcode::UNKNOWN_ERROR) {} + const RecoverableException& e); RecoverableException(const char* file, int line, const std::string& msg, - downloadresultcode::RESULT result): - Exception(file, line, msg), _code(result) {} + downloadresultcode::RESULT result); downloadresultcode::RESULT getCode() const { return _code; } };