2010-06-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

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
pull/1/head
Tatsuhiro Tsujikawa 2010-06-20 11:56:33 +00:00
parent 237f15b491
commit c7795c63ce
12 changed files with 359 additions and 70 deletions

View File

@ -1,3 +1,18 @@
2010-06-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
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 <t-tujikawa@users.sourceforge.net> 2010-06-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Moved non-trivial functions to *.cc file Moved non-trivial functions to *.cc file

59
src/DlAbortEx.cc Normal file
View File

@ -0,0 +1,59 @@
/* <!-- copyright */
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2006 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
/* copyright --> */
#include "DlAbortEx.h"
namespace aria2 {
SharedHandle<Exception> DlAbortEx::copy() const
{
SharedHandle<Exception> 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

View File

@ -40,22 +40,17 @@ namespace aria2 {
class DlAbortEx:public RecoverableException { class DlAbortEx:public RecoverableException {
protected: protected:
virtual SharedHandle<Exception> copy() const virtual SharedHandle<Exception> copy() const;
{
SharedHandle<Exception> e(new DlAbortEx(*this));
return e;
}
public: public:
DlAbortEx(const char* file, int line, const std::string& msg): 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): const Exception& cause);
RecoverableException(file, line, msg, cause) {}
DlAbortEx(const char* file, int line, const RecoverableException& e): DlAbortEx(const char* file, int line, const RecoverableException& e);
RecoverableException(file, line, e) {}
DlAbortEx(const char* file, int line, const std::string& msg, DlAbortEx(const char* file, int line, const std::string& msg,
downloadresultcode::RESULT code): downloadresultcode::RESULT code);
RecoverableException(file, line, msg, code) {}
}; };
#define DL_ABORT_EX(arg) DlAbortEx(__FILE__, __LINE__, arg) #define DL_ABORT_EX(arg) DlAbortEx(__FILE__, __LINE__, arg)

57
src/DlRetryEx.cc Normal file
View File

@ -0,0 +1,57 @@
/* <!-- copyright */
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2006 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
/* copyright --> */
#include "DlRetryEx.h"
namespace aria2 {
SharedHandle<Exception> DlRetryEx::copy() const
{
SharedHandle<Exception> 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

View File

@ -40,22 +40,17 @@ namespace aria2 {
class DlRetryEx:public RecoverableException { class DlRetryEx:public RecoverableException {
protected: protected:
virtual SharedHandle<Exception> copy() const virtual SharedHandle<Exception> copy() const;
{
SharedHandle<Exception> e(new DlRetryEx(*this));
return e;
}
public: public:
DlRetryEx(const char* file, int line, const std::string& msg): 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): const Exception& cause);
RecoverableException(file, line, msg, cause) {}
DlRetryEx(const char* file, int line, const DlRetryEx& e): DlRetryEx(const char* file, int line, const DlRetryEx& e);
RecoverableException(file, line, e) {}
DlRetryEx(const char* file, int line, const std::string& msg, DlRetryEx(const char* file, int line, const std::string& msg,
downloadresultcode::RESULT code): downloadresultcode::RESULT code);
RecoverableException(file, line, msg, code) {}
}; };
#define DL_RETRY_EX(arg) DlRetryEx(__FILE__, __LINE__, arg) #define DL_RETRY_EX(arg) DlRetryEx(__FILE__, __LINE__, arg)

View File

@ -0,0 +1,65 @@
/* <!-- copyright */
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2006 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
/* copyright --> */
#include "DownloadFailureException.h"
namespace aria2 {
SharedHandle<Exception> DownloadFailureException::copy() const
{
SharedHandle<Exception> 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

View File

@ -44,24 +44,19 @@ namespace aria2 {
*/ */
class DownloadFailureException:public RecoverableException { class DownloadFailureException:public RecoverableException {
protected: protected:
virtual SharedHandle<Exception> copy() const virtual SharedHandle<Exception> copy() const;
{
SharedHandle<Exception> e(new DownloadFailureException(*this));
return e;
}
public: public:
DownloadFailureException(const char* file, int line, const std::string& msg): 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): const Exception& cause);
RecoverableException(file, line, msg, cause) {}
DownloadFailureException(const char* file, int line, DownloadFailureException(const char* file, int line,
const DownloadFailureException& e): const DownloadFailureException& e);
RecoverableException(file, line, e) {}
DownloadFailureException(const char* file, int line, DownloadFailureException(const char* file, int line,
const std::string& msg, const std::string& msg,
downloadresultcode::RESULT code): downloadresultcode::RESULT code);
RecoverableException(file, line, msg, code) {}
}; };
#define DOWNLOAD_FAILURE_EXCEPTION(arg) \ #define DOWNLOAD_FAILURE_EXCEPTION(arg) \

56
src/FatalException.cc Normal file
View File

@ -0,0 +1,56 @@
/* <!-- copyright */
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2006 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
/* copyright --> */
#include "FatalException.h"
namespace aria2 {
SharedHandle<Exception> FatalException::copy() const
{
SharedHandle<Exception> 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

View File

@ -40,18 +40,14 @@ namespace aria2 {
class FatalException:public Exception { class FatalException:public Exception {
protected: protected:
virtual SharedHandle<Exception> copy() const virtual SharedHandle<Exception> copy() const;
{
SharedHandle<Exception> e(new FatalException(*this));
return e;
}
public: public:
FatalException(const char* file, int line, const std::string& msg): 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): const Exception& cause);
Exception(file, line, msg, cause) {}
FatalException(const FatalException& e):Exception(e) {} FatalException(const FatalException& e);
}; };
#define FATAL_EXCEPTION(arg) \ #define FATAL_EXCEPTION(arg) \

View File

@ -34,11 +34,11 @@ SRCS = Socket.h\
common.h\ common.h\
message.h\ message.h\
Exception.cc Exception.h\ Exception.cc Exception.h\
FatalException.h\ FatalException.cc FatalException.h\
RecoverableException.h\ RecoverableException.cc RecoverableException.h\
DlAbortEx.h\ DlAbortEx.cc DlAbortEx.h\
DlRetryEx.h\ DlRetryEx.cc DlRetryEx.h\
DownloadFailureException.h\ DownloadFailureException.cc DownloadFailureException.h\
Logger.cc Logger.h\ Logger.cc Logger.h\
SimpleLogger.cc SimpleLogger.h\ SimpleLogger.cc SimpleLogger.h\
DiskWriter.h\ DiskWriter.h\

View File

@ -0,0 +1,67 @@
/* <!-- copyright */
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2006 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations
* including the two.
* You must obey the GNU General Public License in all respects
* for all of the code used other than OpenSSL. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you
* do not wish to do so, delete this exception statement from your
* version. If you delete this exception statement from all source
* files in the program, then also delete it here.
*/
/* copyright --> */
#include "RecoverableException.h"
namespace aria2 {
SharedHandle<Exception> RecoverableException::copy() const
{
SharedHandle<Exception> 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

View File

@ -44,29 +44,18 @@ private:
downloadresultcode::RESULT _code; downloadresultcode::RESULT _code;
protected: protected:
virtual SharedHandle<Exception> copy() const virtual SharedHandle<Exception> copy() const;
{
SharedHandle<Exception> e(new RecoverableException(*this));
return e;
}
public: public:
RecoverableException(const char* file, int line, const std::string& msg): 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): const Exception& cause);
Exception(file, line, msg, cause),
_code(downloadresultcode::UNKNOWN_ERROR) {}
RecoverableException(const char* file, int line, RecoverableException(const char* file, int line,
const RecoverableException& e): const RecoverableException& e);
Exception(file, line, e),
_code(downloadresultcode::UNKNOWN_ERROR) {}
RecoverableException(const char* file, int line, const std::string& msg, RecoverableException(const char* file, int line, const std::string& msg,
downloadresultcode::RESULT result): downloadresultcode::RESULT result);
Exception(file, line, msg), _code(result) {}
downloadresultcode::RESULT getCode() const { return _code; } downloadresultcode::RESULT getCode() const { return _code; }
}; };