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

Class to represent a file system node (directory, file etc) More...

#include <FSNode.h>

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

Public Types

using Unique = std::unique_ptr<FSNode>
 Unique pointer.
 
using Shared = std::shared_ptr<FSNode>
 Unique pointer.
 

Public Member Functions

 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
 
virtual ClonerclonePtr () const =0
 

Static Public Attributes

static const utility::String pathDelimiter
 The path delimiter expression for the current platform.
 

Protected Member Functions

bool isMine () const noexcept
 
void setMine (bool state) noexcept
 

Detailed Description

Class to represent a file system node (directory, file etc)

Constructor & Destructor Documentation

◆ FSNode() [1/3]

FSNode::FSNode ( )
noexcept

Constructor

◆ FSNode() [2/3]

FSNode::FSNode ( const Path & path)

Constructor

Parameters
pathThe file node path
Exceptions
std::bad_allocThrown if memory allocation fails

◆ FSNode() [3/3]

FSNode::FSNode ( const FSNode & source)
noexcept

Copy constructor

Parameters
sourceThe object to copy

◆ ~FSNode()

virtual active::file::FSNode::~FSNode ( )
virtualdefaultnoexcept

Destructor

Member Function Documentation

◆ exists()

virtual bool active::file::FSNode::exists ( ) const
inlinevirtual

Test if the node actually exists

Exceptions
std::bad_allocThrown if memory allocation fails
Returns
True if the node exists
Here is the caller graph for this function:

◆ getModificationTime()

utility::Time active::file::FSNode::getModificationTime ( ) const
inline

Get the node modification time

Exceptions
std::bad_allocThrown if memory allocation fails
Returns
The node modification time

◆ getPath()

Path active::file::FSNode::getPath ( ) const
inlinenoexcept

Get the node path

Returns
The node path
Here is the caller graph for this function:

◆ isDirectory()

virtual bool active::file::FSNode::isDirectory ( ) const
inlinevirtual

Test if the node data points to a directory/folder

Exceptions
std::bad_allocThrown if memory allocation fails
Returns
True if this is a folder
Here is the caller graph for this function:

◆ isMine()

bool active::file::FSNode::isMine ( ) const
inlineprotectednoexcept

Determine if the node was created by this

Returns
True if the node was created by this

◆ moveTo()

void FSNode::moveTo ( const Path & path)
virtual

Move/rename the node path

Parameters
pathThe new path to assign to the node (moves/renames the node accordingly)
Exceptions
std::bad_allocThrown if memory allocation fails
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

FSNode & FSNode::operator= ( const FSNode & source)

Assignment operator

Parameters
sourceThe object to copy
Returns
A reference to this
Here is the caller graph for this function:

◆ operator==()

bool FSNode::operator== ( const FSNode & ref) const
noexcept

Equality operator

Parameters
refThe object to compare
Returns
True if ref is identical to this

◆ remove()

void FSNode::remove ( bool isRecursive = true)
virtual

Remove the node path

Parameters
isRecursiveTrue if any subnodes should also be recursively removed
Exceptions
std::bad_allocThrown if memory allocation fails

Reimplemented in active::file::File.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rename()

void FSNode::rename ( const utility::String & name)
virtual

Rename the node (just the last part of the name, i.e. the file/directory name)

Parameters
nameThe new name
Exceptions
std::bad_allocThrown if memory allocation fails
Here is the call graph for this function:

◆ setMine()

void active::file::FSNode::setMine ( bool state)
inlineprotectednoexcept

Set whether the node was created by this

Parameters
stateTrue if the node was created by this

◆ setPath()

void FSNode::setPath ( const Path & path)
virtual

Assign a node path (points to a new node without changing the previous node)

Parameters
pathThe new node path
Exceptions
std::bad_allocThrown if memory allocation fails
Here is the caller graph for this function:

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