Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / XPath / Internal / CacheOutputQuery.cs / 1 / CacheOutputQuery.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace MS.Internal.Xml.XPath {
using System;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
using System.Xml.Xsl;
using System.Collections.Generic;
internal abstract class CacheOutputQuery : Query {
internal Query input;
// int count; -- we reusing it here
protected List outputBuffer;
public CacheOutputQuery(Query input) {
this.input = input;
this.outputBuffer = new List();
this.count = 0;
}
protected CacheOutputQuery(CacheOutputQuery other) : base(other) {
this.input = Clone(other.input);
this.outputBuffer = new List(other.outputBuffer);
this.count = other.count;
}
public override void Reset() {
this.count = 0;
}
public override void SetXsltContext(XsltContext context){
input.SetXsltContext(context);
}
public override object Evaluate(XPathNodeIterator context) {
outputBuffer.Clear();
count = 0;
return input.Evaluate(context);// This is trick. IDQuery needs this value. Otherwise we would return this.
// All subclasses should and would anyway override thismethod and return this.
}
public override XPathNavigator Advance() {
Debug.Assert(0 <= count && count <= outputBuffer.Count);
if (count < outputBuffer.Count) {
return outputBuffer[count++];
}
return null;
}
public override XPathNavigator Current {
get {
Debug.Assert(0 <= count && count <= outputBuffer.Count);
if (count == 0) {
return null;
}
return outputBuffer[count - 1];
}
}
public override XPathResultType StaticType { get { return XPathResultType.NodeSet; } }
public override int CurrentPosition { get { return count; } }
public override int Count { get { return outputBuffer.Count; } }
public override QueryProps Properties { get { return QueryProps.Merge | QueryProps.Cached | QueryProps.Position | QueryProps.Count; } }
public override void PrintQuery(XmlWriter w) {
w.WriteStartElement(this.GetType().Name);
input.PrintQuery(w);
w.WriteEndElement();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AutomationPropertyInfo.cs
- KerberosSecurityTokenProvider.cs
- DefaultValueAttribute.cs
- SerializationStore.cs
- SafeCancelMibChangeNotify.cs
- OneWayElement.cs
- ConnectionManagementElement.cs
- SystemInformation.cs
- TableCellCollection.cs
- OAVariantLib.cs
- TrackingProfile.cs
- FillBehavior.cs
- HttpGetServerProtocol.cs
- AsyncDataRequest.cs
- StorageScalarPropertyMapping.cs
- AddInContractAttribute.cs
- IndentTextWriter.cs
- EmptyEnumerable.cs
- MbpInfo.cs
- ZipIOExtraFieldPaddingElement.cs
- PageParser.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- ValueProviderWrapper.cs
- MimeFormatExtensions.cs
- BasePattern.cs
- VisualCollection.cs
- HMACSHA256.cs
- ImageBrush.cs
- SqlClientWrapperSmiStreamChars.cs
- SerializeAbsoluteContext.cs
- SynchronizedDispatch.cs
- DataSetUtil.cs
- AutoCompleteStringCollection.cs
- BrowserCapabilitiesFactoryBase.cs
- DataGridViewCheckBoxCell.cs
- RegistrationServices.cs
- ReliableRequestSessionChannel.cs
- WebPartConnectionsCancelVerb.cs
- SafeMILHandleMemoryPressure.cs
- TextBoxBase.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- NamespaceInfo.cs
- NegatedCellConstant.cs
- GradientStop.cs
- TemplateNodeContextMenu.cs
- Style.cs
- FileNotFoundException.cs
- XmlQueryType.cs
- RawMouseInputReport.cs
- GacUtil.cs
- ConstraintManager.cs
- TransformerInfoCollection.cs
- LazyTextWriterCreator.cs
- ControlPropertyNameConverter.cs
- EnvelopedSignatureTransform.cs
- Cell.cs
- ListView.cs
- SqlUserDefinedAggregateAttribute.cs
- HttpPostedFile.cs
- FacetValues.cs
- SafeCryptContextHandle.cs
- TaiwanLunisolarCalendar.cs
- SecurityChannelFactory.cs
- ContractValidationHelper.cs
- SpecularMaterial.cs
- securitycriticaldataformultiplegetandset.cs
- Point3DKeyFrameCollection.cs
- LinkedResource.cs
- BatchStream.cs
- PagedDataSource.cs
- Activator.cs
- PipelineModuleStepContainer.cs
- AppSecurityManager.cs
- InputBinder.cs
- ComNativeDescriptor.cs
- BaseCAMarshaler.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- ToolStripDesigner.cs
- ReaderWriterLock.cs
- TypeConverterValueSerializer.cs
- ExpressionCopier.cs
- ExceptionUtil.cs
- ExtentKey.cs
- PageSetupDialog.cs
- DynamicRenderer.cs
- Decoder.cs
- SqlTypeSystemProvider.cs
- SafeFindHandle.cs
- LinqToSqlWrapper.cs
- FacetDescriptionElement.cs
- DataConnectionHelper.cs
- ControlPaint.cs
- XmlFormatWriterGenerator.cs
- ProfessionalColorTable.cs
- StorageRoot.cs
- CodeExporter.cs
- XmlNotation.cs
- DbgUtil.cs
- EventBuilder.cs
- TextServicesHost.cs