summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-05-01 11:58:25 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-05-01 11:58:25 +0900
commit5e64d4c9a988b1016c9503f8e11836b562d0a4e1 (patch)
treed026daafaf22a54af5ddff9edb77d8d357450bb3 /src
parent8f659f49ec54a722498465f618bb2fda1a9e34b5 (diff)
Expose struct DownloadHandle interface to public API directly
Diffstat (limited to 'src')
-rw-r--r--src/aria2api.cc65
-rw-r--r--src/aria2api.h17
-rw-r--r--src/includes/aria2/aria2.h31
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