-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathccfile.cc
108 lines (87 loc) · 2.12 KB
/
ccfile.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#include "ccfile.h"
#include <assert.h>
CC_file_strategy* CC_File::instance = nullptr;
CC_File::CC_File()
{
if (instance == nullptr)
{
instance = CC_file_strategy::GetInstance();
}
assert(instance != nullptr);
}
void CC_File::Create(std::string path)
{
instance->Create(path);
}
intptr_t CC_File::Copy(std::string sourcePath, std::string destPath)
{
return instance->Copy(sourcePath, destPath);
}
void CC_File::Delete(std::string path)
{
instance->Delete(path);
}
bool CC_File::Exists(std::string path)
{
return instance->Exists(path);
}
bool CC_File::CanRead(std::string path)
{
return instance->CanRead(path);
}
bool CC_File::CanExecute(std::string path)
{
return instance->CanExecute(path);
}
void CC_File::Move(std::string sourcePath, std::string destPath)
{
instance->Move(sourcePath, destPath);
}
FileStream* CC_File::Open(std::string path, FileMode mode)
{
return instance->Open(path, mode);
}
FileStream* CC_File::OpenRead(std::string path)
{
return instance->OpenRead(path);
}
FileStream* CC_File::OpenWrite(std::string path)
{
return instance->OpenWrite(path);
}
intptr_t CC_File::ReadAllBytes(std::string path, char destBuffer[], size_t length)
{
return instance->ReadAllBytes(path, destBuffer, length);
}
long CC_File::ReadAllLines(std::string path, std::vector<std::string>& destContainer)
{
return instance->ReadAllLines(path, destContainer);
}
std::string CC_File::ReadAllText(std::string path)
{
return instance->ReadAllText(path);
}
bool CC_File::Replace(std::string sourcePath, std::string replaceFilePath, std::string backPath)
{
return instance->Replace(sourcePath, replaceFilePath, backPath);
}
intptr_t CC_File::WriteAllBytes(std::string path, const char sourceData[], size_t len)
{
return instance->WriteAllBytes(path, sourceData, len);
}
long CC_File::WriteAllLines(std::string path, const std::vector<std::string>& sourceData)
{
return instance->WriteAllLines(path, sourceData);
}
intptr_t CC_File::WriteAllText(std::string path, std::string& content)
{
return instance->WriteAllText(path, content);
}
CC_File::~CC_File()
{
if (instance != nullptr)
{
delete instance;
instance = nullptr;
}
}