FAST.Framework  1.0.0
FFile.h
1 /****************************************************************************
2 **
3 ** FAST.Framework
4 **
5 ** Created: 2020.08.29
6 ** Author: Boris Fast
7 ** Mail: Support@FAST-Framework.com
8 **
9 ****************************************************************************/
10 
11 #ifndef FFILE_H
12 #define FFILE_H
13 
14 #include <stdio.h>
15 
16 using namespace std;
17 
18 #include "FObject.h"
19 #include "FString.h"
20 
24 enum class FAccessMode
25 {
26  Read = 0,
27  ReadPlus,
28  ReadBinary,
29  ReadBinaryPlus,
30  Write,
31  WritePlus,
32  WriteBinary,
33  WriteBinaryPlus,
34  Append,
35  AppendPlus,
36  AppendBinary,
37  AppendBinaryPlus
38 };
39 
43 class FFile : public FObject
44 {
45  public:
46  FFile(const FString& filename);
47  FFile();
48  virtual ~FFile() = default;
49 
50  Boolean Open(FAccessMode accesMode);
51  FString Read() const;
52  FList<FString> ReadLines() const;
53  ULLong Write(const FString& string) const;
54  Boolean Flush() const;
55  Boolean Close() const;
56 
57  Boolean Rename(const FString& filename);
58  Boolean Delete() const;
59 
60  FString Name() const;
61  FString FullName() const;
62  Boolean Exists() const;
63  FString Extension() const;
64  FDirectory Directory() const;
65 
66  FDateTime CreatedAt() const;
67  FDateTime LastAccessAt() const;
68  FDateTime LastWriteAt() const;
69  ULLong Size() const;
70 
71  static Boolean Delete(const FString& filename);
72  static Boolean Rename(const FString& oldFilename,
73  const FString& newFilename);
74  static Boolean Exists(const FString& filename);
75  static Boolean Touch(const FString& filename);
76  static ULLong Size(const FString& filename);
77 
78  const type_info& GetType() override;
79  FString GetName() const override;
80 
81  protected:
82  const char* PrintAccessMode(FAccessMode accessMode);
83 
84  private:
85  FILE* file;
86  size_t size;
87  FString filename;
88  const char* accessMode;
89 };
90 
91 #endif // FFILE_H
FString
Definition: FString.h:21
FDateTime
Definition: FDateTime.h:47
FObject
Definition: FObject.h:49
FFile
Definition: FFile.h:43
FDirectory
Definition: FDirectory.h:22
FList
Definition: FList.h:25