浏览代码

Expose struct DownloadHandle interface to public API directly

Tatsuhiro Tsujikawa 12 年之前
父节点
当前提交
5e64d4c9a9
共有 3 个文件被更改,包括 16 次插入97 次删除
  1. 0 65
      src/aria2api.cc
  2. 0 17
      src/aria2api.h
  3. 16 15
      src/includes/aria2/aria2.h

+ 0 - 65
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

+ 0 - 17
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

+ 16 - 15
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