ost::DirTree(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

🌸 NAME 🌸

ost::DirTree β€” a generic class to walk a hierarchical directory structure. That's it, that's the whole vibe. πŸ’… It lives in the Library Functions Manual (section 3), iykyk.


✨ SYNOPSIS ✨

#include <file.h>

🫢 Public Member Functions

  • DirTree(const char *prefix, unsigned maxdepth) β€” construct a directory tree walk starting at the specified prefix.
  • DirTree(unsigned maxdepth) β€” construct an un-opened directory tree of a known maximum depth.
  • virtual ~DirTree() β€” the destructor. she's virtual, she's iconic.
  • void open(const char *prefix) β€” open a directory tree path.
  • void close(void) β€” close the directory path.
  • char *getPath(void) β€” extract the next full pathname from the directory walk.
  • unsigned perform(const char *prefix) β€” this is used to step through the filter virtual for an entire subtree, and it's for cases where a derived DirTree class performs its primary operations through filter rather than externally by calling getPath(). bestie said "I'll do it myself" 😀

πŸ”’ Protected Member Functions

  • virtual bool filter(const char *file, struct stat *ino) β€” virtual method to filter results.

πŸ“– Detailed Description

A generic class to walk a hierarchical directory structure. no notes, perfect, ate. πŸ”₯

πŸŽ€ Author

David Sugar dyfet@ostel.com

Directory tree walking. 🌈


πŸ—οΈ Constructor & Destructor Documentation

ost::DirTree::DirTree(const char *prefix, unsigned maxdepth)

Construct a directory tree walk starting at the specified prefix. You also gotta hand over a maximum subdirectory depth. depth check, but for directories. πŸ¦‹

Parameters

  • prefix β€” prefix to start walk.
  • maxdepth β€” subdirectory depth to examine.

ost::DirTree::DirTree(unsigned maxdepth)

Construct an un-opened directory tree of a known maximum depth. she's not opened yet, she's just... aware of her own limits. main character energy. πŸ‘‘

Parameters

  • maxdepth β€” subdirectory subdirectory depth.
okay yes it literally says "subdirectory subdirectory" twice in the original, I'm not gaslighting you πŸ™ˆ that's just what it says.

virtual ost::DirTree::~DirTree() [virtual]

The destructor. she cleans up. πŸ’…


πŸ”§ Member Function Documentation

void ost::DirTree::close(void)

Close the directory path. bye bestie, love u, see u next walk πŸ‘‹

virtual bool ost::DirTree::filter(const char *file, struct stat *ino) [protected], [virtual]

Virtual method to filter results. Important: virtual override methods should call the baseclass method to assure . and .. names are stripped out. don't skip that step, fr fr, or . and .. will be sitting in your results like uninvited guests at the function. 😭

Returns

  • true if current filename is accepted.

Parameters

  • file β€” path to examine
  • ino β€” info of type, date, etc.

char* ost::DirTree::getPath(void)

Extract the next full pathname from the directory walk. When returning directories, a / is appended. The returned string is a buffer of MAX_PATH size. so cute of her to hand you a whole buffer. ✨

Returns

  • path of next subdirectory entry or NULL.

void ost::DirTree::open(const char *prefix)

Open a directory tree path.

Parameters

  • prefix β€” directory path to open.

unsigned ost::DirTree::perform(const char *prefix)

This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs its primary operations through filter rather than externally by calling getPath(). it's giving "I contain my own chaos" and honestly? respect. 🫢

Returns

  • number of files and directories examined.

Parameters

  • prefix β€” directory path to examine.

πŸ‘‘ Author

Generated automatically by Doxygen for GNU CommonC++ from the source code.


and that's the whole page, bestie!! πŸ’– this little icon was built by GNU CommonC++ and stamped Sun Dec 27 2020 β€” now go walk some directories and slay. πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from