ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
active::file::Directory Class Reference

Class to represent a directory. More...

#include <Directory.h>

Inheritance diagram for active::file::Directory:
Inheritance graph
[legend]
Collaboration diagram for active::file::Directory:
Collaboration graph
[legend]

Public Types

using Unique = std::unique_ptr<Directory>
 Unique pointer.
 
using iterator = std::filesystem::directory_iterator
 
- Public Types inherited from active::file::FSNode
using Unique = std::unique_ptr<FSNode>
 Unique pointer.
 
using Shared = std::shared_ptr<FSNode>
 Unique pointer.
 

Public Member Functions

 Directory ()
 
 Directory (const Path &path, bool isMissingCreated=false, bool canReplaceFile=false)
 
 Directory (const Directory &parent, const utility::String &name, bool isMissingCreated=false, bool canReplaceFile=false)
 
 Directory (const Directory &source) noexcept
 
virtual DirectoryclonePtr () const override
 
iterator begin () const
 
iterator end () const
 
- Public Member Functions inherited from active::file::FSNode
 FSNode () noexcept
 
 FSNode (const Path &path)
 
 FSNode (const FSNode &source) noexcept
 
virtual ~FSNode () noexcept=default
 
FSNodeoperator= (const FSNode &source)
 
bool operator== (const FSNode &ref) const noexcept
 
Path getPath () const noexcept
 
virtual bool exists () const
 
virtual bool isDirectory () const
 
utility::Time getModificationTime () const
 
virtual void setPath (const Path &path)
 
virtual void moveTo (const Path &path)
 
virtual void rename (const utility::String &name)
 
virtual void remove (bool isRecursive=true)
 
- Public Member Functions inherited from active::utility::Cloner
virtual ~Cloner ()=default
 

Static Public Member Functions

static Directory current ()
 
static Directory temporary ()
 

Additional Inherited Members

- Static Public Attributes inherited from active::file::FSNode
static const utility::String pathDelimiter
 The path delimiter expression for the current platform.
 
- Protected Member Functions inherited from active::file::FSNode
bool isMine () const noexcept
 
void setMine (bool state) noexcept
 

Detailed Description

Class to represent a directory.

Constructor & Destructor Documentation

◆ Directory() [1/4]

Directory::Directory ( )

Constructor

Here is the caller graph for this function:

◆ Directory() [2/4]

Directory::Directory ( const Path & path,
bool isMissingCreated = false,
bool canReplaceFile = false )

Constructor

Parameters
pathA full path to the directory
isMissingCreatedTrue if the folder should be created when missing
canReplaceFileTrue if the directory can be created and replace an existing file with the same name
Exceptions
std::ios_base::failureThrown if isMissingCreated = true and the directory cannot be created
Here is the call graph for this function:

◆ Directory() [3/4]

Directory::Directory ( const Directory & parent,
const utility::String & name,
bool isMissingCreated = false,
bool canReplaceFile = false )

Constructor

Parameters
parentThe parent directory
nameThe directory name
isMissingCreatedTrue if the folder should be created when missing
canReplaceFileTrue if the directory can be created and replace an existing file with the same name
Exceptions
std::ios_base::failureThrown if isMissingCreated = true and the directory cannot be created

◆ Directory() [4/4]

Directory::Directory ( const Directory & source)
noexcept

Copy constructor

Parameters
sourceThe object to copy

Member Function Documentation

◆ begin()

Directory::iterator Directory::begin ( ) const

Get an iterator at the first directory entry

Returns
An iterator at the first entry
Here is the call graph for this function:

◆ clonePtr()

virtual Directory * active::file::Directory::clonePtr ( ) const
inlineoverridevirtual

Clone method

Returns
A clone of this object

Implements active::utility::Cloner.

Here is the call graph for this function:

◆ current()

Directory Directory::current ( )
static

Get the current directory

Exceptions
std::filesystem::filesystem_errorThrows if an error occurs
Returns
The current directory
Here is the call graph for this function:

◆ end()

Directory::iterator Directory::end ( ) const

Get an iterator at the directory end (past the last entry)

Returns
The end iterator

◆ temporary()

Directory Directory::temporary ( )
static

Get a directory for temporary files

Exceptions
std::bad_alloc::filesystem_errorThrows if memory allocation occurs
Returns
The directory for temporary files
Here is the call graph for this function:

The documentation for this class was generated from the following files: