blob: d3ad3f6262a0725dea9760362271b5aa42f7609e [file] [log] [blame]
Sebastian Holtermann4b45a5d2019-05-21 21:36:401/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
Kitware Robot17726222025-03-03 02:08:522 file LICENSE.rst or https://cmake.org/licensing for details. */
Kitware Robotbdca8b02020-08-29 20:27:373#pragma once
Sebastian Holtermann4b45a5d2019-05-21 21:36:404
5#include "cmConfigure.h" // IWYU pragma: keep
6
Brad King71fbebd2019-07-10 15:38:487#include <memory>
Sebastian Holtermann4b45a5d2019-05-21 21:36:408#include <string>
9
Ben Boeckel0639a322023-12-02 03:36:0010#include "cmsys/Status.hxx"
11
Sebastian Holtermann4b45a5d2019-05-21 21:36:4012/** \class cmFileTimes
13 * \brief Loads and stores file times.
14 */
15class cmFileTimes
16{
17public:
18 cmFileTimes();
19 //! Calls Load()
20 cmFileTimes(std::string const& fileName);
21 ~cmFileTimes();
22
23 //! @return true, if file times were loaded successfully
Oleksandr Koval209daa22021-01-05 12:32:3624 bool IsValid() const { return (this->times != nullptr); }
Sebastian Holtermann4b45a5d2019-05-21 21:36:4025 //! Try to load the file times from @a fileName and @return IsValid()
Ben Boeckel0639a322023-12-02 03:36:0026 cmsys::Status Load(std::string const& fileName);
Sebastian Holtermann4b45a5d2019-05-21 21:36:4027 //! Stores the file times at @a fileName (if IsValid())
Ben Boeckel0639a322023-12-02 03:36:0028 cmsys::Status Store(std::string const& fileName) const;
Sebastian Holtermann4b45a5d2019-05-21 21:36:4029
30 //! Copies the file times of @a fromFile to @a toFile
Ben Boeckel0639a322023-12-02 03:36:0031 static cmsys::Status Copy(std::string const& fromFile,
32 std::string const& toFile);
Sebastian Holtermann4b45a5d2019-05-21 21:36:4033
34private:
35#ifdef _WIN32
36 class WindowsHandle;
37#endif
38 class Times;
39 std::unique_ptr<Times> times;
40};