(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Web / System.Web.Compilation / Directive.cs
blob74c7997badb7b0eb19cb83fa75a841f70bfcfab9
1 //
2 // System.Web.Compilation.Directive
3 //
4 // Authors:
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 //
7 // (C) 2003 Ximian, Inc (http://www.ximian.com)
8 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System;
32 using System.Collections;
34 namespace System.Web.Compilation
36 sealed class Directive
38 static Hashtable directivesHash;
39 static string [] page_atts = { "AspCompat", "AutoEventWireup", "Buffer",
40 "ClassName", "ClientTarget", "CodePage",
41 "CompilerOptions", "ContentType", "Culture", "Debug",
42 "Description", "EnableSessionState", "EnableViewState",
43 "EnableViewStateMac", "ErrorPage", "Explicit",
44 "Inherits", "Language", "LCID", "ResponseEncoding",
45 "Src", "SmartNavigation", "Strict", "Trace",
46 "TraceMode", "Transaction", "UICulture",
47 "WarningLevel", "CodeBehind" , "ValidateRequest" };
49 static string [] control_atts = { "AutoEventWireup", "ClassName", "CompilerOptions",
50 "Debug", "Description", "EnableViewState",
51 "Explicit", "Inherits", "Language", "Strict", "Src",
52 "WarningLevel", "CodeBehind", "TargetSchema" };
54 static string [] import_atts = { "namespace" };
55 static string [] implements_atts = { "interface" };
56 static string [] assembly_atts = { "name", "src" };
57 static string [] register_atts = { "tagprefix", "tagname", "Namespace", "Src", "Assembly" };
59 static string [] outputcache_atts = { "Duration", "Location", "VaryByControl",
60 "VaryByCustom", "VaryByHeader", "VaryByParam" };
62 static string [] reference_atts = { "page", "control" };
64 static string [] webservice_atts = { "class", "codebehind", "debug", "language" };
66 static string [] application_atts = { "description", "inherits", "codebehind" };
68 static Directive ()
70 InitHash ();
73 private static void InitHash ()
75 CaseInsensitiveHashCodeProvider provider = new CaseInsensitiveHashCodeProvider ();
76 CaseInsensitiveComparer comparer = new CaseInsensitiveComparer ();
78 directivesHash = new Hashtable (provider, comparer);
80 // Use Hashtable 'cause is O(1) in Contains (ArrayList is O(n))
81 Hashtable valid_attributes = new Hashtable (provider, comparer);
82 foreach (string att in page_atts) valid_attributes.Add (att, null);
83 directivesHash.Add ("PAGE", valid_attributes);
85 valid_attributes = new Hashtable (provider, comparer);
86 foreach (string att in control_atts) valid_attributes.Add (att, null);
87 directivesHash.Add ("CONTROL", valid_attributes);
89 valid_attributes = new Hashtable (provider, comparer);
90 foreach (string att in import_atts) valid_attributes.Add (att, null);
91 directivesHash.Add ("IMPORT", valid_attributes);
93 valid_attributes = new Hashtable (provider, comparer);
94 foreach (string att in implements_atts) valid_attributes.Add (att, null);
95 directivesHash.Add ("IMPLEMENTS", valid_attributes);
97 valid_attributes = new Hashtable (provider, comparer);
98 foreach (string att in register_atts) valid_attributes.Add (att, null);
99 directivesHash.Add ("REGISTER", valid_attributes);
101 valid_attributes = new Hashtable (provider, comparer);
102 foreach (string att in assembly_atts) valid_attributes.Add (att, null);
103 directivesHash.Add ("ASSEMBLY", valid_attributes);
105 valid_attributes = new Hashtable (provider, comparer);
106 foreach (string att in outputcache_atts) valid_attributes.Add (att, null);
107 directivesHash.Add ("OUTPUTCACHE", valid_attributes);
109 valid_attributes = new Hashtable (provider, comparer);
110 foreach (string att in reference_atts) valid_attributes.Add (att, null);
111 directivesHash.Add ("REFERENCE", valid_attributes);
113 valid_attributes = new Hashtable (provider, comparer);
114 foreach (string att in webservice_atts) valid_attributes.Add (att, null);
115 directivesHash.Add ("WEBSERVICE", valid_attributes);
117 valid_attributes = new Hashtable (provider, comparer);
118 // same attributes as webservice
119 foreach (string att in webservice_atts) valid_attributes.Add (att, null);
120 directivesHash.Add ("WEBHANDLER", valid_attributes);
122 valid_attributes = new Hashtable (provider, comparer);
123 foreach (string att in application_atts) valid_attributes.Add (att, null);
124 directivesHash.Add ("APPLICATION", valid_attributes);
127 private Directive () { }
129 public static bool IsDirective (string id)
131 return directivesHash.Contains (id);