cmFileTimes.h 1016 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <memory>
  6. #include <string>
  7. /** \class cmFileTimes
  8. * \brief Loads and stores file times.
  9. */
  10. class cmFileTimes
  11. {
  12. public:
  13. cmFileTimes();
  14. //! Calls Load()
  15. cmFileTimes(std::string const& fileName);
  16. ~cmFileTimes();
  17. //! @return true, if file times were loaded successfully
  18. bool IsValid() const { return (this->times != nullptr); }
  19. //! Try to load the file times from @a fileName and @return IsValid()
  20. bool Load(std::string const& fileName);
  21. //! Stores the file times at @a fileName (if IsValid())
  22. bool Store(std::string const& fileName) const;
  23. //! Copies the file times of @a fromFile to @a toFile
  24. static bool Copy(std::string const& fromFile, std::string const& toFile);
  25. private:
  26. #ifdef _WIN32
  27. class WindowsHandle;
  28. #endif
  29. class Times;
  30. std::unique_ptr<Times> times;
  31. };