| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 1 | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
| Kitware Robot | 1772622 | 2025-03-03 02:08:52 | [diff] [blame] | 2 | file LICENSE.rst or https://cmake.org/licensing for details. */ |
| Kitware Robot | bdca8b0 | 2020-08-29 20:27:37 | [diff] [blame] | 3 | #pragma once |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 4 | |
| 5 | #include "cmConfigure.h" // IWYU pragma: keep |
| 6 | |
| Brad King | 71fbebd | 2019-07-10 15:38:48 | [diff] [blame] | 7 | #include <memory> |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 8 | #include <string> |
| 9 | |
| Ben Boeckel | 0639a32 | 2023-12-02 03:36:00 | [diff] [blame] | 10 | #include "cmsys/Status.hxx" |
| 11 | |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 12 | /** \class cmFileTimes |
| 13 | * \brief Loads and stores file times. |
| 14 | */ |
| 15 | class cmFileTimes |
| 16 | { |
| 17 | public: |
| 18 | cmFileTimes(); |
| 19 | //! Calls Load() |
| 20 | cmFileTimes(std::string const& fileName); |
| 21 | ~cmFileTimes(); |
| 22 | |
| 23 | //! @return true, if file times were loaded successfully |
| Oleksandr Koval | 209daa2 | 2021-01-05 12:32:36 | [diff] [blame] | 24 | bool IsValid() const { return (this->times != nullptr); } |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 25 | //! Try to load the file times from @a fileName and @return IsValid() |
| Ben Boeckel | 0639a32 | 2023-12-02 03:36:00 | [diff] [blame] | 26 | cmsys::Status Load(std::string const& fileName); |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 27 | //! Stores the file times at @a fileName (if IsValid()) |
| Ben Boeckel | 0639a32 | 2023-12-02 03:36:00 | [diff] [blame] | 28 | cmsys::Status Store(std::string const& fileName) const; |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 29 | |
| 30 | //! Copies the file times of @a fromFile to @a toFile |
| Ben Boeckel | 0639a32 | 2023-12-02 03:36:00 | [diff] [blame] | 31 | static cmsys::Status Copy(std::string const& fromFile, |
| 32 | std::string const& toFile); |
| Sebastian Holtermann | 4b45a5d | 2019-05-21 21:36:40 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | #ifdef _WIN32 |
| 36 | class WindowsHandle; |
| 37 | #endif |
| 38 | class Times; |
| 39 | std::unique_ptr<Times> times; |
| 40 | }; |