11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #ifndef FILEPATH_H
27 #define FILEPATH_H
28
29 #include "Platform.h"
30 #include "PlatformString.h"
31
32 #include <vector>
33
34 enum FileAttribute {
35 #ifdef WINDOWS
36 faArchive = FILE_ATTRIBUTE_ARCHIVE,
37 faCompressed = FILE_ATTRIBUTE_COMPRESSED,
38 faDevice = FILE_ATTRIBUTE_DEVICE,
39 faDirectory = FILE_ATTRIBUTE_DIRECTORY,
40 faEncrypted = FILE_ATTRIBUTE_ENCRYPTED,
41 faHidden = FILE_ATTRIBUTE_HIDDEN,
42 //faIntegrityStream = FILE_ATTRIBUTE_INTEGRITY_STREAM,
43 faNormal = FILE_ATTRIBUTE_NORMAL,
44 faNotContentIndexed = FILE_ATTRIBUTE_NOT_CONTENT_INDEXED,
45 //faNoScrubData = FILE_ATTRIBUTE_NO_SCRUB_DATA,
46 faOffline = FILE_ATTRIBUTE_OFFLINE,
47 faSystem = FILE_ATTRIBUTE_SYSTEM,
48 faSymbolicLink = FILE_ATTRIBUTE_REPARSE_POINT,
49 faSparceFile = FILE_ATTRIBUTE_SPARSE_FILE,
50 faReadOnly = FILE_ATTRIBUTE_READONLY,
51 faTemporary = FILE_ATTRIBUTE_TEMPORARY,
52 faVirtual = FILE_ATTRIBUTE_VIRTUAL
53 #endif //WINDOWS
54 #ifdef POSIX
55 faBlockSpecial,
56 faCharacterSpecial,
57 faFIFOSpecial,
58 faNormal,
59 faDirectory,
60 faSymbolicLink,
61 faSocket,
62
63 // Owner
64 faReadOnly,
65 faWriteOnly,
66 faReadWrite,
67 faExecute,
68
69 // Group
70 faGroupReadOnly,
71 faGroupWriteOnly,
72 faGroupReadWrite,
73 faGroupExecute,
74
75 // Others
76 faOthersReadOnly,
77 faOthersWriteOnly,
78 faOthersReadWrite,
79 faOthersExecute,
80
81 faHidden
82 #endif //POSIX
83 };
84
85 class FileAttributes {
86 private:
87 TString FFileName;
88 bool FFollowLink;
89 std::vector<FileAttribute> FAttributes;
90
91 bool WriteAttributes();
92 bool ReadAttributes();
93 bool Valid(const FileAttribute Value);
94
95 public:
96 FileAttributes(const TString FileName, bool FollowLink = true);
97
98 void Append(const FileAttribute Value);
99 bool Contains(const FileAttribute Value);
100 void Remove(const FileAttribute Value);
101 };
102
103 class FilePath {
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 #ifndef FILEPATH_H
27 #define FILEPATH_H
28
29 #include "Platform.h"
30 #include "PlatformString.h"
31 #include "FileAttribute.h"
32
33 #include <vector>
34
35 class FileAttributes {
36 private:
37 TString FFileName;
38 bool FFollowLink;
39 std::vector<FileAttribute> FAttributes;
40
41 bool WriteAttributes();
42 bool ReadAttributes();
43 bool Valid(const FileAttribute Value);
44
45 public:
46 FileAttributes(const TString FileName, bool FollowLink = true);
47
48 void Append(const FileAttribute Value);
49 bool Contains(const FileAttribute Value);
50 void Remove(const FileAttribute Value);
51 };
52
53 class FilePath {
|