8#include "Arp/System/Core/IEnumerator.hxx"
9#include <boost/regex.hpp>
11namespace Arp {
namespace System {
namespace Commons {
namespace Io
88 static void Copy(
const String& sourcePath,
const String& destinationPath,
bool clear =
false);
99 static void Copy(
const String& sourcePath,
const String& destinationPath,
bool clear,
bool sync);
109 static void Move(
const String& sourcePath,
const String& destinationPath,
bool overwrite =
false);
120 static void Move(
const String& sourcePath,
const String& destinationPath,
bool overwrite,
bool sync);
131 static
void Rename(const
String& sourcePath, const
String& destinationPath);
252 static
IEnumerator<
String>::Ptr GetSearchEnumerator(const
String& path, const
char* searchPattern,
bool recursive,
bool files,
bool directories);
254 static
IEnumerator<
String>::Ptr TryGetSearchEnumerator(const
String& path, const
char* searchPattern,
bool recursive,
bool files,
bool directories);
257 template<class Iterator>
263 Enumerator(
const String& path,
bool files,
bool directories,
bool& error);
266 bool MoveNext(
void)
override;
270 Iterator boostIterator;
277 template<
class Iterator>
278 class SearchEnumerator :
public IEnumerator<String>
283 SearchEnumerator(
const String& path,
const String& searchPattern,
bool files,
bool directories,
bool& error);
286 bool MoveNext(
void)
override;
290 static String NormalizeSearchPattern(
const String& searchPattern);
293 boost::regex searchRegex;
294 Iterator boostIterator;
303 friend class Directory;
306 EmptyEnumerator() =
default;
309 bool MoveNext(
void)
override
330 return Directory::GetSearchEnumerator(path, searchPattern, recursive,
true,
true);
340 return Directory::GetSearchEnumerator(path, searchPattern, recursive,
true,
false);
350 return Directory::GetSearchEnumerator(path, searchPattern, recursive,
false,
true);
360 return Directory::TryGetSearchEnumerator(path, searchPattern, recursive,
true,
true);
370 return Directory::TryGetSearchEnumerator(path, searchPattern, recursive,
true,
false);
380 return Directory::TryGetSearchEnumerator(path, searchPattern, recursive,
false,
true);
Declares the interface of the enumerator pattern, which is leaned on .NET enumerator idiom.
Definition: IEnumerator.hxx:48
API for manipulation and examiniation of directories of a file system.
Definition: Directory.hpp:16
static void Create(const String &path)
Creates a new directory. After successful operation, the synchronization of the file system will be f...
static void Copy(const String &sourcePath, const String &destinationPath, bool clear, bool sync)
Copies a directory and its content to a new location.
static void Delete(const String &path)
Deletes a directory. After successful operation, the synchronization of the file system will be force...
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 return...
Definition: Directory.hpp:343
static bool Exists(const String &path)
Checks if a specific directory exists.
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 enu...
Definition: Directory.hpp:333
static IEnumerator< String >::Ptr GetEnumerator(const String &path, bool recursive=false)
Returns an enumerator listing the content of a directory.
Definition: Directory.hpp:323
static void Sync(const String &path)
Force file system synchronization for the given file.
static IEnumerator< String >::Ptr TryGetDirectoryEnumerator(const String &path, bool recursive=false)
Like Arp::System::Commons::Io::Directory::GetDirectoryEnumerator but will not throw any exception.
Definition: Directory.hpp:373
static void Create(const String &path, bool sync)
Creates a new directory.
static void Move(const String &sourcePath, const String &destinationPath, bool overwrite, bool sync)
Moves a directory and its content to a new location.
static IEnumerator< String >::Ptr TryGetFileEnumerator(const String &path, bool recursive=false)
Like Arp::System::Commons::Io::Directory::GetFileEnumerator but will not throw any exception.
Definition: Directory.hpp:363
static void Clear(const String &path)
Deletes the complete content of a directory. After successful operation, the synchronization of the f...
static void Delete(const String &path, bool sync)
Deletes a directory.
static void Copy(const String &sourcePath, const String &destinationPath, bool clear=false)
Copies a directory and its content to a new location. After successful operation, the synchronization...
static IEnumerator< String >::Ptr TryGetEnumerator(const String &path, bool recursive=false)
Like Arp::System::Commons::Io::Directory::GetEnumerator but will not throw any exception.
Definition: Directory.hpp:353
static String GetCurrent(void)
Returns the fully qualified path of the current directory.
static void SyncAll(void)
Force global file system synchronization.
ARP_DEPRECATED("Please use Directory::Move() instead of Directory::Rename().") static void Rename(const String &sourcePath
static void Move(const String &sourcePath, const String &destinationPath, bool overwrite=false)
Moves a directory and its content to a new location. After successful operation, the synchronization ...
static void Clear(const String &path, bool sync)
Deletes the complete content of a directory.
static const SelfType Empty
An emtpy static string instance.
Definition: BasicString.hxx:224
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API