lhfileremote.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef LHFILEREMOTE_H
  2. #define LHFILEREMOTE_H
  3. #include <QString>
  4. //class QFile;
  5. struct SUsreDate
  6. {
  7. char btRequestType;//请求类型 0:获取授权令牌 1:任务请求 2:状态请求
  8. void* pOwner;
  9. QString strContent;
  10. char* buffer;
  11. int buffersize;
  12. };
  13. struct SUpDownData
  14. {
  15. char* pBuffer; //内存指针
  16. FILE* pFile; //文件指针
  17. qint64 llTotal; //总共要写的字节
  18. qint64 llCurrent; //当前写的字节
  19. long* nProgress; //进度 0-100
  20. qint64 llBaseSize; //开始写的基础位置(相对于总字节)
  21. };
  22. class CLHFileRemote
  23. {
  24. public:
  25. CLHFileRemote(void);
  26. ~CLHFileRemote(void);
  27. bool LoginServer(const QString& lpszPath, const QString& lpszUser, const QString& lpszPwd);
  28. size_t curl_ReceivePost(SUsreDate* ud);
  29. bool curl_Post(const QString& strUrl,const QString& strContent);
  30. bool curl_IsFileExist(const QString& strRemoteFile);
  31. bool curl_Upload(const char* szLocalFile, const char* szRemoteFile,const char* szUser,const char* szPwd);
  32. bool curl_Download(const char* szLocalFile, const char* szRemoteFile,const char* szUser,const char* szPwd,qint64 llSize,qint64 llEnd,bool bAppendFile,qint64 nTotal,qint64 nBaseSize,long& nProgress);
  33. qint64 curl_Read(char* pBuffer,const char* szRemoteFile,const char* szUser,const char* szPwd,qint64 llStart,qint64 llSize,long& nProgress);
  34. qint64 curl_GetFileLength(const char* szRemoteFile,const char* szUser,const char* szPwd);
  35. QString GetLastError() {return m_strError;}
  36. protected:
  37. //CString UTF8ToGBK(CString str);
  38. //CString GBKToUTF8(CString& str);
  39. QString m_strError;
  40. char m_btCurlPASV;
  41. public:
  42. QString m_strErrorPostContent;
  43. };
  44. #endif // LHFILEREMOTE_H