-
Notifications
You must be signed in to change notification settings - Fork 0
/
File.h
88 lines (69 loc) · 2.24 KB
/
File.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
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
#pragma once
#ifndef _SCRIPT_PAD_FILE_H
#define _SCRIPT_PAD_FILE_H
#include "Error.h"
#include "Util.h"
#include <Windows.h>
#include <utility>
#include <string>
#include <string_view>
#include <fstream>
#include <filesystem>
#include <ShlObj.h>
using namespace std::filesystem;
namespace querier {
class __declspec(dllexport) File {
public:
File();
File(std::wstring);
File(std::wstring, std::ios_base::openmode);
File(std::string);
File(std::string, std::ios_base::openmode);
File(std::wstring, std::wstring, std::wstring);
~File();
File& operator=(const File&& file) noexcept {
m_fileName = file.m_fileName;
m_ioFile = std::fstream(m_fileName, std::ios::in | std::ios::out);
return *this;
};
std::wstring Name;
std::wstring FullName;
std::wstring Path;
void wWriteFile(std::wstring);
void Write(std::string);
void wWrite(std::wstring);
//bool Read(std::string*);
bool Read(std::string*);
bool wRead(std::wstring*);
void SetFileName(std::string);
static File FindFile(path file);
static bool SearchFile(path sFile, File* pFile);
static std::string ReadAllText(path);
static std::wstring ReadAllTextW(path);
static bool Create(path fileName);
static bool Exists(path);
static bool Exists(std::wstring);
private:
std::wstring m_wFileName{ 0 };
std::string m_fileName{ 0 };
std::wofstream m_woFile;
std::ofstream m_oFile;
std::wfstream m_wioFile;
std::fstream m_ioFile;
std::ios_base::openmode mode = std::ofstream::out;
};
class __declspec(dllexport) Directory {
public:
static path GetCurrentWorkingDirectory();
static bool SetCurrentWorkingDirectory(path);
static path ApplicationDirectory();
static bool GetSpecialFolder(KNOWNFOLDERID, path*);
static std::vector<path> GetFiles(path);
static std::vector<path> GetDirectories(path);
static bool Create(path);
static bool Exists(path);
};
class ProductFinder {
};
} //namespace scriptpad
#endif //_SCRIPT_PAD_FILE_H