PLCnext API Documentation 23.6.0.37
File.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
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 File(const File& arg) = delete;
19 File& operator=(const File& arg) = delete;
20 ~File(void) = delete;
21
22public: // static operations
28 static bool Exists(const String& path);
29
36 static void Delete(const String& path);
37
45 static void Delete(const String& path, bool sync);
46
57 static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
58
70 static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory, bool overwrite, bool sync);
71
82 static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
83
95 static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory, bool overwrite, bool sync);
96
102 static std::vector<byte> ReadAll(const String& path);
103
108 static void WriteAll(const String& path, const std::vector<byte>& data);
109
115 static void WriteAll(const String& path, const std::vector<byte>& data, bool sync);
116
119 static void SyncAll(void);
120
124 static void Sync(const String& path);
125};
126
128// inline methods of class File
129
130}}}} // end of namespace Arp::System::Commons::Io
API to manage and manipulate single files.
Definition: File.hpp:15
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...
static void Delete(const String &path)
Deletes the file from the filesystem. After successful operation, the synchronization of the file sys...
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...
static void Sync(const String &path)
Force file system synchronization for the given file.
static void Move(const String &sourcePath, const String &destinationPath, bool createDirectory, bool overwrite, bool sync)
Moves a file from source path to destination path.
static bool Exists(const String &path)
Checks for existence of a file.
static std::vector< byte > ReadAll(const String &path)
Reads data from file and returns it as byte array.
static void WriteAll(const String &path, const std::vector< byte > &data, bool sync)
Writes the data in data into file identified by path.
static void SyncAll(void)
Force global file system synchronization.
static void Delete(const String &path, bool sync)
Deletes the file from the filesystem.
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...
static void Copy(const String &sourcePath, const String &destinationPath, bool createDirectory, bool overwrite, bool sync)
Copies a file from source path to destination path.
@ System
System components used by the System, Device, Plc or Io domains.
Root namespace for the PLCnext API