FilterChain Class

Summary

Represent a chain of NAnt filters that can be applied to a NAnt.Core.Task.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Filters
Base Types
graph BT Type-->Base0["DataTypeBase"] click Base0 "/api/NAnt.Core/DataTypeBase" Base0-->Base1["Element"] click Base1 "/api/NAnt.Core/Element" Base1-->Base2["Object"] Type["FilterChain"] class Type type-node

Syntax

[Serializable]
[ElementName("filterchain")]
public class FilterChain : DataTypeBase

Examples

Replace all occurrences of @NOW@ with the current date/time and replace tabs with spaces in all copied files.

    <property name="NOW" value="${datetime::now()}" />
<copy todir="out">
    <fileset basedir="in">
        <include name="**/*" />
    </fileset>
    <filterchain>
        <replacetokens>
            <token key="NOW" value="${TODAY}" />
        </replacetokens>
        <tabstospaces />
    </filterchain>
</copy>

Remarks

A FilterChain represents a collection of one or more filters that can be applied to a NAnt.Core.Task such as the NAnt.Core.Tasks.CopyTask. In the case of the NAnt.Core.Tasks.CopyTask, the contents of the copied files are filtered through each filter specified in the filter chain. Filtering occurs in the order the filters are specified with filtered output of one filter feeding into another.

:--------:--->:----------:--->:----------: ... :----------:--->:--------:
:.Source.:--->:.Filter 1.:--->:.Filter 2.: ... :.Filter n.:--->:.target.:
:--------:--->:----------:--->:----------: ... :----------:--->:--------:

A list of all filters that come with NAnt is available here.

The following tasks support filtering with a FilterChain:

  • NAnt.Core.Tasks.CopyTask
  • NAnt.Core.Tasks.MoveTask

Attributes

Type Description
SerializableAttribute
ElementNameAttribute Indicates that class should be treated as a NAnt element.

Properties

Name Value Summary
CanBeReferenced bool
Gets a value indicating whether a reference to the type can be defined.
Inherited from DataTypeBase
CustomXmlProcessing bool
Gets a value indicating whether the element is performing additional processing using the NAnt.Core.Element.XmlNode that was used to initialize the element.
Inherited from Element
Filters FilterCollection
The filters to apply.
ID string
The ID used to be referenced later.
Inherited from DataTypeBase
InputEncoding Encoding
The encoding to assume when filter-copying files. The default is system's current ANSI code page.
Location Location
Gets or sets the location in the build file where the element is defined.
Inherited from Element
Name string
Gets the name of the data type.
Inherited from DataTypeBase
NamespaceManager XmlNamespaceManager
Gets or sets the System.Xml.XmlNamespaceManager.
Inherited from Element
Parent Object
Gets or sets the parent of the element.
Inherited from Element
Project Project
Gets or sets the NAnt.Core.Element.Project to which this element belongs.
Inherited from Element
Properties PropertyDictionary
Gets the properties local to this NAnt.Core.Element and the NAnt.Core.Element.Project.
Inherited from Element
RefID string
The ID to use as the reference.
Inherited from DataTypeBase
XmlNode XmlNode
Gets or sets the XML node of the element.
Inherited from Element

Methods

Name Value Summary
CopyTo(DataTypeBase) void
Copies all instance data of the NAnt.Core.DataTypeBase to a given NAnt.Core.DataTypeBase.
Inherited from DataTypeBase
CopyTo(Element) void
Copies all instance data of the NAnt.Core.Element to a given NAnt.Core.Element.
Inherited from Element
GetAttributeConfigurationNode(FrameworkInfo, string) XmlNode
Locates the XML node for the specified attribute in the project configuration node.
Inherited from Element
GetAttributeConfigurationNode(XmlNode, FrameworkInfo, string) XmlNode
Inherited from Element
GetLocation() Location
Retrieves the location in the build file where the element is defined.
Inherited from Element
Initialize() void
Derived classes should override to this method to provide extra initialization and validation not covered by the base class.
Inherited from DataTypeBase
Initialize(XmlNode) void
Performs default initialization.
Inherited from Element
InitializeBuildElement(Element, XmlNode, Element, Type) Element
Initializes the build element.
Inherited from Element
static
InitializeElement(XmlNode) void
Derived classes should override to this method to provide extra initialization and validation not covered by the base class.
Inherited from Element
InitializeXml(XmlNode, PropertyDictionary, FrameworkInfo) void
Initializes all build attributes and child elements.
Log(Level, string) void
Logs a message with the given priority.
Inherited from Element
Log(Level, string, Object[]) void
Logs a message with the given priority.
Inherited from Element
Reset() void
Should be overridden by derived classes. clones the referenced types data into the current instance.
Inherited from DataTypeBase