File.hpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-15
  6. * Changed: 2020-08-15
  7. *
  8. * */
  9. #ifndef FILE_HPP
  10. #define FILE_HPP
  11. #include "../base/Class.hpp"
  12. #include <string>
  13. namespace ls_std {
  14. class File : public Class {
  15. public:
  16. explicit File(std::string _absoluteFilePath);
  17. ~File() = default;
  18. // comparison operators
  19. bool operator==(File& _file);
  20. bool operator!=(File& _file);
  21. // additional functionality
  22. bool canExecute();
  23. void create();
  24. bool exists();
  25. std::string getAbsoluteFilePath();
  26. std::string getName();
  27. long getSize();
  28. bool isDirectory();
  29. bool isFile();
  30. void makeDirectory();
  31. void remove();
  32. private:
  33. std::string absoluteFilePath {};
  34. bool _exists();
  35. bool _isDirectory();
  36. bool _isFile();
  37. static int _mkdir(const std::string& path);
  38. static std::string _normalizePath(std::string path);
  39. };
  40. }
  41. #endif