PLCnext API Documentation  21.0.0.35466
File.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include <vector>
9 
10 namespace Arp { namespace System { namespace Commons { namespace Io
11 {
12 
14 class File
15 {
16 public: // typedefs
17 
18 public: // construction/destruction
19 
20  File(void) = delete;
21 
22  File(const File& arg) = delete;
23 
24  File& operator=(const File& arg) = delete;
25 
26  ~File(void) = delete;
27 
28 public: // static operations
29 
35  static bool Exists(const String& path);
36 
43  static void Delete(const String& path);
44 
55  static void Copy(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
56 
67  static void Move(const String& sourcePath, const String& destinationPath, bool createDirectory = true, bool overwrite = true);
68 
74  static std::vector<byte> ReadAll(const String& path);
75 
80  static void WriteAll(const String& path, const std::vector<byte>& data);
81 
82 public: // setter/getter operations
83 
84 public: // operations
85 
86 protected: // operations
87 
88 private: // static methods
89 
90 private: // methods
91 
92 private: // fields
93 
94 private: // static fields
95 
96 };
97 
99 // inline methods of class File
100 
101 }}}} // end of namespace Arp::System::Commons::Io
static void Move(const String &sourcePath, const String &destinationPath, bool createDirectory=true, bool overwrite=true)
Moves a file from source path to destination path.
static bool Exists(const String &path)
Checks for existence of a file.
static void WriteAll(const String &path, const std::vector< byte > &data)
Writes the data in data into file identified by path.
static std::vector< byte > ReadAll(const String &path)
Reads data from file and returns it as byte array.
Root namespace for the PLCnext API
static void Delete(const String &path)
Deletes the file from the filesystem.
API to manage and manipulate single files.
Definition: File.hpp:14
static void Copy(const String &sourcePath, const String &destinationPath, bool createDirectory=true, bool overwrite=true)
Copies a file from source path to destination path.
System components used by the System, Device, Plc or Io domains.