/src/CMake/Source/cmFileTimes.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <memory> |
8 | | #include <string> |
9 | | |
10 | | #include "cmsys/Status.hxx" |
11 | | |
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 |
24 | 0 | bool IsValid() const { return (this->times != nullptr); } |
25 | | //! Try to load the file times from @a fileName and @return IsValid() |
26 | | cmsys::Status Load(std::string const& fileName); |
27 | | //! Stores the file times at @a fileName (if IsValid()) |
28 | | cmsys::Status Store(std::string const& fileName) const; |
29 | | |
30 | | //! Copies the file times of @a fromFile to @a toFile |
31 | | static cmsys::Status Copy(std::string const& fromFile, |
32 | | std::string const& toFile); |
33 | | |
34 | | private: |
35 | | #ifdef _WIN32 |
36 | | class WindowsHandle; |
37 | | #endif |
38 | | class Times; |
39 | | std::unique_ptr<Times> times; |
40 | | }; |