41#ifndef _DWMDIRECTORYENTRY_HH_
42#define _DWMDIRECTORYENTRY_HH_
45 #include <sys/types.h>
64 class DirectoryEntryFunctor
67 virtual bool operator () (DirectoryEntry & dirEntry)
85 e_typeCharacterSpecial = 0x02,
86 e_typeDirectory = 0x04,
87 e_typeBlockSpecial = 0x08,
89 e_typeSymbolicLink = 0x20,
111 const std::string &
Path()
const;
113 std::string RelativePath()
const;
161 uint8_t typeMask = 0xFF)
const;
163 bool GetChildren(std::vector<DirectoryEntry> & children,
164 DirectoryEntryFunctor & dirEntryFunc)
const;
166 uint32_t Recurse(DirectoryEntryFunctor & dirEntryFunc,
167 bool depthFirst =
false,
171 static std::mutex _readdirMtx;
176 static TypeEnum GetType(
const struct stat & statStruct);
177 static TypeEnum GetType(
const struct dirent & dirEntry);
180 DirectoryEntryFunctor & dirEntryFunc,
181 int depth,
bool depthFirst,
int maxDepth);
Encapsulates a directory entry (file, directory, FIFO, et. al.).
Definition DwmDirectoryEntry.hh:77
DirectoryEntry(const std::string &path, const DirectoryEntry *parent)
Construct from a path and a parent.
TypeEnum Type() const
Returns the DirectoryEntry's type.
bool IsDirectory() const
Returns true if the DirectoryEntry is a directory.
bool Exists() const
Returns true if the DirectoryEntry exists in the filesystem.
std::string BaseName() const
Returns the final component of the DirectoryEntry's path.
bool GetChildren(std::vector< DirectoryEntry > &children, uint8_t typeMask=0xFF) const
If the DirectoryEntry is a directory and has children, fills children with its direct children and re...
std::string DirName() const
Returns the name of the directory in which DirectoryEntry resides.
DirectoryEntry(const std::string &path)
Construct from a path.
std::string Extension() const
If the DirectoryEntry has dots ('.
TypeEnum
The types of DirectoryEntry objects.
Definition DwmDirectoryEntry.hh:82
const std::string & Path() const
Returns the DirectoryEntry's path.
const DirectoryEntry * Parent() const
If the DirectoryEntry has a parent, returns a pointer to it.
std::string RealPath() const
If the DirectoryEntry exists in the filesystem, returns its path with all symlinks,...