eglib: checking for locale_charset function
[mono.git] / mcs / class / System.Web / System.Web.UI / PageParserFilter.cs
1 //
2 // System.Web.UI.PageParserFilter.cs
3 //
4 // Authors:
5 //     Arina Itkes (arinai@mainsoft.com)
6 //
7 // (C) 2007 Mainsoft Co. (http://www.mainsoft.com)
8 //
9 //
10 //
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.
29 //
30
31 using System.Collections;
32
33 namespace System.Web.UI
34 {
35         public abstract class PageParserFilter
36         {
37                 TemplateParser parser;
38
39                 protected PageParserFilter ()
40                 {
41                 }
42                 
43                 public virtual bool AllowCode {
44                         get { return false; }
45                 }
46
47                 [MonoTODO ("Need to implement support for this in the parser")]
48                 protected int Line {
49                         get { return parser.Location.BeginLine; }
50                 }
51
52                 public virtual int NumberOfControlsAllowed {
53                         get { return 0; }
54                 }
55                 
56                 public virtual int NumberOfDirectDependenciesAllowed {
57                         get { return 0; }
58                 }
59                 
60                 public virtual int TotalNumberOfDependenciesAllowed {
61                         get { return 0; }
62                 }
63                 
64                 protected string VirtualPath {
65                         get { return parser.VirtualPath.Absolute; }
66                 }
67
68                 protected void AddControl (Type type, IDictionary attributes)
69                 {
70                         if (parser == null)
71                                 return;
72
73                         parser.AddControl (type, attributes);
74                 }
75                 
76                 public virtual bool AllowBaseType (Type baseType)
77                 {
78                         return false;
79                 }
80                 
81                 public virtual bool AllowControl (Type controlType, ControlBuilder builder)
82                 {
83                         return false;
84                 }
85                 
86                 public virtual bool AllowServerSideInclude (string includeVirtualPath)
87                 {
88                         return false;
89                 }
90                 
91                 public virtual bool AllowVirtualReference (string referenceVirtualPath, VirtualReferenceType referenceType)
92                 {
93                         return false;
94                 }
95                 
96                 public virtual CompilationMode GetCompilationMode (CompilationMode current)
97                 {
98                         return current;
99                 }
100
101                 public virtual Type GetNoCompileUserControlType ()
102                 {
103                         return null;
104                 }
105
106                 // LAMEDOC:
107                 // http://msdn.microsoft.com/en-us/library/system.web.ui.pageparserfilter.initialize.aspx
108                 // claims there's a virtualPath parameter, but there's none. Probably an internal
109                 // method is used to wrap a call to this one.
110                 protected virtual void Initialize ()
111                 {
112                 }
113
114                 internal void Initialize (TemplateParser parser)
115                 {
116                         this.parser = parser;
117                         Initialize ();
118                 }
119                 
120                 public virtual void ParseComplete (ControlBuilder rootBuilder)
121                 {
122                 }
123                 
124                 public virtual void PreprocessDirective (string directiveName, IDictionary attributes)
125                 {
126                 }
127                 
128                 public virtual bool ProcessCodeConstruct (CodeConstructType codeType, string code)
129                 {
130                         return false;
131                 }
132
133                 public virtual bool ProcessDataBindingAttribute (string controlId, string name, string value)
134                 {
135                         return false;
136                 }
137
138                 public virtual bool ProcessEventHookup (string controlId, string eventName, string handlerName)
139                 {
140                         return false;
141                 }
142
143                 protected void SetPageProperty (string filter, string name, string value)
144                 {
145                 }
146         }
147 }