Functions as a chainable TextReader
Implements a abstraction over a TextReader that allows the class to represent either a TextReader or another ChainableReader to which it is chained. By passing a ChainableReader as a constructor paramater it is possiable to chain many ChainableReaders together. The last ChainableReader in the chain must be based on a TextReader.
Inheritance: Element, IDisposable
Example #1
0
        /// <summary>
        /// Makes it so all calls to Read and Peek are passed  the ChainableReader
        /// passed as a parameter.
        /// </summary>
        /// <param name="parentChainedReader">ChainableReader to forward calls to</param>
        public virtual void Chain(ChainableReader parentChainedReader) {
            if (parentChainedReader == null) {
                throw new ArgumentNullException("parentChainedReader", "Argument can not be null");
            }

            //Assign delegates
            InternalRead = new internalRead(parentChainedReader.Read);
            InternalPeek = new internalPeek(parentChainedReader.Peek);
            InternalClose = new internalClose(parentChainedReader.Close);

            //This is just a reader in the chain
            _baseReader = false;
        }
        /// <summary>
        /// Makes it so all calls to Read and Peek are passed  the ChainableReader
        /// passed as a parameter.
        /// </summary>
        /// <param name="parentChainedReader">ChainableReader to forward calls to</param>
        public virtual void Chain(ChainableReader parentChainedReader)
        {
            if (parentChainedReader == null)
            {
                throw new ArgumentNullException("parentChainedReader", "Argument can not be null");
            }

            //Assign delegates
            InternalRead  = new internalRead(parentChainedReader.Read);
            InternalPeek  = new internalPeek(parentChainedReader.Peek);
            InternalClose = new internalClose(parentChainedReader.Close);

            //This is just a reader in the chain
            _baseReader = false;
        }
Example #3
0
 /// <summary>
 /// Construct that allows this filter to be chained to the one
 /// in the parameter chainedReader.
 /// </summary>
 /// <param name="chainedReader">Filter that the filter will be chained to</param>
 public override void Chain(ChainableReader chainedReader)
 {
     base.Chain(chainedReader);
     ReadChar = new AcquireCharDelegate(base.Read);
 }
Example #4
0
 /// <summary>
 /// Construct that allows this filter to be chained to the one
 /// in the parameter chainedReader.
 /// </summary>
 /// <param name="chainedReader">Filter that the filter will be chained to</param>
 public override void Chain(ChainableReader chainedReader)
 {
     base.Chain(chainedReader);
     ReadChar = new AcquireCharDelegate(base.Read);
 }
Example #5
0
 public override void Chain(ChainableReader parentChainedReader)
 {
     base.Chain(parentChainedReader);
     this.ReadChar = new AcquireCharDelegate(base.Read);
 }