CurlFtp.h 1.1 KB

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