diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-01 11:58:25 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-01 11:58:25 +0900 |
| commit | 5e64d4c9a988b1016c9503f8e11836b562d0a4e1 (patch) | |
| tree | d026daafaf22a54af5ddff9edb77d8d357450bb3 /src | |
| parent | 8f659f49ec54a722498465f618bb2fda1a9e34b5 (diff) | |
Expose struct DownloadHandle interface to public API directly
Diffstat (limited to 'src')
| -rw-r--r-- | src/aria2api.cc | 65 | ||||
| -rw-r--r-- | src/aria2api.h | 17 | ||||
| -rw-r--r-- | src/includes/aria2/aria2.h | 31 |
3 files changed, 16 insertions, 97 deletions
diff --git a/src/aria2api.cc b/src/aria2api.cc index 3c2be5ac..dc45a147 100644 --- a/src/aria2api.cc +++ b/src/aria2api.cc @@ -386,69 +386,4 @@ void deleteDownloadHandle(DownloadHandle* dh) delete dh; } -DOWNLOAD_STATUS downloadGetStatus(DownloadHandle* dh) -{ - return dh->getStatus(); -} - -int64_t downloadGetTotalLength(DownloadHandle* dh) -{ - return dh->getTotalLength(); -} - -int64_t downloadGetCompletedLength(DownloadHandle* dh) -{ - return dh->getCompletedLength(); -} - -int64_t downloadGetUploadLength(DownloadHandle* dh) -{ - return dh->getUploadLength(); -} - -std::string downloadGetBitfield(DownloadHandle* dh) -{ - return dh->getBitfield(); -} - -int downloadGetDownloadSpeed(DownloadHandle* dh) -{ - return dh->getDownloadSpeed(); -} - -int downloadGetUploadSpeed(DownloadHandle* dh) -{ - return dh->getUploadSpeed(); -} - -size_t downloadGetNumPieces(DownloadHandle* dh) -{ - return dh->getNumPieces(); -} - -int downloadGetConnections(DownloadHandle* dh) -{ - return dh->getConnections(); -} - -int downloadGetErrorCode(DownloadHandle* dh) -{ - return dh->getErrorCode(); -} - -const std::vector<A2Gid>& downloadGetFollowedBy(DownloadHandle* dh) -{ - return dh->getFollowedBy(); -} - -A2Gid downloadGetBelongsTo(DownloadHandle* dh) -{ - return dh->getBelongsTo(); -} - -const std::string& downloadGetDir(DownloadHandle* dh) -{ - return dh->getDir(); -} - } // namespace aria2 diff --git a/src/aria2api.h b/src/aria2api.h index 51217d49..29fe529e 100644 --- a/src/aria2api.h +++ b/src/aria2api.h @@ -50,23 +50,6 @@ struct Session { SharedHandle<Context> context; }; -struct DownloadHandle { - virtual ~DownloadHandle() {} - virtual DOWNLOAD_STATUS getStatus() = 0; - virtual int64_t getTotalLength() = 0; - virtual int64_t getCompletedLength() = 0; - virtual int64_t getUploadLength() = 0; - virtual std::string getBitfield() = 0; - virtual int getDownloadSpeed() = 0; - virtual int getUploadSpeed() = 0; - virtual size_t getNumPieces() = 0; - virtual int getConnections() = 0; - virtual int getErrorCode() = 0; - virtual const std::vector<A2Gid>& getFollowedBy() = 0; - virtual A2Gid getBelongsTo() = 0; - virtual const std::string& getDir() = 0; -}; - } // namespace aria2 #endif // ARIA2_API_H diff --git a/src/includes/aria2/aria2.h b/src/includes/aria2/aria2.h index d0a0c30f..eb43a072 100644 --- a/src/includes/aria2/aria2.h +++ b/src/includes/aria2/aria2.h @@ -143,7 +143,22 @@ enum DOWNLOAD_STATUS { DOWNLOAD_REMOVED }; -struct DownloadHandle; +struct DownloadHandle { + virtual ~DownloadHandle() {} + virtual DOWNLOAD_STATUS getStatus() = 0; + virtual int64_t getTotalLength() = 0; + virtual int64_t getCompletedLength() = 0; + virtual int64_t getUploadLength() = 0; + virtual std::string getBitfield() = 0; + virtual int getDownloadSpeed() = 0; + virtual int getUploadSpeed() = 0; + virtual size_t getNumPieces() = 0; + virtual int getConnections() = 0; + virtual int getErrorCode() = 0; + virtual const std::vector<A2Gid>& getFollowedBy() = 0; + virtual A2Gid getBelongsTo() = 0; + virtual const std::string& getDir() = 0; +}; // Returns handle for the download denoted by the |gid|. The caller // can retrieve various information of the download via returned @@ -156,20 +171,6 @@ DownloadHandle* getDownloadHandle(Session* session, const A2Gid& gid); // Deallocates the |dh|. Calling this function with NULL is safe. void deleteDownloadHandle(DownloadHandle* dh); -DOWNLOAD_STATUS downloadGetStatus(DownloadHandle* dh); -int64_t downloadGetTotalLength(DownloadHandle* dh); -int64_t downloadGetCompletedLength(DownloadHandle* dh); -int64_t downloadGetUploadLength(DownloadHandle* dh); -std::string downloadGetBitfield(DownloadHandle* dh); -int downloadGetDownloadSpeed(DownloadHandle* dh); -int downloadGetUploadSpeed(DownloadHandle* dh); -size_t downloadGetNumPieces(DownloadHandle* dh); -int downloadGetConnections(DownloadHandle* dh); -int downloadGetErrorCode(DownloadHandle* dh); -const std::vector<A2Gid>& downloadGetFollowedBy(DownloadHandle* dh); -A2Gid downloadGetBelongsTo(DownloadHandle* dh); -const std::string& downloadGetDir(DownloadHandle* dh); - } // namespace aria2 #endif // ARIA2_H |
