PLCnext API Documentation  21.0.0.35466
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Arp::System::Commons::Io::Directory Class Reference

API for manipulation and examiniation of directories of a file system. More...

#include <Directory.hpp>

Public Member Functions

 Directory (void)=delete
 Constructs an Directory instance. More...
 
 Directory (const Directory &arg)=delete
 Copy constructor. More...
 
Directoryoperator= (const Directory &arg)=delete
 Assignment operator. More...
 
 ~Directory (void)=delete
 Destructs this instance and frees all resources. More...
 
 ARP_DEPRECATED ("Please use Directory::Move() instead of Directory::Rename().") static void Rename(const String &sourcePath
 

Static Public Member Functions

static bool Exists (const String &path)
 Checks if a specific directory exists. More...
 
static void Create (const String &path)
 Creates a new directory. More...
 
static void Delete (const String &path)
 Deletes a directory. More...
 
static void Clear (const String &path)
 Deletes the complete content of a directory. More...
 
static void Copy (const String &sourcePath, const String &destinationPath, bool clear=false)
 Copies a directory and its content to a new location. More...
 
static void Move (const String &sourcePath, const String &destinationPath, bool overwrite=false)
 Moves a directory and its content to a new location. More...
 
static String GetCurrent (void)
 Returns the fully qualified path of the current directory. More...
 
static IEnumerator< String >::Ptr GetEnumerator (const String &path, bool recursive=false)
 Returns an enumerator listing the content of a directory. More...
 
static IEnumerator< String >::Ptr GetEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Returns an enumerator listing the content of a directory that matches the search pattern. More...
 
static IEnumerator< String >::Ptr GetFileEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr GetFileEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr GetDirectoryEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr GetDirectoryEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object. More...
 
static IEnumerator< String >::Ptr TryGetEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetFileEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetFileEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetDirectoryEnumerator (const String &path, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception. More...
 
static IEnumerator< String >::Ptr TryGetDirectoryEnumerator (const String &path, const char *searchPattern, bool recursive=false)
 Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception. More...
 

Public Attributes

const StringdestinationPath
 

Detailed Description

API for manipulation and examiniation of directories of a file system.

Constructor & Destructor Documentation

◆ Directory() [1/2]

Arp::System::Commons::Io::Directory::Directory ( void  )
delete

Constructs an Directory instance.

◆ Directory() [2/2]

Arp::System::Commons::Io::Directory::Directory ( const Directory arg)
delete

Copy constructor.

◆ ~Directory()

Arp::System::Commons::Io::Directory::~Directory ( void  )
delete

Destructs this instance and frees all resources.

Member Function Documentation

◆ ARP_DEPRECATED()

Arp::System::Commons::Io::Directory::ARP_DEPRECATED ( "Please use Directory::Move() instead of Directory::Rename()."  ) const &
Parameters
sourcePathFully qualified path of directory/file to rename.
destinationPathFully qualified path of destination.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder/file already exists
Arp::System::Commons::Io::NotExistExceptionif the source folder/file does not exist

</deprecated>

◆ Clear()

static void Arp::System::Commons::Io::Directory::Clear ( const String path)
static

Deletes the complete content of a directory.

Parameters
pathFully qualified path of directory to clear.
Exceptions
Arp::System::Commons::Io::NotExistExceptionif the directory to delete does not exist.
Arp::System::Commons::Io::AccessDeniedExceptionif the process does not have permission to delete the directory.

◆ Copy()

static void Arp::System::Commons::Io::Directory::Copy ( const String sourcePath,
const String destinationPath,
bool  clear = false 
)
static

Copies a directory and its content to a new location.

Parameters
sourcePathFully qualified path of directory to copy.
destinationPathFully qualified path of destination.
clearIf set to true and the destination folder already exists, it will be deleted beforehand. Default value is false.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder already exists and parameter clear is set to false.
Arp::System::Commons::Io::AccessDeniedExceptionif the destination folder already exists and can not be deleted in case clear is set to true.

◆ Create()

static void Arp::System::Commons::Io::Directory::Create ( const String path)
static

Creates a new directory.

Parameters
pathThe fully qualified path to the directory to create.
Exceptions
Arp::System::Commons::Io::AccessDeniedExceptionif the application lacks the rights to create a new directory at the specified location.
Arp::System::Commons::Io::AlreadyExistsExceptionif a file or directory with the specified path already exists.

◆ Delete()

static void Arp::System::Commons::Io::Directory::Delete ( const String path)
static

Deletes a directory.

Parameters
pathFully qualified path of directory to delete.
Exceptions
Arp::System::Commons::Io::NotExistExceptionif the directory to delete does not exist.
Arp::System::Commons::Io::AccessDeniedExceptionif the process does not have permission to delete the directory.

◆ Exists()

static bool Arp::System::Commons::Io::Directory::Exists ( const String path)
static

Checks if a specific directory exists.

Parameters
pathFully qualified path of directory to be checked.

◆ GetCurrent()

static String Arp::System::Commons::Io::Directory::GetCurrent ( void  )
static

Returns the fully qualified path of the current directory.

Returns
Fully qualified path of current directory.

◆ GetDirectoryEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetDirectoryEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.

s

Returns
A pointer to a valid enumeration object.

◆ GetDirectoryEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetDirectoryEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only directories are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ GetEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Returns an enumerator listing the content of a directory.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ GetEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Returns an enumerator listing the content of a directory that matches the search pattern.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ GetFileEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetFileEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.

s

Returns
A pointer to a valid enumeration object.

◆ GetFileEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::GetFileEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but only files are listed by the returned enumeration object.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object.

◆ Move()

static void Arp::System::Commons::Io::Directory::Move ( const String sourcePath,
const String destinationPath,
bool  overwrite = false 
)
static

Moves a directory and its content to a new location.

Parameters
sourcePathFully qualified path of directory to move.
destinationPathFully qualified path of destination.
overwriteIf set to true and destinationPath already exists, it will be overwritten.
Exceptions
Arp::System::Commons::Io::AlreadyExistsExceptionif the destination folder already exists and parameter clear is set to false.
Arp::System::Commons::Io::AccessDeniedExceptionif the destination folder already exists and can not be deleted in case clear is set to true.

◆ operator=()

Directory& Arp::System::Commons::Io::Directory::operator= ( const Directory arg)
delete

Assignment operator.

◆ TryGetDirectoryEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetDirectoryEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetDirectoryEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetDirectoryEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetFileEnumerator() [1/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetFileEnumerator ( const String path,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

◆ TryGetFileEnumerator() [2/2]

IEnumerator< String >::Ptr Arp::System::Commons::Io::Directory::TryGetFileEnumerator ( const String path,
const char *  searchPattern,
bool  recursive = false 
)
inlinestatic

Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception.

Parameters
pathThe fully qualified path of the directory to list the content of.
searchPatternA pattern each directory content must match to be included inside the enumeration object. E.g. "*.cpp".
recursiveSet to true if the contents of sub-directories should also be included in the enumeration object.
Returns
A pointer to a valid enumeration object or an empty enumerator object in case the directory does not exists.

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