-
Notifications
You must be signed in to change notification settings - Fork 3
/
macro.h
112 lines (82 loc) · 1.9 KB
/
macro.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef INCLUDE_MACRO_H
#define INCLUDE_MACRO_H
// macro.h
// Revision 20-nov-2005
#include "pasmotypes.h"
#include <vector>
#include <map>
namespace pasmo {
namespace impl {
using std::vector;
using std::map;
class MacroBase {
protected:
MacroBase ();
explicit MacroBase (const vector <string> & param);
explicit MacroBase (const string & sparam);
~MacroBase ();
public:
size_t getparam (const string & name) const;
string getparam (size_t n) const;
static const size_t noparam= size_t (-1);
private:
vector <string> param;
};
class Macro : public MacroBase {
public:
Macro (const vector <string> & param,
size_t linen, size_t endlinen);
~Macro ();
size_t getline () const;
size_t getendline () const;
private:
const size_t line;
const size_t endline;
};
class MacroIRPbase : public MacroBase {
public:
MacroIRPbase (const string & sparam);
};
class MacroIRP : public MacroIRPbase {
public:
MacroIRP (const string & sparam);
};
class MacroIRPC : public MacroIRPbase {
public:
MacroIRPC (const string & sparam);
};
class MacroREPT : public MacroBase {
public:
MacroREPT (const string & sparam);
};
class MapMacro {
private:
typedef map <string, Macro> mapmacro_t;
mapmacro_t mapmacro;
public:
typedef mapmacro_t::iterator iterator;
typedef mapmacro_t::const_iterator const_iterator;
void clear ();
void erase (const string & name);
void insert (const string & name,
const vector <string> & param,
size_t beginline, size_t endline);
const_iterator begin () const;
const_iterator end () const;
const_iterator find (const string & name) const;
};
class MacroStore {
protected:
void clear ();
const Macro & getmacro (const string & name);
bool ismacro (const string & name) const;
void insert (const string & name,
const vector <string> & param,
size_t beginline, size_t endline);
private:
MapMacro mapmacro;
};
} // namespace impl
} // namespace pasmo
#endif
// End of macro.h