-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext.h
51 lines (44 loc) · 1.36 KB
/
text.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
// name: text.h
// version: 1.0
// description: opens a file and displays contents
// ensure declarations only occur once
#ifndef TEXT_H
#define TEXT_H
// text parsing class
class text {
public:
// constructors
text ();
text (char *raw);
// operators
void operator = (char *raw);
// information
bool contains (char *haystack, char needle);
int find (char *haystack);
int find (char *haystack, char needle);
int type (char *data);
// manipulation
void clean (char *data);
void clean (char *data, char delim);
// gathering interfaces
char *get (const char *section, const char *key);
char *getchar (const char *section, const char *key);
float getfloat (const char *section, const char *key);
int getint (const char *section, const char *key);
// setting interfaces
bool set (const char *section, const char *key, const char *data);
bool set (const char *section, const char *key, float data);
bool set (const char *section, const char *key, int data);
private:
// local data
char *storage;
// conversion interface
char *parseline (char *data);
// conversion function
char *parseline (char *data, bool rvalue);
// gathering function
char *get (const char *section, const char *key, const char *file);
// setting function
bool set (const char *section, const char *key, const char *data, const char *file);
};
#endif