-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTextFile.h
More file actions
48 lines (34 loc) · 1.05 KB
/
TextFile.h
File metadata and controls
48 lines (34 loc) · 1.05 KB
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
#pragma once
#include <vector>
NS_BEGIN
//#################################################################################################
class CTextFile final
{
public:
enum EEncodingType : uint8_t
{
EET_Native = 0,
EET_Utf8,
EET_Utf16
};
CTextFile(void) = default;
bool Load(PCNSTR szTxtPath);
bool SaveAs(PCNSTR szTxtPath, const EEncodingType eType = EET_Native) const;
void ParseFromString(const CStr8 &strTxt);
void ParseFromString(const CStrW &strTxt);
void SaveToString(CStr8 &strTxt) const;
void SaveToString(CStrW &strTxt) const;
void Empty(void);
bool IsEmpty(void) const noexcept;
size_t GetLineCount(void) const;
void AppendLine(PCNSTR sz);
void AppendBlankLine(void);
size_t GetFileSize(const EEncodingType eType = EET_Native) const;
std::vector<CStr>::const_iterator begin(void) const;
std::vector<CStr>::const_iterator end(void) const;
std::vector<CStr>::iterator begin(void);
std::vector<CStr>::iterator end(void);
private:
std::vector<CStr> m_vecLines;
};
NS_END