![]()  | 
  
    MySQL 8.4.7
    
   Source Code Documentation 
   | 
 
Class representing a directory in a file system. More...
#include <filesystem.h>
Classes | |
| class | DirectoryIterator | 
| Directory iterator for iterating over directory entries.  More... | |
Public Member Functions | |
| Directory (const std::string &path) | |
| Construct a directory instance.  More... | |
| Directory (const Path &path) | |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.  More... | |
| Directory (const Directory &)=default | |
| Directory & | operator= (const Directory &)=default | 
| ~Directory () | |
| DirectoryIterator | begin () | 
| Iterator to first entry.  More... | |
| DirectoryIterator | begin () const | 
| DirectoryIterator | cbegin () const | 
| Constant iterator to first entry.  More... | |
| DirectoryIterator | end () | 
| Iterator past-the-end of entries.  More... | |
| DirectoryIterator | end () const | 
| DirectoryIterator | cend () const | 
| Constant iterator past-the-end of entries.  More... | |
| bool | is_empty () const | 
| Check if the directory is empty.  More... | |
| std::vector< Path > | list_recursive () const | 
| Recursively list all paths in a directory.  More... | |
| DirectoryIterator | glob (const std::string &glob) | 
| Iterate over entries matching a glob.  More... | |
  Public Member Functions inherited from mysql_harness::Path | |
| Path () noexcept | |
| Path (std::string path) | |
| Construct a path.  More... | |
| Path (std::string_view path) | |
| Path (const char *path) | |
| bool | operator== (const Path &rhs) const | 
| bool | operator!= (const Path &rhs) const | 
| bool | operator< (const Path &rhs) const | 
| Path ordering operator.  More... | |
| FileType | type (bool refresh=false) const | 
| Get the file type.  More... | |
| bool | is_directory () const | 
| Check if the file is a directory.  More... | |
| bool | is_regular () const | 
| Check if the file is a regular file.  More... | |
| bool | is_absolute () const | 
| Check if the path is absolute or not.  More... | |
| bool | exists () const | 
| Check if path exists.  More... | |
| bool | is_readable () const | 
| Path | dirname () const | 
| Get the directory name of the path.  More... | |
| Path | basename () const | 
| Get the basename of the path.  More... | |
| void | append (const Path &other) | 
| Append a path component to the current path.  More... | |
| Path | join (const Path &other) const | 
| Join two path components to form a new path.  More... | |
| Path | real_path () const | 
| Returns the canonical form of the path, resolving relative paths.  More... | |
| const char * | c_str () const | 
| Get a C-string representation to the path.  More... | |
| const std::string & | str () const noexcept | 
| Get a string representation of the path.  More... | |
| bool | is_set () const noexcept | 
| Test if path is set.  More... | |
| operator bool () const noexcept | |
Additional Inherited Members | |
  Public Types inherited from mysql_harness::Path | |
| enum class | FileType {  STATUS_ERROR , EMPTY_PATH , FILE_NOT_FOUND , REGULAR_FILE , DIRECTORY_FILE , SYMLINK_FILE , BLOCK_FILE , CHARACTER_FILE , FIFO_FILE , SOCKET_FILE , TYPE_UNKNOWN }  | 
| Enum used to identify file types.  More... | |
  Static Public Member Functions inherited from mysql_harness::Path | |
| static Path | make_path (const Path &directory, const std::string &basename, const std::string &extension) | 
| Create a path from directory, basename, and extension.  More... | |
  Static Public Attributes inherited from mysql_harness::Path | |
| static const char *const | directory_separator = "/" | 
| Directory separator string.  More... | |
| static const char *const | root_directory = "/" | 
| Root directory string.  More... | |
Class representing a directory in a file system.
In addition to being a refinement of Path, it also have functions that make it act like a container of paths and support iterating over the entries in a directory.
An example of how it could be used is:
      
  | 
  inline | 
Construct a directory instance.
Construct a directory instance in different ways depending on the version of the constructor used.
| mysql_harness::Directory::Directory | ( | const Path & | path | ) | 
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
      
  | 
  default | 
      
  | 
  default | 
| Directory::DirectoryIterator mysql_harness::Directory::begin | ( | ) | 
Iterator to first entry.
      
  | 
  inline | 
| Directory::DirectoryIterator mysql_harness::Directory::cbegin | ( | ) | const | 
Constant iterator to first entry.
| Directory::DirectoryIterator mysql_harness::Directory::cend | ( | ) | const | 
Constant iterator past-the-end of entries.
| Directory::DirectoryIterator mysql_harness::Directory::end | ( | ) | 
Iterator past-the-end of entries.
      
  | 
  inline | 
| Directory::DirectoryIterator mysql_harness::Directory::glob | ( | const std::string & | glob | ) | 
Iterate over entries matching a glob.
| bool mysql_harness::Directory::is_empty | ( | ) | const | 
Check if the directory is empty.
| true | Directory is empty. | 
| false | Directory is no empty. | 
| std::vector< Path > mysql_harness::Directory::list_recursive | ( | ) | const | 
Recursively list all paths in a directory.
Recursively create a list of relative paths from a directory. Path will be relative to the given directory. Empty directories are also listed.