2004-01-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / UserControlParser.cs
1 //
2 // System.Web.UI.UserControlParser
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 //
7 // (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
8 //
9 using System;
10 using System.Collections;
11 using System.IO;
12 using System.Web;
13 using System.Web.Compilation;
14 using System.Web.Util;
15
16 namespace System.Web.UI
17 {
18         internal sealed class UserControlParser : TemplateControlParser
19         {
20                 internal UserControlParser (string virtualPath, string inputFile, HttpContext context)
21                 {
22                         Context = context;
23                         BaseVirtualDir = UrlUtils.GetDirectory (virtualPath);
24                         InputFile = inputFile;
25                         AddApplicationAssembly ();
26                 }
27                 
28                 public static Type GetCompiledType (string virtualPath, string inputFile, HttpContext context)
29                 {
30                         UserControlParser ucp = new UserControlParser (virtualPath, inputFile, context);
31                         return ucp.CompileIntoType ();
32                 }
33
34                 protected override Type CompileIntoType ()
35                 {
36                         AspGenerator generator = new AspGenerator (this);
37                         return generator.GetCompiledType ();
38                 }
39
40                 internal override void ProcessMainAttributes (Hashtable atts)
41                 {
42                         SetBaseType (PagesConfig.UserControlBaseType);
43                         base.ProcessMainAttributes (atts);
44                 }
45                 
46                 internal override Type DefaultBaseType {
47                         get { return typeof (UserControl); }
48                 }
49
50                 internal override string DefaultBaseTypeName {
51                         get { return "System.Web.UI.UserControl"; }
52                 }
53
54                 internal override string DefaultDirectiveName {
55                         get { return "control"; }
56                 }
57         }
58 }
59