CurlFtp.h 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #ifndef CURLFTP_H
  2. #define CURLFTP_H
  3. #include "curl.h"
  4. #include <string>
  5. class CurlFtp
  6. {
  7. public:
  8. CurlFtp();
  9. ~CurlFtp();
  10. /* 列出FTP文件夹 */
  11. static std::string listDir(const std::string &ftpUrl, const std::string &username, const std::string &password);
  12. /* 列出文件夹中的所有文件 */
  13. static bool listFiles(const std::string &ftpUrl, const std::string &username, const std::string &password);
  14. /* 检查文件夹是否存在 */
  15. // static bool isDirExists(const std::string &ftpUrl, const std::string &username, const std::string &password);
  16. /* 使用正则表达式提取出文件夹 */
  17. // static bool CurlFtp::extractDirectories(const std::string& responseString);
  18. /* 回调函数 */
  19. static size_t writeCallback(void *contents, size_t size, size_t nmemb, std::string *s);
  20. /* 创建文件夹 */
  21. static bool createDir(const std::string &ftpUrl, const std::string &username, const std::string &password, const std::string &dirName);
  22. };
  23. #endif /* CURLFTP_H */