OSDN Git Service

Update of Lithuanian translation (#496)
[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 "UnicodeString.h"
14 #include "FileVersion.h"
15
16 /**
17  * @brief Class for fileflags.
18  */
19 struct FileFlags
20 {
21         unsigned attributes; /**< Fileattributes for item */
22         FileFlags() : attributes(0) { }
23         void reset() { attributes = 0; } /// Reset fileattributes
24         String ToString() const;
25 };
26
27 /**
28  * @brief Information for file.
29  * This class stores basic information from a file or folder.
30  * Information consists of item name, times, size and attributes.
31  * Also version info can be get for files supporting it.
32  *
33  * @note times in are seconds since January 1, 1970.
34  * See Dirscan.cpp/fentry and Dirscan.cpp/LoadFiles()
35  */
36 struct DirItem
37 {
38         Poco::Timestamp ctime; /**< time of creation */
39         Poco::Timestamp mtime; /**< time of last modify */
40         Poco::File::FileSize size; /**< file size in bytes, FILE_SIZE_NONE (== -1) means file does not exist*/
41         boost::flyweight<String> filename; /**< filename for this item */
42         boost::flyweight<String> path; /**< full path (excluding filename) for the item */
43         FileVersion version; /**< string of fixed file version, eg, 1.2.3.4 */
44         FileFlags flags; /**< file attributes */
45         
46         enum : uint64_t { FILE_SIZE_NONE = UINT64_MAX };
47         DirItem() : ctime(0), mtime(0), size(DirItem::FILE_SIZE_NONE) { }
48         void SetFile(const String &fullPath);
49         String GetFile() const;
50         bool Update(const String &sFilePath);
51         void ClearPartial();
52 };