* Makefile: Build the make-map.exe in Mono.Unix.Native; add /nowarn:0618 to
[mono.git] / mcs / class / Commons.Xml.Relaxng / Commons.Xml.Nvdl / NvdlCompileContext.cs
1 using System;
2 using System.Collections;
3 using System.Collections.Specialized;
4 using System.Xml;
5 using Commons.Xml;
6
7 namespace Commons.Xml.Nvdl
8 {
9         internal class NvdlCompileContext
10         {
11                 NvdlRules rules;
12                 NvdlConfig config;
13                 XmlResolver resolver;
14                 Hashtable compiledModes = new Hashtable ();
15                 Hashtable modeContexts = new Hashtable ();
16                 Hashtable cancelledRules = new Hashtable ();
17                 Hashtable ruleContexts = new Hashtable ();
18
19                 public NvdlCompileContext (NvdlRules rules, NvdlConfig config, XmlResolver resolver)
20                 {
21                         this.rules = rules;
22                         this.config = config;
23                         this.resolver = resolver;
24                 }
25
26                 public NvdlRules Rules {
27                         get { return rules; }
28                 }
29
30                 public NvdlConfig Config {
31                         get { return config; }
32                 }
33
34                 internal XmlResolver XmlResolver {
35                         get { return resolver; }
36                 }
37
38                 internal void AddCompiledMode (string name, SimpleMode m)
39                 {
40                         compiledModes.Add (m.Name, m);
41                 }
42
43                 internal void AddCompiledMode (NvdlModeUsage u, SimpleMode m)
44                 {
45                         compiledModes.Add (u, m);
46                 }
47
48                 internal void AddCompiledMode (NvdlContext c, SimpleMode m)
49                 {
50                         compiledModes.Add (c, m);
51                 }
52
53                 internal SimpleMode GetCompiledMode (string name)
54                 {
55                         return compiledModes [name] as SimpleMode;
56                 }
57
58                 internal SimpleMode GetCompiledMode (NvdlModeUsage u)
59                 {
60                         return compiledModes [u] as SimpleMode;
61                 }
62
63                 internal SimpleMode GetCompiledMode (NvdlContext c)
64                 {
65                         return compiledModes [c] as SimpleMode;
66                 }
67
68                 internal ICollection GetCompiledModes ()
69                 {
70                         return compiledModes.Values;
71                 }
72
73                 internal NvdlModeCompileContext GetModeContext (SimpleMode m)
74                 {
75                         return modeContexts [m] as NvdlModeCompileContext;
76                 }
77
78                 internal void AddModeContext (SimpleMode m,
79                         NvdlModeCompileContext mctx)
80                 {
81                         modeContexts.Add (m, mctx);
82                 }
83
84                 internal NvdlRule GetRuleContext (SimpleRule r)
85                 {
86                         return ruleContexts [r] as NvdlRule;
87                 }
88
89                 internal void AddRuleContext (SimpleRule r, NvdlRule rctx)
90                 {
91                         ruleContexts.Add (r, rctx);
92                 }
93
94                 public Hashtable CancelledRules {
95                         get { return cancelledRules; }
96                 }
97         }
98
99         internal class NvdlModeCompileContext
100         {
101                 NvdlModeBase mode;
102                 ArrayList included;
103
104                 public NvdlModeCompileContext (NvdlModeBase mode)
105                 {
106                         this.mode = mode;
107                         included = new ArrayList ();
108                 }
109
110                 public ArrayList Included {
111                         get { return included; }
112                 }
113         }
114 }