|
using System;
using System.Collections;
using TemplateParser.Modificators;
namespace TemplateParser.Modificators {
/// <summary>
/// Abstract class for Modificators
/// </summary>
public abstract class Modificator
{
protected Hashtable _parameters = new Hashtable();
public Hashtable Parameters
{
get { return _parameters; }
}
public abstract void Apply(ref string Value, params string[] Parameters);
}
class NL2BR : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.Replace("\n", "<br>");
}
}
class HTMLENCODE : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.Replace("&", "&");
Value = Value.Replace("<", "<");
Value = Value.Replace(">", ">");
}
}
class UPPER : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.ToUpper();
}
}
class LOWER : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.ToLower();
}
}
class TRIM : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.Trim();
}
}
class TRIMEND : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.TrimEnd();
}
}
class TRIMSTART : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
Value = Value.TrimStart();
}
}
class DEFAULT : Modificator
{
public override void Apply(ref string Value, params string[] Parameters)
{
if (Value == null || Value.Trim() == string.Empty)
Value = Parameters[0];
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Alexander is freelance web developer with 4 years experience. He has skills in ASP.NET/MS SQL Server, PHP/MySQL, Ruby On Rails, XHTML, CSS. You can contact with me by
seigo.ua@gmail.com. Also check my homepage at
www.klalex.com.