PLCnext API Documentation 25.0.2.69
File.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include <vector>
9
10namespace Arp { namespace System { namespace Commons { namespace Io
11{
12
14class File
15{
16public: // construction/destruction
17 File(void) = delete;
18
19public: // static operations
20 static bool Exists(const String& path);
21 static void Delete(const String& path);
22 static void Delete(const String& path, bool sync);
23 static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
24 static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory, bool overwrite, bool sync);
25 static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
26 static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory, bool overwrite, bool sync);
27 static std::vector<byte> ReadAll(const String& path);
28 static void WriteAll(const String& path, const std::vector<byte>& data);
29 static void WriteAll(const String& path, const std::vector<byte>& data, bool sync);
30 static void SyncAll(void);
31 static void Sync(const String& path);
32};
33
34}}}} // end of namespace Arp::System::Commons::Io
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
API to manage and manipulate single files.
Definition: File.hpp:15
static void Copy(const String &sourcePath, const String &destinationPath, bool createDirectory=true, bool overwrite=true)
Copies a file from source path to destination path. After successful operation, the synchronization o...
Definition: File.cpp:89
static std::vector< byte > ReadAll(const String &path)
Reads data from file and returns it as byte array.
Definition: File.cpp:229
static bool Exists(const String &path)
Checks for existence of a file.
Definition: File.cpp:23
static void Sync(const String &path)
Force file system synchronization for the given file.
Definition: File.cpp:295
static void Move(const String &sourcePath, const String &destinationPath, bool createDirectory=true, bool overwrite=true)
Moves a file from source path to destination path. After successful operation, the synchronization of...
Definition: File.cpp:159
static void Delete(const String &path)
Deletes the file from the filesystem. After successful operation, the synchronization of the file sys...
Definition: File.cpp:42
static void SyncAll(void)
Force global file system synchronization.
Definition: File.cpp:287
static void WriteAll(const String &path, const std::vector< byte > &data)
Writes the data in data into file identified by path. After successful operation, the synchronization...
Definition: File.cpp:259
Root namespace for the PLCnext API