resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmFileTimes.h
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
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #include <memory>
8 #include <string>
9
10 /** \class cmFileTimes
11  * \brief Loads and stores file times.
12  */
13 class cmFileTimes
14 {
15 public:
16   cmFileTimes();
17   //! Calls Load()
18   cmFileTimes(std::string const& fileName);
19   ~cmFileTimes();
20
21   //! @return true, if file times were loaded successfully
22   bool IsValid() const { return (this->times != nullptr); }
23   //! Try to load the file times from @a fileName and @return IsValid()
24   bool Load(std::string const& fileName);
25   //! Stores the file times at @a fileName (if IsValid())
26   bool Store(std::string const& fileName) const;
27
28   //! Copies the file times of @a fromFile to @a toFile
29   static bool Copy(std::string const& fromFile, std::string const& toFile);
30
31 private:
32 #ifdef _WIN32
33   class WindowsHandle;
34 #endif
35   class Times;
36   std::unique_ptr<Times> times;
37 };