OSDN Git Service

Avoid an assertion failure when loading settings from winmerge.ini
[winmerge-jp/winmerge-jp.git] / Src / DirItem.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** 
3  * @file  DirItem.h
4  *
5  * @brief Declaration file for DirItem
6  */
7 #pragma once
8
9 #define POCO_NO_UNWINDOWS 1
10 #include <Poco/File.h>
11 #include <Poco/Timestamp.h>
12 #include <boost/flyweight.hpp>
13 #include "FileFlags.h"
14 #include "UnicodeString.h"
15
16 /**
17  * @brief Information for file.
18  * This class stores basic information from a file or folder.
19  * Information consists of item name, times, size and attributes.
20  * Also version info can be get for files supporting it.
21  *
22  * @note times in are seconds since January 1, 1970.
23  * See Dirscan.cpp/fentry and Dirscan.cpp/LoadFiles()
24  */
25 struct DirItem
26 {
27         Poco::Timestamp ctime; /**< time of creation */
28         Poco::Timestamp mtime; /**< time of last modify */
29         Poco::File::FileSize size; /**< file size in bytes, FILE_SIZE_NONE (== -1) means file does not exist*/
30         boost::flyweight<String> filename; /**< filename for this item */
31         boost::flyweight<String> path; /**< full path (excluding filename) for the item */
32         FileFlags flags; /**< file attributes */
33         
34         enum : uint64_t { FILE_SIZE_NONE = UINT64_MAX };
35         DirItem() : ctime(0), mtime(0), size(DirItem::FILE_SIZE_NONE) { }
36         void SetFile(const String &fullPath);
37         String GetFile() const;
38         bool Update(const String &sFilePath);
39         void ClearPartial();
40 };