236 return int(type) < 2;
266 "FILES",
"Cant get count for file type \"{}\"", type )
385 [[nodiscard]]
constexpr bool IsDirectory () const noexcept {
return int(
bits.Type) < 2; }
410 [[nodiscard]]
constexpr uint32_t
Owner () const noexcept {
return owner; }
412 [[nodiscard]]
constexpr uint32_t
Group () const noexcept {
return group; }
434 #if ALIB_DEBUG && !ALIB_DEBUG_ASSERTION_PRINTABLES
436 "Requesting sums for FInfo that is not a directory.")
438 "Requesting sums for FInfo that has no sums set. Quality: ",
Quality() )
456 "Given node is not a directory or symbolic link pointing to a directory.")
476 "FILES",
"Given node is not a symbolic link." )
490 "FILES",
"Given node is not a symbolic link." )
539 #if !defined( _WIN32)
548 #if DOXYGEN || !defined( _WIN32)
553 : ownerCache(poolAllocator, 6,6)
554 , groupCache(poolAllocator, 6,6) {}
574 #elif !defined( _WIN32)
576 { ownerCache.
Reserve( numberOfLists, entriesPerList ); }
578 { groupCache.
Reserve( numberOfLists, entriesPerList); }
void Reserve(integer newQtyLists, integer newQtyEntriesPerList)
The entry type which is embedded in each tree node.
void SetType(Types v) noexcept
Sets the type of the entry.
system::CPathString & GetRealLinkTarget() const noexcept
void SetCrossingFS() noexcept
Mark the entry as residing on a different filesystem than its parent.
void SetOwner(uint32_t v) noexcept
Sets the ID of the owner of the file/folder.
constexpr uint32_t Group() const noexcept
constexpr Types Type() const noexcept
constexpr DateTime ADate() const noexcept
constexpr bool IsArtificialFS() const noexcept
void SetADate(DateTime v) noexcept
Sets the time of last access of this file/folder.
constexpr ExtendedEntryInfo * GetExtendedInfo() const
void * custom
Pool-allocated custom data.
void SetTargetCrossingFS() noexcept
Mark the entry as a symlink who's target is residing on a different filesystem than the symlink.
void SetSize(uinteger v) noexcept
Sets the file size.
constexpr bool IsCrossingFS() const noexcept
friend class File
Allow access from within class File.
void SetTargetArtificialFS() noexcept
Mark the entry as a symlink who's target is residing on an artificial filesystem.
const std::type_info * dbgCustomType
The custom type attached. Used for asserting misuse in debug-compilations.
constexpr bool TargetIsCrossingFS() const noexcept
void SetQtyHardlinks(uint32_t v) noexcept
Sets the number of hard links that point to this file.
constexpr DateTime MDate() const noexcept
uint32_t qtyHardLinks
The number of hard links to the file.
constexpr bool IsDirectory() const noexcept
constexpr uinteger Size() const noexcept
void SetGroup(uint32_t v) noexcept
Sets the ID of the group of the file/folder.
void SetCDate(DateTime v) noexcept
Sets the change date of this file/folder.
void SetArtificialFS() noexcept
Mark the entry as residing on an artificial filesystem.
constexpr uint32_t QtyHardLinks() const noexcept
void SetPerms(Permissions v) noexcept
Sets the permissions of the entry.
uint32_t owner
The user id that owns the file.
uint32_t group
The group id that owns the file.
system::CPathString & GetLinkTarget() const noexcept
void SetLinkTarget(FTree &tree, const system::PathString &target, const system::PathString &realTarget)
constexpr uint32_t Owner() const noexcept
constexpr bool IsSymbolicLink() const noexcept
uint32_t TOwnerAndGroupID
Type definition for owner and group ids.
constexpr DateTime BDate() const noexcept
Bits bits
A bitfield encoding various information.
friend class FTree
Allow access from within class File.
constexpr void SetSums(const DirectorySums &sums) const
constexpr DateTime CDate() const noexcept
static constexpr TOwnerAndGroupID UnknownID
Constant value for owner and group IDs to denote that the field was not determined.
@ MARKER_TYPES_END
A marker for the last countable type. The rest are unused/errors.
@ DIRECTORY
Directory/folder.
@ CHARACTER
A character special file.
@ BLOCK
A block special file.
@ FIFO
A FIFO (also known as pipe) file.
constexpr Permissions Perms() const noexcept
void SetQuality(Qualities v) noexcept
Sets the quality of scan of the entry.
constexpr bool TargetIsArtificialFS() const noexcept
uinteger size
The file size. In case of a directory, this is 0.
void SetBDate(DateTime v) noexcept
Sets the birth date of this file/folder.
constexpr DirectorySums & Sums() const
constexpr void SetExtendedInfo(ExtendedEntryInfo *extInfo)
Qualities
Per-entry information about how a node was scanned.
@ RECURSIVE
Follow symlink target strings.
@ STATS
Only stats (size, date, owner, etc.) read.
@ NO_ACCESS_DIR
Scanner failure due to limited access rights.
@ MAX_DEPTH_REACHED
Scanner stopped, because maximum depth was reached.
@ NOT_CROSSING_FS
A directory that represented a mounted filesystem was not followed due to field.
@ RESOLVED
Read symlink target strings.
@ NO_ACCESS_SL
Scanner failure due to limited access rights.
@ UNKNOWN_ERROR
Unknown scanner failure.
@ BROKEN_LINK
A symbolic link targets a non-existent file or directory.
@ NO_ACCESS_SL_TARGET
Scanner failure due to limited access rights.
@ NOT_FOLLOWED
A symbolic link that targets a directory, but scan parameters specify not to follow.
@ NO_ACCESS
Scanner failure due to limited access rights.
@ NOT_EXISTENT
Set if a given start path does not exist.
constexpr Qualities Quality() const noexcept
Permissions
Permission flags. Compatible with posix* definition.
@ MASK
All valid permission bits. Equivalent to all | set_uid | set_gid | sticky_bit.
@ GROUP_READ
Posix S_IRGRP: The file's user group has read permission.
@ OTHERS_ALL
Posix S_IRWXO: Other users have read, write, and execute/search permissions Equivalent to others_read...
@ GROUP_EXEC
Posix S_IXGRP: The file's user group has execute/search permission.
@ OTHERS_EXEC
Posix S_IXOTH: Other users have execute/search permission.
@ GROUP_WRITE
Posix S_IWGRP: The file's user group has write permission.
@ ALL
All users have read, write, and execute/search permissions Equivalent to owner_all | group_all | othe...
@ UNKNOWN
Unknown permissions (e.g., when not read, or filesystem does not support permissions)
@ OWNER_ALL
Posix S_IRWXU: File owner has read, write, and execute/search permissions Equivalent to owner_read | ...
@ OWNER_READ
Posix S_IRUSR: File owner has read permission.
@ STICKY_BIT
Posix S_ISVTX: Implementation-defined meaning, but POSIX XSI specifies that when set on a directory,...
@ SET_UID
Posix S_ISUID: Set user ID to file owner user ID on execution.
@ OWNER_EXEC
Posix S_IXUSR: File owner has execute/search permission.
@ SET_GID
Posix S_ISGID: Set group ID to file's user group ID on execution.
@ NONE
no permission bits are set
@ OWNER_WRITE
Posix S_IWUSR: File owner has write permission.
@ OTHERS_READ
Posix S_IROTH: Other users have read permission.
@ OTHERS_WRITE
Posix S_IWOTH: Other users have write permission.
@ GROUP_ALL
Posix S_IRWXG: The file's user group has read, write, and execute/search permissions Equivalent to gr...
ExtendedEntryInfo * extendedInfo
Extended information, depending on the entry type.
void SetMDate(DateTime v) noexcept
Sets the last modification date of this file/folder.
ALIB_DLL const NString & GetOwnerName(const FInfo &fInfo)
void SetGroupCacheCapacity(integer numberOfLists, integer entriesPerList)
ALIB_DLL const NString & GetGroupName(const FInfo &fInfo)
void SetOwnerCacheCapacity(integer numberOfLists, integer entriesPerList)
OwnerAndGroupResolver(PoolAllocator &poolAllocator)
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
#define ALIB_ENUMS_MAKE_ITERABLE(TEnum, StopElement)
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
#define ALIB_ASSERT_ERROR(cond, domain,...)
#define ALIB_RESOURCED_IN_MODULE(T, Camp, ResName)
strings::TCString< PathCharType > CPathString
The string-type used with this ALib Module.
strings::TString< PathCharType > PathString
The string-type used with this ALib Module.
containers::LRUCacheTable< TAllocator, containers::TPairDescriptor< TKey, TMapped > > LRUCacheMap
Type alias in namespace alib.
files::FInfo FInfo
Type alias in namespace alib.
time::DateTime DateTime
Type alias in namespace alib.
files::OwnerAndGroupResolver OwnerAndGroupResolver
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
monomem::TPoolAllocator< MonoAllocator > PoolAllocator
strings::TString< nchar > NString
Type alias in namespace alib.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
lang::uinteger uinteger
Type alias in namespace alib.
A bitfield encoding various information.
bool TargetIsCrossingFS
Denotes whether a link points to a mount point.
bool IsArtificialFS
Denotes whether the file resides in an artificial filesystem.
bool TargetIsArtificialFS
Denotes whether a link points into an artificial filesystem.
Qualities Quality
The scan quality.
Bits()
Default constructor. Sets all members to NONE, false or Error.
bool IsCrossingFS
Denotes whether the file is a mount point.
Permissions Permission
The unix file-permissions.
Recursively accumulated values for directories.
uinteger Size
The cumulated sizes of all files and directories.
uint32_t QtyErrsAccess
Number of access errors in the folder and subfolders.
constexpr bool IsDirType(Types type) const noexcept
uint32_t CountNonDirectories() const noexcept
uint32_t QtyErrsBrokenLink
Number of broken symbolic links in the directory and its subfolders.
DirectorySums & operator-=(const DirectorySums &rhs)
uint32_t CountDirectories() const noexcept
uint32_t Count() const noexcept
uint32_t Count(Types type) const noexcept
uint32_t QtyStopsOnCircularLinks
Number of recursion aborts due to detected circular links reach of maximum recursion depth.
uint32_t QtyStopsOnMaxDepth
Number of recursion aborts due to reach of maximum recursion depth.
std::array< uint32_t, size_t(Types::MARKER_TYPES_END)> TypeCounters
Per-type counters.
constexpr DirectorySums() noexcept=default
Defaulted default constructor.
constexpr DirectorySums & Add(const FInfo &finfo) noexcept
DirectorySums Sums
The recursive sums evaluated during scan.
DirectorySums Sums
The recursive sums evaluated during scan.
system::CPathString RealTarget
The resolved real target path.
system::CPathString Target
This is a zero-terminated CString.
Base type to create pointers to different extended entry information structs.