jaulib v1.3.0
Jau Support Library (C++, Java, ..)
TraverseEvent.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2022 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24package org.jau.fs;
25
26/**
27 * Filesystem traverse event used to call path_visitor for path elements from visit().
28 *
29 * This `enum class` type fulfills `C++ named requirements: BitmaskType`.
30 *
31 * @see FileUtil.PathVisitor
32 * @see FileUtil#visit(FileStats, TraverseOptions, org.jau.fs.FileUtil.PathVisitor)
33 */
34public enum TraverseEvent {
35 /** No value, neither file, symlink nor dir_entry or dir_exit. Implying an error state in file_stat, e.g. !file_stats::has_access(). */
36 none ( (short) 0 ),
37
38 /**
39 * Visiting a symbolic-link, either to a file or a non-existing entity. Not followed symbolic-links to a directory is expressed via dir_symlink.
40 *
41 * In case of a symbolic-link to an existing file, file is also set, i.e. file_symlink.
42 */
43 symlink ( (short) (1 << 0) ),
44
45 /** Visiting a file, may be in conjunction with symlink, i.e. file_symlink */
46 file ( (short) (1 << 1) ),
47
48 /** Visiting a symlink to a file, i.e. symlink | file */
49 file_symlink ( (short) ( 1 << 0 /* symmlink */ | 1 << 1 /* file */ ) ),
50
51 /**
52 * Visiting a symbolic-link to a directory which is not followed, i.e. traverse_options::follow_symlinks not set.
53 */
54 dir_symlink ( (short) (1 << 2) ),
55
56 /**
57 * Visiting a directory on entry, see traverse_options::dir_check_entry.
58 *
59 * This allows the path_visitor to deny traversal into the directory by returning false,
60 * otherwise continuing traversal.
61 */
62 dir_check_entry ( (short) (1 << 7) ),
63
64 /**
65 * Visiting a directory on entry, see traverse_options::dir_entry.
66 *
67 * If a directory is visited non-recursive, i.e. traverse_options::recursive not set,
68 * dir_entry and dir_exit are set, see dir_non_recursive.
69 *
70 * If a directory is a symbolic link which is not followed, i.e. traverse_options::follow_symlinks not set,
71 * dir_symlink is used instead.
72 */
73 dir_entry ( (short) (1 << 8) ),
74
75 /**
76 * Visiting a directory on exit, see traverse_options::dir_exit.
77 *
78 * If a directory is visited non-recursive, i.e. traverse_options::recursive not set,
79 * dir_entry and dir_exit are set, see dir_non_recursive.
80 *
81 * If a directory is a symbolic link which is not followed, i.e. traverse_options::follow_symlinks not set,
82 * dir_symlink is used instead.
83 */
84 dir_exit ( (short) (1 << 9) ),
85
86 /**
87 * Visiting a directory non-recursive, i.e. traverse_options::recursive not set.
88 *
89 * Value is a bit-mask of dir_entry | dir_exit
90 */
91 dir_non_recursive ( (short) ( 1 << 8 /* dir_entry */ | 1 << 9 /* dir_exit */ ) );
92
93 TraverseEvent(final short v) { value = v; }
94 public final short value;
95}
Filesystem traverse event used to call path_visitor for path elements from visit().
TraverseEvent(final short v)
dir_symlink
Visiting a symbolic-link to a directory which is not followed, i.e.
symlink
Visiting a symbolic-link, either to a file or a non-existing entity.
dir_check_entry
Visiting a directory on entry, see traverse_options::dir_check_entry.
dir_exit
Visiting a directory on exit, see traverse_options::dir_exit.
file
Visiting a file, may be in conjunction with symlink, i.e.
none
No value, neither file, symlink nor dir_entry or dir_exit.
dir_non_recursive
Visiting a directory non-recursive, i.e.
file_symlink
Visiting a symlink to a file, i.e.
dir_entry
Visiting a directory on entry, see traverse_options::dir_entry.