fileman.h 967 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef FILEMAN_H
  2. #define FILEMAN_H
  3. #include <fstream>
  4. #include <string>
  5. #include <vector>
  6. #define BLOCKSIZE 8
  7. class FileMan {
  8. private:
  9. std::ifstream putfile;
  10. std::ofstream getfile;
  11. std::string getname, putname;
  12. const unsigned int max_read_len = 8;
  13. int putchunks;
  14. int putsize;
  15. int putchunksRemaining;
  16. int getchunks;
  17. int getchunksRemaining;
  18. public:
  19. FileMan();
  20. ~FileMan();
  21. bool isGetting();
  22. bool isPutting();
  23. bool openPut(const std::string &name);
  24. bool openGet(const std::string &name);
  25. void closePut();
  26. void closeGet();
  27. std::string getPutName();
  28. std::string getGetName();
  29. void cancelPut();
  30. // closes and deletes getfile
  31. void cancelGet();
  32. void writeGet(std::vector<char> data);
  33. void writeBase64(std::string data);
  34. int getGetChunks();
  35. int getGetRemainingChunks();
  36. void setGetChunks(int chunks);
  37. std::vector<char> readPut();
  38. std::string readBase64();
  39. int getPutChunks();
  40. int getPutChunksRemaining();
  41. int getPutSize();
  42. };
  43. #endif