summaryrefslogtreecommitdiff
path: root/other/Kermit/lib/SystemMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'other/Kermit/lib/SystemMap.cpp')
-rw-r--r--other/Kermit/lib/SystemMap.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/other/Kermit/lib/SystemMap.cpp b/other/Kermit/lib/SystemMap.cpp
new file mode 100644
index 0000000..03e2fb4
--- /dev/null
+++ b/other/Kermit/lib/SystemMap.cpp
@@ -0,0 +1,67 @@
1/*
2 * SystemMap.cpp:
3 * written by palmers / teso
4 */
5#include <SystemMap.hpp>
6
7
8 SystemMap::SystemMap (string a)
9 {
10 string tmp;
11 unsigned int num = 0;
12 ifstream f;
13
14 f.open (a.c_str ());
15 if (!f.is_open ())
16 {
17 cerr << "Error opening file \"" << a << "\"!" << endl;
18 abort ();
19 }
20
21 f.setf (ios::skipws);
22 f.setf (ios::hex, ios::basefield);
23
24 while (!f.eof ())
25 {
26 f >> num;
27 f >> tmp;
28 f >> tmp;
29
30 add_map.insert (add_map.end (), bla_val (tmp, num));
31 }
32 f.close ();
33 }
34
35
36 SystemMap::SystemMap ()
37 {
38 }
39
40
41 SystemMap::~SystemMap ()
42 {
43 add_map.clear ();
44 }
45
46
47 bool SystemMap::contains (string a)
48 {
49 if (add_map.find (a) == add_map.end ())
50 return false;
51 return true;
52 }
53
54
55 void SystemMap::add (string a, unsigned int x)
56 {
57 add_map.insert (add_map.end (), bla_val (a, x));
58 }
59
60
61 unsigned int SystemMap::operator[] (string a)
62 {
63 if (add_map.find (a) == add_map.end ())
64 return 0;
65 return add_map[a];
66 }
67