OSDN Git Service

Fix issue #2046: Folder compare omits unique folders from results if they contain...
[winmerge-jp/winmerge-jp.git] / Src / FileFlags.cpp
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /** 
3  * @file  FileFlags.cpp
4  *
5  * @brief Implementation for FileFlags routines
6  */
7
8 #include "pch.h"
9 #include <windows.h>
10 #include "FileFlags.h"
11 #include "UnicodeString.h"
12 #include "DebugNew.h"
13
14 /**
15         * @brief Convert file flags to string presentation.
16         * This function converts file flags to a string presentation that can be
17         * shown in the GUI.
18         * @return File flags as a string.
19         */
20 String FileFlags::ToString() const
21 {
22         tchar_t sflags[5], *p = sflags;
23         if (attributes & FILE_ATTRIBUTE_READONLY)
24                 *p++ = 'R';
25         if (attributes & FILE_ATTRIBUTE_HIDDEN)
26                 *p++ = 'H';
27         if (attributes & FILE_ATTRIBUTE_SYSTEM)
28                 *p++ = 'S';
29         if (attributes & FILE_ATTRIBUTE_ARCHIVE)
30                 *p++ = 'A';
31         return String{ sflags, p };
32 }
33