From 1fdc6e0a332e9952e271caa36f6fb19798cb9457 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 28 Sep 2012 00:26:34 +0900 Subject: [PATCH] Code cleanup --- src/DownloadHandler.cc | 3 ++- src/DownloadHandlerFactory.cc | 24 ++++++++++++------------ src/DownloadHandlerFactory.h | 20 ++++++++++---------- src/RequestGroupCriteria.h | 2 -- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/DownloadHandler.cc b/src/DownloadHandler.cc index db2c02fe..bde2b746 100644 --- a/src/DownloadHandler.cc +++ b/src/DownloadHandler.cc @@ -48,7 +48,8 @@ bool DownloadHandler::canHandle(const RequestGroup* requestGroup) const return criteria_ && criteria_->match(requestGroup); } -void DownloadHandler::setCriteria(const RequestGroupCriteriaHandle& criteria) +void DownloadHandler::setCriteria +(const SharedHandle& criteria) { criteria_ = criteria; } diff --git a/src/DownloadHandlerFactory.cc b/src/DownloadHandlerFactory.cc index 0a9387c0..7ca0a904 100644 --- a/src/DownloadHandlerFactory.cc +++ b/src/DownloadHandlerFactory.cc @@ -44,35 +44,35 @@ namespace aria2 { #ifdef ENABLE_METALINK -SharedHandle +SharedHandle DownloadHandlerFactory::metalinkPreDownloadHandler_; -SharedHandle +SharedHandle DownloadHandlerFactory::metalinkPostDownloadHandler_; #endif // ENABLE_METALINK #ifdef ENABLE_BITTORRENT -SharedHandle +SharedHandle DownloadHandlerFactory::btPreDownloadHandler_; -SharedHandle +SharedHandle DownloadHandlerFactory::btPostDownloadHandler_; -SharedHandle +SharedHandle DownloadHandlerFactory::btMetadataPostDownloadHandler_; #endif // ENABLE_BITTORRENT #ifdef ENABLE_METALINK -SharedHandle +SharedHandle DownloadHandlerFactory::getMetalinkPreDownloadHandler() { if(!metalinkPreDownloadHandler_) { metalinkPreDownloadHandler_.reset(new MemoryBufferPreDownloadHandler()); - RequestGroupCriteriaHandle criteria + SharedHandle criteria (new ContentTypeRequestGroupCriteria (getMetalinkContentTypes(), getMetalinkExtensions())); metalinkPreDownloadHandler_->setCriteria(criteria); @@ -80,7 +80,7 @@ DownloadHandlerFactory::getMetalinkPreDownloadHandler() return metalinkPreDownloadHandler_; } -SharedHandle +SharedHandle DownloadHandlerFactory::getMetalinkPostDownloadHandler() { if(!metalinkPostDownloadHandler_) { @@ -93,14 +93,14 @@ DownloadHandlerFactory::getMetalinkPostDownloadHandler() #ifdef ENABLE_BITTORRENT -SharedHandle +SharedHandle DownloadHandlerFactory::getBtPreDownloadHandler() { if(!btPreDownloadHandler_) { btPreDownloadHandler_.reset (new bittorrent::MemoryBencodePreDownloadHandler()); - RequestGroupCriteriaHandle criteria + SharedHandle criteria (new ContentTypeRequestGroupCriteria (getBtContentTypes(), getBtExtensions())); btPreDownloadHandler_->setCriteria(criteria); @@ -108,7 +108,7 @@ DownloadHandlerFactory::getBtPreDownloadHandler() return btPreDownloadHandler_; } -SharedHandle +SharedHandle DownloadHandlerFactory::getBtPostDownloadHandler() { if(!btPostDownloadHandler_) { @@ -117,7 +117,7 @@ DownloadHandlerFactory::getBtPostDownloadHandler() return btPostDownloadHandler_; } -SharedHandle +SharedHandle DownloadHandlerFactory::getUTMetadataPostDownloadHandler() { if(!btMetadataPostDownloadHandler_) { diff --git a/src/DownloadHandlerFactory.h b/src/DownloadHandlerFactory.h index 1ec81fd7..34c7cd23 100644 --- a/src/DownloadHandlerFactory.h +++ b/src/DownloadHandlerFactory.h @@ -56,40 +56,40 @@ class DownloadHandlerFactory { private: #ifdef ENABLE_METALINK - static SharedHandle + static SharedHandle metalinkPreDownloadHandler_; - static SharedHandle + static SharedHandle metalinkPostDownloadHandler_; #endif // ENABLE_METALINK #ifdef ENABLE_BITTORRENT - static SharedHandle + static SharedHandle btPreDownloadHandler_; - static SharedHandle + static SharedHandle btPostDownloadHandler_; - static SharedHandle + static SharedHandle btMetadataPostDownloadHandler_; #endif // ENABLE_BITTORRENT public: #ifdef ENABLE_METALINK - static SharedHandle + static SharedHandle getMetalinkPreDownloadHandler(); - static SharedHandle + static SharedHandle getMetalinkPostDownloadHandler(); #endif // ENABLE_METALINK #ifdef ENABLE_BITTORRENT - static SharedHandle + static SharedHandle getBtPreDownloadHandler(); - static SharedHandle + static SharedHandle getBtPostDownloadHandler(); - static SharedHandle + static SharedHandle getUTMetadataPostDownloadHandler(); #endif // ENABLE_BITTORRENT }; diff --git a/src/RequestGroupCriteria.h b/src/RequestGroupCriteria.h index 69e4ae69..7cbaa332 100644 --- a/src/RequestGroupCriteria.h +++ b/src/RequestGroupCriteria.h @@ -50,8 +50,6 @@ public: virtual bool match(const RequestGroup* requestGroup) const = 0; }; -typedef SharedHandle RequestGroupCriteriaHandle; - } // namespace aria2 #endif // D_REQUEST_GROUP_CRITERIA_H