Repository navigation
Expand file tree
/
Copy pathCFileOperations.h
More file actions
174 lines (112 loc) · 3.14 KB
/
Copy pathCFileOperations.h
File metadata and controls
174 lines (112 loc) · 3.14 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#pragma once
#include "Structures.h"
class CLineParser
{
public:
CLineParser(void) {};
~CLineParser(void) {};
bool isNumber(char data);
bool isOpenParenthesis(char data);
bool isCloseParenthesis(char data);
bool isForwardSlash(char data);
bool isBackSlash(char data);
bool isColon(char data);
bool isComma(char data);
bool isUnderscore(char data);
bool isSpace(char data);
bool isWhiteSpace(char data);
bool isSeparator(char data);
bool isSeparator2(char data);
bool isSeparator3(char data);
bool isSeparator4(char data);
bool isValidCharacter(char data);
bool isEOL(char mdata);
int findSeparator(int index, string line);
int findOpenParenthesis(int index, string line);
int findCloseParenthesis(int index, string line);
int findForwardSlash(int index, string line);
int findLastSpace(string line);
int findUnderscore(int index, string line);
bool isInt(string data);
int getNextWord(int start, string data, string* word);
bool isWordNumber(string word);
int myStoi(string s);
bool hasSingleColon(string cname);
string getStringBeforeColon(string cname);
string getStringAfterColon(string cname);
string getStringAfterLastColon(string cname);
int getNumberFromString(string cname);
string makeLower(string mstring);
vector<string> parseLine(string line);
vector<string> parseLine2(string line);
unsigned char* downscaleImageData(int inrows, int incols, int instride, unsigned char* rgbin, int outrows, int outcols, unsigned char* rgbout);
rgb_value downscaleImageRowSlice(float rstart, float rend, float cstart, float cend, int rstride, unsigned char* rgbin);
rgb_value downscaleImageColumnSlice(float start, float end, int rowoffset, unsigned char* rgbin);
string removePathFromFilename(string path);
string getFileExtension(string fname);
void addErrorString(string err);
void addPanel1String(string msg);
};
class File : public CLineParser
{
public:
string filename;
bool display_error;
vector<string> flines;
public:
File(void);
~File(void);
void init();
bool loadFile(string fname, bool derror = true);
void addErrorString(string err);
};
class CSVFile : public File
{
public:
vector<string> headers;
vector<bool> columnIsNumbersData;
vector<vector<string>> sdata;
vector<vector<double>> ddata;
public:
CSVFile(void);
~CSVFile(void);
void init();
bool isCSVFile(string fname);
bool loadCSVFile(string fname, bool derror);
bool parseCSVFile(bool derror);
int getColumnIndexFromHeader(string hname);
bool isColumnNumbersData(int cindex);
string getStringData(int cindex, int rindex);
vector<string> getColumnStringData(int cindex);
vector<double> getColumnDoubleData(int cindex);
};
class JPGFile : public File
{
public:
public:
JPGFile(void);
~JPGFile(void);
void init();
bool isJPGFile(string fname);
};
class RawFile : public File
{
public:
public:
RawFile(void);
~RawFile(void);
void init();
bool isRawFile(string fname);
};
class WaveFile : public File
{
public:
int minimum_sound_level = 20;
bool normaiize_file_set = false;
public:
WaveFile(void);
~WaveFile(void);
void init();
bool isWaveFile(string fname);
wave_data getWaveDataFromFile(string fname);
};