-
Notifications
You must be signed in to change notification settings - Fork 4
/
LocalFile.h
executable file
·45 lines (36 loc) · 1 KB
/
LocalFile.h
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
#ifndef LOCALFILE_H
#define LOCALFILE_H
#include <string>
#include <stdio.h>
class LocalFile
{
public:
LocalFile();
~LocalFile();
enum OpenMode
{
Read = 0x1,
Write = 0x2,
Truncate = 0x4
};
bool open(std::string filename, int mode);
bool isOpen();
void close();
std::string readAll();
std::string read(unsigned int length);
void write(std::string bytes);
void write(char* data, unsigned int length);
static std::string getUpDir(const std::string& dir);
static std::string getDirList(const std::string& dir);
static bool exist(const std::string& fileOrDir);
static bool mkDir(const std::string& dir);
static bool rmDir(const std::string& dir);
static bool rmFile(const std::string& file);
static bool rename(const std::string& oldPath, const std::string& newPath);
protected:
std::string m_filename;
FILE* m_file;
OpenMode m_openMode;
bool m_isOpen;
};
#endif // LOCALFILE_H