-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.h
More file actions
executable file
·52 lines (37 loc) · 1.21 KB
/
Config.h
File metadata and controls
executable file
·52 lines (37 loc) · 1.21 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
#ifndef CONFIG_H
#define CONFIG_H
//Include string for std::string
#include <string>
//Include iostream for i/o
#include <iostream>
//Include fstream for file i/o
#include <fstream>
#include <vector>
//Configuration class
class Config {
private:
//Configuration file variable
std::ofstream outputConfigFile;
std::ifstream inputConfigFile;
//Contents of the config file
std::vector<std::string> file;
std::string path;
//Close a file
void closeFiles();
bool isOpen;
public:
//Initialize the config class with the path to a config file
Config(std::string pathToConfigFile);
//Dealloc method
~Config();
//Open a new configuration file
bool open(std::string pathToConfigFile);
bool open();
//Get an element from the config file (the part after the equals) returns "" if element doesn't exist
std::string getElement(std::string element, int start_line = 0, int* line = NULL);
//Set an element in the configuration file (will overwrite any existing element with the same name
void setElement(std::string element, std::string contents);
};
int getdir(std::string dir, std::vector<std::string> &files);
bool has_extension(std::string to_check, std::string ext);
#endif