Files
mono/mcs/class/System.Web/System.Web.UI/BaseParser.cs
T
Gonzalo Paniagua Javier a0a0d602bc 2003-04-30 Gonzalo Paniagua Javier <[email protected]>
* ApplicationFileParser.cs: it works now. Prior to these changes, we
	were using the compiler directly.

	* BaseParser.cs: added some useful properties and methods.

	* CodeBuilder.cs: use ILocation.
	* CodeRenderBuilder.cs: use ILocation.
	* CollectionBuilder.cs: use the RootBuilder to map tag names into Types.

	* ControlBuilder.cs: made it useful.

	* DataBindingBuilder.cs: the control type for data bound text is
	DataBoundLiteralControl now.

	* ObjectTagBuilder.cs: store some object tag attributes.

	* PageParser.cs: handle page-only directives.

	* RootBuilder.cs: bah.
	* SimpleWebHandlerParser.cs: made it dummy.
	* TemplateControl.cs: Modified file.

	* TemplateControlParser.cs: handle directives that are common to pages
	and user controls.

	* TemplateParser.cs: utility methods and handling of directives that
	are common to app, page and user controls.

	* UserControl.cs: added ControlBuilderAttribute.

	* UserControlControlBuilder.cs: builder for user controls.
	* UserControlParser.cs: use the new interfaces.

svn path=/trunk/mcs/; revision=14142
2003-04-30 05:02:54 +00:00

109 lines
2.0 KiB
C#
Executable File

//
// System.Web.UI.BaseParser.cs
//
// Authors:
// Duncan Mak ([email protected])
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2002 Ximian, Inc. (http://www.ximian.com)
//
using System;
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Util;
namespace System.Web.UI
{
public class BaseParser
{
private HttpContext context;
private string baseDir;
private string baseVDir;
private string vPath;
internal string MapPath (string path)
{
return MapPath (path, true);
}
internal string MapPath (string path, bool allowCrossAppMapping)
{
if (context == null)
throw new HttpException ("context is null!!");
return context.Request.MapPath (path, context.Request.ApplicationPath, allowCrossAppMapping);
}
internal string PhysicalPath (string path)
{
if (Path.DirectorySeparatorChar != '/')
path = path.Replace ('/', '\\');
return Path.Combine (BaseDir, path);
}
internal bool GetBool (Hashtable hash, string key, bool deflt)
{
string val = hash [key] as string;
if (val == null)
return deflt;
hash.Remove (key);
bool result;
if (String.Compare (val, "true", true) == 0)
result = true;
else if (String.Compare (val, "false", true) == 0)
result = false;
else
throw new HttpException ("Invalid value for " + key);
return result;
}
internal string GetString (Hashtable hash, string key, string deflt)
{
string val = hash [key] as string;
if (val == null)
return deflt;
hash.Remove (key);
return val;
}
//
internal HttpContext Context {
get { return context; }
set { context = value; }
}
internal string BaseDir {
get {
if (baseDir == null)
baseDir = MapPath (BaseVirtualDir, false);
return baseDir;
}
}
internal string BaseVirtualDir {
get {
if (baseVDir == null)
baseVDir = UrlUtils.GetDirectory (context.Request.FilePath);
return baseVDir;
}
}
internal string CurrentVirtualPath {
get { return vPath; }
set { vPath = value; }
}
}
}