-
Notifications
You must be signed in to change notification settings - Fork 1
/
Configuration.cpp
92 lines (80 loc) · 2.2 KB
/
Configuration.cpp
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
//
// Created by giovanni on 06/10/18.
//
#include <fstream>
#include <iostream>
#include "Configuration.h"
preferences::preferences(std::string path) {
std::string line;
std::fstream configFile;
configFile.open(path);
/*
* takes the values from the configuration file a line yes and a no, for now according to this pre-established order
*/
if (configFile.good()) {
int c = 1;
while (std::getline(configFile, line)) {
if (c % 2 == 0) {
switch (c) {
case 2:
TEMP_PATH = line;
break;
case 4:
BASE_PATH = line;
break;
case 6:
BACKGROUND = line;
break;
case 8:
OVERLAY = line;
break;
case 10:
MARKER = line;
break;
case 12:
FONT = line;
break;
case 14:
DIR_FORMAT = line;
break;
case 16:
DATE_FORMAT = line;
break;
case 18:
WORKING_DIR = line;
}
}
++c;
}
} else {
std::cout << "ERRORE: impossibile accedere al file di configurazione";
}
configFile.close();
}
const char *preferences::getBACKGROUND() {
return BACKGROUND.c_str();
}
std::string preferences::getBASE_PATH() {
return BASE_PATH;
}
const char *preferences::getDATE_FORMAT() {
return DATE_FORMAT.c_str();
}
const char *preferences::getFONT() {
return FONT.c_str();
}
const char *preferences::getOVERLAY() {
return OVERLAY.c_str();
}
const char *preferences::getDIR_FORMAT() {
return DIR_FORMAT.c_str();
}
const char *preferences::getMARKER() {
return MARKER.c_str();
}
const char *preferences::getTEMP_PATH() {
return TEMP_PATH.c_str();
}
const char *preferences::getWORKING_DIR() {
return WORKING_DIR.c_str();
}