-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfiguration.cpp
More file actions
42 lines (38 loc) · 883 Bytes
/
configuration.cpp
File metadata and controls
42 lines (38 loc) · 883 Bytes
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
#include ".\configuration.h"
#include "LeoIni.h"
#include <iostream>
namespace config
{
char min_operand[]="min_operand";
char max_operand[]="max_operand";
char protected_register[]="protected_register";
char templates[]="templates";
char junk_template[]="junk_template";
char disabled_template[]="disabled_template";
char max_stack[]="max_stack";
}
configuration::configuration(void)
{
ini = 0;
ini = new Leo::Ini("PJC.ini");
}
configuration::~configuration(void)
{
delete ini;
}
char *configuration::value(char *name,char *categ)
{
Leo::Ini::Element el( Leo::Ini::Element::KEY, categ, name );
if(ini->read(el))
strcpy(_buffer,el.value.c_str());
else
{
std::cout << "Warning: Can't find ["<<categ<<"]->"<<name<<" in .ini" << std::endl;
return "0";
}
return _buffer;
}
int configuration::intvalue(char *name,char *categ)
{
return atoi(value(name,categ));
}